Closed Bug 1110761 Opened 10 years ago Closed 8 years ago

InvalidStateError raised when setting XMLHttpRequest.responseType while in state UNSENT

Categories

(Core :: DOM: Core & HTML, defect)

34 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 707484

People

(Reporter: zigarn+mozilla, Unassigned)

References

()

Details

(Keywords: reproducible, testcase, Whiteboard: [tw-dom])

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0
Build ID: 20141125180439

Steps to reproduce:

Set XMLHttpRequest.responseType while in UNSENT


Actual results:

InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable


Expected results:

No error.
Accordinlgy to http://www.w3.org/TR/XMLHttpRequest/#the-responsetype-attribute, this error should be thrown only in LOADING or DONE state.


Please see http://www.zigarn.com/test-set-responseType.html for trying to set 'responseType' on different states of XMLHttpRequest.
Result on Firefox 34.0:
XHR state: UNSENT ==> exception: InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
XHR state: OPENED ==> no exception
XHR state: HEADERS_RECEIVED ==> no exception
XHR state: LOADING ==> exception: InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
XHR state: DONE ==> exception: InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable

Result on Chrome 39.0.2171.71m:
XHR state: UNSENT ==> no exception
XHR state: OPENED ==> no exception
XHR state: HEADERS_RECEIVED ==> no exception
XHR state: LOADING ==> exception: InvalidStateError: Failed to set the 'responseType' property on 'XMLHttpRequest': The response type cannot be set if the object's state is LOADING or DONE.
XHR state: DONE ==> exception: InvalidStateError: Failed to set the 'responseType' property on 'XMLHttpRequest': The response type cannot be set if the object's state is LOADING or DONE.

Result on Internet Explorer 11.0.14:
XHR state: UNSENT ==> exception: InvalidStateError
XHR state: OPENED ==> no exception
XHR state: OPENED ==> no exception
 XHR state: HEADERS_RECEIVED ==> no exception
XHR state: LOADING ==> exception: InvalidStateError
XHR state: DONE ==> exception: InvalidStateError
This reproduces on Nightly on OS X as well.
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
OS: Windows 7 → All
Product: Firefox → Core
Hardware: x86_64 → All
The workaround is described in e.g. http://forums.udacity.com/questions/100022122/cross-browser-xmlhttprequestresponsetype — do not try to set `.responseType` before calling `.open()` lest you hit this out-of-spec behavior.
It seems this bug was resolved by https://hg.mozilla.org/mozilla-central/rev/b5bec86469c8#l1.38
I verified the test case responsetype.html with my local build and it passed.
Assignee: nobody → sshih
Shouldn't this be marked as fixed as of 38, then?
Flags: needinfo?(sshih)
Let's call it a dupe.
Assignee: sshih → nobody
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(sshih)
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.