-
Notifications
You must be signed in to change notification settings - Fork 348
fetch() is unclear on which realm's Request it uses #777
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
Comments
(For those who don't want to read IRC logs, all of this is observable through the We probably don't want to use the word "invoking" here at all, since it can mean multiple things: the ES Call abstract operation; invoke a callback function algorithm (this is probably the closest, since it contains logic to convert IDL arguments to back ES, even though
This would cause a slight discrepancy between Edit: Hmm, I guess this discrepancy is fine, since if we pass a I think we would want more testing before deciding if we |
I mean, it has to be bound to some realm. And we generally want to pick the relevant realm of this, for methods. (For constructors the "relevant realm of this" is not super well-defined, since the this object is still being created, and is derived from the realm of new.target, which is usually-but-not-with-Reflect.construct the current realm.) |
Right, I see. This kind of spawns another issue though. Currently in Chrome and Firefox |
Chrome and Firefox's behavior is the desired one. This is a clear-cut instance of whatwg/webidl#135 (triggered by "let p be a new promise"). More information on why at https://html.spec.whatwg.org/#realms-settings-objects-global-objects, starting with "In general, web platform specifications should use..." |
@jakearchibald @wanderview and I discovered that implementations might not follow this for the |
@rwlbuis this might be another interesting WebKit bug. I put some initial tests at web-platform-tests/wpt#24601. I need #1054 merged before working on specification changes though. |
Yes it may well be. Are you going to file bugs for the implementations? |
Yeah, before committing the change to Fetch bugs will be filed. |
@domenic @TimothyGu does this mean https://infra.spec.whatwg.org/#parse-json-from-bytes needs to accept a realm? |
I suppose so. It currently always uses the current Realm, because that's what ECMAScript always does. But if we want the web platform to continue its inconsistency with ECMAScript (which was reaffirmed semi-recently in whatwg/webidl#135 (comment)), then we'll need to make that overridable. |
Uh oh!
There was an error while loading. Please reload this page.
https://fetch.spec.whatwg.org/commit-snapshots/e6cbef27724dd6111d1646898ef4f3f9ad56740b/#fetch-method
Which realm does the Request constructor come from?
I think we want it to be the relevant realm of this WindowOrWorkerGlobalScope object. That seems most in line with our plan in whatwg/webidl#135, although that is about slightly different phrasing ("a new Response" vs. this line's "invoking the initial value of Request as constructor").
BTW, editorial issues with this sentence:
Found by @benjamingr and @TimothyGu in IRC: https://freenode.logbot.info/whatwg/20180712#c1621394
(BTW, @TimothyGu found another good thing to test: what if you create a Request from another window, and pass it to fetch()? What client does it use? Some inspection of Chrome's source code reveals it may not be using the other window, but that's what the spec says should happen.)
The text was updated successfully, but these errors were encountered: