-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Make sure that XHR uses the XDomainRequest on old browsers. #2633
Conversation
How will this affect same-domain tracks? |
Hm... Good question. XHR uses regular XmlHttpRequests in modern browsers, so, for those, we won't be affected. Looking into how XDR works to figure out whether it should be an issue as well as trying some out. |
I'm going to open an issue against XHR as well. |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: c8a8ed5290ea3f5ac882ef85dc37fe044fd22922 (Please note that this is a fully automated comment.) |
Also, sounds like XDR might work with same domain as long as the CORS headers are set up correctly. |
It works, still need to confirm whether it'll require CORS headers or not. |
Yep, XDR requires the CORS headers even for same-domain requests. |
If this doesn't introduce same-domain issues, then looks good to me. |
It does mean we can't request tracks from the same domain if it doesn't also include CORS. |
Btw, here's the issue against XHR: naugtur/xhr#94 |
I'm going to add https://github.com/videojs/video.js/blob/stable/src/js/xhr.js#L80-L84 in here for now so it won't be a blocker and then we can discuss naugtur/xhr#94 there and whether a PR for this will be submitted. |
Looks like that doesn't specific snippet doesn't take into account protocol relative urls. But I know how to handle those too. |
@heff a more complete implementation now. |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: b5718b9 (Please note that this is a fully automated comment.) |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 25f26ac (Please note that this is a fully automated comment.) |
let srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol; | ||
// Check if url is for another domain/origin | ||
// IE8 doesn't know location.origin, so we won't rely on it here | ||
let crossOrigin = (srcProtocol + urlInfo.host) !== (winLoc.protocol + winLoc.host); |
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.
maybe I should move that into our url
module.
lgtm Conversation from chat.
|
Write some tests using proxyquireify to mock out 'global/window' in url.js.
lgtm! |
@@ -1,6 +1,8 @@ | |||
import document from 'global/document'; | |||
import window from 'global/window'; | |||
import * as Url from '../../../src/js/utils/url.js'; | |||
import proxyquireify from 'proxyquireify'; | |||
const proxyquire = proxyquireify(require); |
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.
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.
Opened an issue: sindresorhus/merge-descriptors#5
Somehow completely missed the jshint issue. |
// IE8 protocol relative urls will return ':' for protocol | ||
let srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol; | ||
|
||
console.log(srcProtocol, winLoc.protocol, urlInfo.host, winLoc.host); |
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.
this is for travis testing :/. Will be removed ASAP.
No description provided.