Socket
Socket
Sign inDemoInstall

cross-domain-safe-weakmap

Package Overview
Dependencies
2
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.26 to 1.0.27

8

dist/cross-domain-safe-weakmap.js

@@ -61,4 +61,4 @@ !function(root, factory) {

}
function getActualDomain(win) {
var location = (win = win || window).location;
function getActualDomain() {
var win = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window, location = win.location;
if (!location) throw new Error("Can not read window location");

@@ -81,4 +81,4 @@ var protocol = location.protocol;

}
function getDomain(win) {
var domain = getActualDomain(win = win || window);
function getDomain() {
var win = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window, domain = getActualDomain(win);
return domain && win.mockDomain && 0 === win.mockDomain.indexOf(PROTOCOL.MOCK) ? win.mockDomain : domain;

@@ -85,0 +85,0 @@ }

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("xdsweakmap",[],e):"object"==typeof exports?exports.xdsweakmap=e():t.xdsweakmap=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===n.ABOUT}function o(t){try{return t&&t.location&&t.location.href,!0}catch(t){}return!1}function c(t){var e=(t=t||window).location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===n.FILE)return n.FILE+"//";if(r===n.ABOUT){var i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}(t);return i&&o(i)?c(i):n.ABOUT+"//"}var a=e.host;if(!a)throw new Error("Can not read window host");return r+"//"+a}function u(t){var e=c(t=t||window);return e&&t.mockDomain&&0===t.mockDomain.indexOf(n.MOCK)?t.mockDomain:e}var f=[],s=[];function h(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(t===window)return!1}catch(t){return!0}try{if(!t)return!0}catch(t){return!0}try{if(t.closed)return!0}catch(t){return!t||t.message!==i}if(e&&function(t){if(!function(t){try{if(t===window)return!0}catch(t){}try{var e=Object.getOwnPropertyDescriptor(t,"location");if(e&&!1===e.enumerable)return!1}catch(t){}try{if(a(t)&&o(t))return!0}catch(t){}try{if(c(t)===c(window))return!0}catch(t){}return!1}(t))return!1;try{if(t===window)return!0;if(a(t)&&o(t))return!0;if(u(window)===u(t))return!0}catch(t){}return!1}(t))try{if(t.mockclosed)return!0}catch(t){}try{if(!t.parent||!t.top)return!0}catch(t){}var r=function(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}(f,t);if(-1!==r){var n=s[r];if(n&&function(t){if(!t.contentWindow)return!0;if(!t.parentNode)return!0;var e=t.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(t))}(n))return!0}return!1}function p(t){try{if(t===window)return!0}catch(t){if(t&&t.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(t))return!0}catch(t){if(t&&t.message===i)return!0}try{if(window.Window&&t instanceof window.Window)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.self===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.parent===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.top===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&"__unlikely_value__"===t.__cross_domain_utils_window_check__)return!1}catch(t){return!0}return!1}function d(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}var l=function(){function t(){if(function(e,r){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var t=new WeakMap,e={};return Object.freeze(e),t.set(e,"__testvalue__"),"__testvalue__"===t.get(e)}catch(t){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}return t.prototype._cleanupClosedWindows=function(){for(var t=this.weakmap,e=this.keys,r=0;r<e.length;r++){var n=e[r];if(p(n)&&h(n)){if(t)try{t.delete(n)}catch(t){}e.splice(r,1),this.values.splice(r,1),r-=1}}},t.prototype.isSafeToReadWrite=function(t){if(p(t))return!1;try{t&&t.self,t&&t[this.name]}catch(t){return!1}return!0},t.prototype.set=function(t,e){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(t,e)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var n=this.name,i=t[n];return void(i&&i[0]===t?i[1]=e:Object.defineProperty(t,n,{value:[t,e],writable:!0}))}catch(t){}this._cleanupClosedWindows();var a=this.keys,o=this.values,c=d(a,t);-1===c?(a.push(t),o.push(e)):o[c]=e},t.prototype.get=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return e.get(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return r&&r[0]===t?r[1]:void 0}catch(t){}this._cleanupClosedWindows();var n=d(this.keys,t);if(-1!==n)return this.values[n]},t.prototype.delete=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];r&&r[0]===t&&(r[0]=r[1]=void 0)}catch(t){}this._cleanupClosedWindows();var n=this.keys,i=d(n,t);-1!==i&&(n.splice(i,1),this.values.splice(i,1))},t.prototype.has=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return!0}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return!(!r||r[0]!==t)}catch(t){}return this._cleanupClosedWindows(),-1!==d(this.keys,t)},t.prototype.getOrSet=function(t,e){if(this.has(t))return this.get(t);var r=e();return this.set(t,r),r},t}();r.d(e,"WeakMap",function(){return l})}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("xdsweakmap",[],e):"object"==typeof exports?exports.xdsweakmap=e():t.xdsweakmap=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="Call was rejected by callee.\r\n";function o(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===n.ABOUT}function a(t){try{return t&&t.location&&t.location.href,!0}catch(t){}return!1}function c(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=t.location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===n.FILE)return n.FILE+"//";if(r===n.ABOUT){var i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}(t);return i&&a(i)?c(i):n.ABOUT+"//"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=c(t);return e&&t.mockDomain&&0===t.mockDomain.indexOf(n.MOCK)?t.mockDomain:e}var f=[],s=[];function h(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(t===window)return!1}catch(t){return!0}try{if(!t)return!0}catch(t){return!0}try{if(t.closed)return!0}catch(t){return!t||t.message!==i}if(e&&function(t){if(!function(t){try{if(t===window)return!0}catch(t){}try{var e=Object.getOwnPropertyDescriptor(t,"location");if(e&&!1===e.enumerable)return!1}catch(t){}try{if(o(t)&&a(t))return!0}catch(t){}try{if(c(t)===c(window))return!0}catch(t){}return!1}(t))return!1;try{if(t===window)return!0;if(o(t)&&a(t))return!0;if(u(window)===u(t))return!0}catch(t){}return!1}(t))try{if(t.mockclosed)return!0}catch(t){}try{if(!t.parent||!t.top)return!0}catch(t){}var r=function(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}(f,t);if(-1!==r){var n=s[r];if(n&&function(t){if(!t.contentWindow)return!0;if(!t.parentNode)return!0;var e=t.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(t))}(n))return!0}return!1}function d(t){try{if(t===window)return!0}catch(t){if(t&&t.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(t))return!0}catch(t){if(t&&t.message===i)return!0}try{if(window.Window&&t instanceof window.Window)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.self===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.parent===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.top===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&"__unlikely_value__"===t.__cross_domain_utils_window_check__)return!1}catch(t){return!0}return!1}function p(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}var l=function(){function t(){if(function(e,r){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var t=new WeakMap,e={};return Object.freeze(e),t.set(e,"__testvalue__"),"__testvalue__"===t.get(e)}catch(t){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}return t.prototype._cleanupClosedWindows=function(){for(var t=this.weakmap,e=this.keys,r=0;r<e.length;r++){var n=e[r];if(d(n)&&h(n)){if(t)try{t.delete(n)}catch(t){}e.splice(r,1),this.values.splice(r,1),r-=1}}},t.prototype.isSafeToReadWrite=function(t){if(d(t))return!1;try{t&&t.self,t&&t[this.name]}catch(t){return!1}return!0},t.prototype.set=function(t,e){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(t,e)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var n=this.name,i=t[n];return void(i&&i[0]===t?i[1]=e:Object.defineProperty(t,n,{value:[t,e],writable:!0}))}catch(t){}this._cleanupClosedWindows();var o=this.keys,a=this.values,c=p(o,t);-1===c?(o.push(t),a.push(e)):a[c]=e},t.prototype.get=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return e.get(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return r&&r[0]===t?r[1]:void 0}catch(t){}this._cleanupClosedWindows();var n=p(this.keys,t);if(-1!==n)return this.values[n]},t.prototype.delete=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];r&&r[0]===t&&(r[0]=r[1]=void 0)}catch(t){}this._cleanupClosedWindows();var n=this.keys,i=p(n,t);-1!==i&&(n.splice(i,1),this.values.splice(i,1))},t.prototype.has=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return!0}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return!(!r||r[0]!==t)}catch(t){}return this._cleanupClosedWindows(),-1!==p(this.keys,t)},t.prototype.getOrSet=function(t,e){if(this.has(t))return this.get(t);var r=e();return this.set(t,r),r},t}();r.d(e,"WeakMap",function(){return l})}])});
//# sourceMappingURL=cross-domain-safe-weakmap.min.js.map
{
"name": "cross-domain-safe-weakmap",
"version": "1.0.26",
"version": "1.0.27",
"description": "Cross domain safe WeakMap.",

@@ -9,3 +9,3 @@ "main": "index.js",

"lint": "eslint src/ test/ *.js",
"flow-typed": "flow-typed install",
"flow-typed": "rm -rf ./flow-typed && flow-typed install",
"flow": "flow",

@@ -45,3 +45,3 @@ "karma": "cross-env NODE_ENV=test babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/karma start",

"devDependencies": {
"flow-bin": "^0.100.0",
"flow-bin": "^0.109.0",
"grumbler-scripts": "^2.0.18",

@@ -48,0 +48,0 @@ "mocha": "^2.5.3"

@@ -11,3 +11,3 @@ /* @flow */

name : string
weakmap : WeakMap<K, V>
weakmap : ?WeakMap<K, V>
keys : Array<K>

@@ -14,0 +14,0 @@ values : Array<V>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc