Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resource-loader

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resource-loader - npm Package Compare versions

Comparing version 1.5.5 to 1.5.6

3

package.json
{
"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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc