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

Should send() throw if the XHR object's window's document is not fully active? #65

Open
bzbarsky opened this issue Apr 20, 2016 · 8 comments

Comments

@bzbarsky
Copy link

We seem to have a fully active check in open() but not send(). That doesn't make much sense to me...

@annevk
Copy link
Member

annevk commented Apr 20, 2016

Does having the check help at all? Most other APIs don't have it...

@bzbarsky
Copy link
Author

That's the other question, yes. @smaug---- might know why we do these checks in Gecko...

@smaug----
Copy link

The initial reason in Gecko was https://bugzilla.mozilla.org/show_bug.cgi?id=403168
but the setup we have for wrappers and such is quite different these days.

However, what should happen to the network connection if XHR is created using non-active document, like if the response is super slow, what kills it? I assume browsers normally cancel relevant network connections when unloading a page, but if the page has been unloaded already...

@annevk
Copy link
Member

annevk commented Apr 20, 2016

@smaug---- not sure, maybe the connection is not established until such a time that the document does become active...

@annevk
Copy link
Member

annevk commented Mar 13, 2017

Tests that other browsers not pass because of this:

  • XMLHttpRequest/open-url-multi-window-2.htm
  • XMLHttpRequest/open-url-multi-window-3.htm
  • XMLHttpRequest/open-url-multi-window-4.htm
  • XMLHttpRequest/open-url-multi-window-5.htm

Also XMLHttpRequest/open-url-multi-window-6.htm seems to not pass anywhere. I think based on this and the somewhat flawed security reason to add this initially, we should just remove this.

@annevk
Copy link
Member

annevk commented Mar 13, 2017

Hmm, it's not that simple, Chrome will throw on send() instead if the document is "detached" (whatever that means). Safari times out.

@annevk
Copy link
Member

annevk commented Mar 13, 2017

I think the main reason the check is in open() is because we need the document's base URL for open(). I wonder what happens if you pass a "detached" document to send() though.

@domenic
Copy link
Member

domenic commented May 20, 2017

Ran into this in jsdom as well, trying to implement the spec but failing opoen-url-multi-window-3.htm because we didn't include some kind of detached check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants