InvalidStateError raised when setting XMLHttpRequest.responseType while in state UNSENT

Issue #1649320


Feb 11, 2015
This issue is public.
Reported by 0 people

Sign in to watch or report this issue.

Steps to reproduce


Repro Steps:

  1. Set XMLHttpRequest.responseType while in UNSENT
  2. You get an “InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable”

{Source code for repro used}
<!doctype html>
<html lang="en">
<meta charset="utf-8">

    <title>Test set responsetype</title>

    <div id="content" />

        var container = document.getElementById('content');
        var req = new XMLHttpRequest();
        function displayState(state) {
            switch(state) {
                case XMLHttpRequest.UNSENT:
                    return 'UNSENT';
                case XMLHttpRequest.OPENED:
                    return 'OPENED';
                case XMLHttpRequest.HEADERS_RECEIVED:
                    return 'HEADERS_RECEIVED';
                case XMLHttpRequest.LOADING:
                    return 'LOADING';
                case XMLHttpRequest.DONE:
                    return 'DONE';
        req.onreadystatechange = function() {
            try {
                req.responseType = 'json';
                container.innerHTML += 'XHR state: ' + displayState(req.readyState) + ' ==> no exception<br />';
            } catch (e) {
                container.innerHTML += 'XHR state: ' + displayState(req.readyState) + ' ==> exception: ' + e + '<br />';
        req.onreadystatechange();'GET', '/');


Expected Results:

No error.

Actual Results:

Dev Channel specific:



0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Tony S.”

      Changed Assigned To to “Venkat K.”

      Changed Assigned To from “Venkat K.” to “Brandon M.”

      Changed Status to “Confirmed”

      Changed Assigned To from “Brandon M.” to “IE F.”

      Changed Status from “Confirmed”

    You need to sign in to your Microsoft account to add a comment.

    Sign in