Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XMLHttpRequest/status-async.htm doesn't complete #3877

Closed
jdm opened this issue Nov 3, 2014 · 3 comments
Closed

XMLHttpRequest/status-async.htm doesn't complete #3877

jdm opened this issue Nov 3, 2014 · 3 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Nov 3, 2014

onreadystatechange is never called with readyState == 4 for reasons that escape me, so the overall test times out. Easiest debugging is to comment out all but the first status call, and comment out the CHICKEN and HEAD requests. notify_partial_progress(DoneMsg) is called, but I can't figure out why the readystatechange event doesn't appear to fire.

@Manishearth Manishearth removed their assignment Nov 6, 2014
@Manishearth
Copy link
Member

@Manishearth Manishearth commented Nov 6, 2014

@mukilan is working on this

@mukilan
Copy link
Contributor

@mukilan mukilan commented Nov 6, 2014

This issue is that in the current implementation, readystatechange is triggered only when the state is changing from LOADING to DONE, and not when it transitions directly from HEADERS_RECEIVED to DONE .The first status call i.e status(204, "UNICORNSWIN", "", "") has an empty response body. This means that a Payload event is never received from resource_loader, which inturn implies that only notfiy_partial_progress(HeadersReceivedMsg) and notify_partial_progress(DoneMsg) are called. Thus the state transitions to neither 'Loading' nor 'XHRDone' .

This is a bug with respect to the WHATWG specificaton. However the current implementation seems to be in line with the W3C spec - the last clause under same-origin request event rules reads as follows:

Once the whole response entity body has been received
If there is no response entity body and *the state is LOADING*
If there is no response entity body and *the synchronous flag is set*

    Switch to the DONE state.

But note that the W3C spec also requires:

If there is no response entity body and the synchronous flag is unset

    Switch to the LOADING state.

which means the readystatechange event will be called in all cases (response body is present or not)

I'm not sure whether the choice of following the W3C spec was intentional or just an accident, but it is clear that both the specs require readystatechange to be called even when there is no response body. To maintain consistency, we can remove the gaurd and follow the WHATWG version.

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Nov 6, 2014

IIRC there was an error elsewhere in wpt which made me tack on the guard. I forget now, but removing the guard seems logical at the moment.

mukilan added a commit to mukilan/servo that referenced this issue Nov 6, 2014
bors-servo pushed a commit that referenced this issue Nov 6, 2014
bors-servo pushed a commit that referenced this issue Nov 7, 2014
bors-servo pushed a commit that referenced this issue Nov 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.