-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Perform XHR in the main context #7818
Conversation
23a17ff
to
68d2171
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending resolution of comment
…referrer information IE11 doesn't send the correct referrer for XHRs in a web worker. Instead, we're now doing the request from the main context and transfering the result back to the worker. Most modern browsers will continue to use the Fetch API and will not be affected by this change.
Also fixes #7603 |
// that we can get an accruate referrer header. | ||
// - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In | ||
// this case we unconditionally use XHR on the current thread since referrers don't matter. | ||
if (!/^file:/.test(requestParameters.url)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't work with relative URLs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm this, you have to specify the absolute path with the file protocol before passing it in, else it thinks it is an http request and throws an error about the file protocol like before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...rather than the worker's to preserve referrer information.
IE11 doesn't send the correct referrer for XHRs in a web worker. Instead, we're now doing the request from the main context and transfering the result back to the worker. Most modern browsers will continue to use the Fetch API introduced in #7371 and will not be affected by this change.
Launch Checklist
document any changes to public APIsI looked at the impact of transferring the ArrayBuffer/Image object in IE and it's very small, typically below 1ms. In any case, this code path will only be triggered in IE11 (and other older browsers that don't support the Fetch API).
I added a
Cancelable
mode to the Actor as well so that we can cancel requests across workers.