resource-loader
Advanced tools
Comparing version 1.5.5 to 1.5.6
{ | ||
"name": "resource-loader", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"main": "./src/index.js", | ||
@@ -45,2 +45,3 @@ "description": "A generic asset loader, made with web games in mind.", | ||
"sinon-chai": "^2.7.0", | ||
"testem": "^0.8.3", | ||
"vinyl-buffer": "^1.0.0", | ||
@@ -47,0 +48,0 @@ "vinyl-source-stream": "^1.1.0", |
@@ -247,3 +247,3 @@ var EventEmitter = require('eventemitter3'), | ||
if (typeof this.crossOrigin !== 'string') { | ||
this.crossOrigin = this._determineCrossOrigin(); | ||
this.crossOrigin = this._determineCrossOrigin(this.url); | ||
} | ||
@@ -537,10 +537,15 @@ | ||
* @private | ||
* @param url {string} The url to test. | ||
* @param [location=window.location] {object} The location object to test against. | ||
* @return {string} The crossOrigin value to use (or empty string for none). | ||
*/ | ||
Resource.prototype._determineCrossOrigin = function () { | ||
Resource.prototype._determineCrossOrigin = function (url, loc) { | ||
// data: and javascript: urls are considered same-origin | ||
if (this.url.indexOf('data:') === 0) { | ||
if (url.indexOf('data:') === 0) { | ||
return ''; | ||
} | ||
// default is window.location | ||
loc = loc || window.location; | ||
if (!tempAnchor) { | ||
@@ -553,8 +558,9 @@ tempAnchor = document.createElement('a'); | ||
// because they don't work in IE9 :( | ||
tempAnchor.href = this.url; | ||
var url = _url.parse(tempAnchor.href), | ||
loc = window.location; | ||
tempAnchor.href = url; | ||
url = _url.parse(tempAnchor.href); | ||
var samePort = (!url.port && loc.port === '') || (url.port === loc.port); | ||
// if cross origin | ||
if (url.hostname !== loc.hostname || url.port !== loc.port || url.protocol !== loc.protocol) { | ||
if (url.hostname !== loc.hostname || !samePort || url.protocol !== loc.protocol) { | ||
return 'anonymous'; | ||
@@ -561,0 +567,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60419
1369
22