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

cross-domain-safe-weakmap

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-domain-safe-weakmap - npm Package Compare versions

Comparing version 1.0.24 to 1.0.25

2

dist/cross-domain-safe-weakmap.js

@@ -297,3 +297,3 @@ !function(root, factory) {

if (weakmap) try {
return weakmap.has(key) ? weakmap.get(key) : void 0;
if (weakmap.has(key)) return weakmap.get(key);
} catch (err) {

@@ -300,0 +300,0 @@ delete this.weakmap;

@@ -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=1)}([function(t,e,r){"use strict";r.d(e,"a",function(){return n}),r.d(e,"b",function(){return i});var n={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="*"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={};r.d(n,"WeakMap",function(){return u});var i=r(2);function a(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}var o=Object.defineProperty,c=Date.now()%1e9,u=function(){function t(){if(function(e,r){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),c+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+c,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(Object(i.isWindow)(n)&&Object(i.isWindowClosed)(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(Object(i.isWindow)(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:o(t,n,{value:[t,e],writable:!0}))}catch(t){}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=a(c,t);-1===s?(c.push(t),u.push(e)):u[s]=e},t.prototype.get=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{return e.has(t)?e.get(t):void 0}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=a(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=a(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!==a(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 u}),e.default=n},function(t,e,r){"use strict";var n=r(3);r.d(e,"isWindow",function(){return n.a}),r.d(e,"isWindowClosed",function(){return n.b});var i=r(4);r.n(i),r(0)},function(t,e,r){"use strict";var n=r(0);e.b=function(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}(s,t);if(-1!==r){var n=f[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},e.a=function(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{t&&t.__cross_domain_utils_window_check__}catch(t){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===n.a.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.a.FILE)return n.a.FILE+"//";if(r===n.a.ABOUT){var i=function(t){if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}(t);return i&&o(i)?c(i):n.a.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.a.MOCK)?t.mockDomain:e}var s=[],f=[]},function(t,e){}])});
!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=1)}([function(t,e,r){"use strict";r.d(e,"a",function(){return n}),r.d(e,"b",function(){return i});var n={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="*"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={};r.d(n,"WeakMap",function(){return u});var i=r(2);function a(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}var o=Object.defineProperty,c=Date.now()%1e9,u=function(){function t(){if(function(e,r){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),c+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+c,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(Object(i.isWindow)(n)&&Object(i.isWindowClosed)(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(Object(i.isWindow)(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:o(t,n,{value:[t,e],writable:!0}))}catch(t){}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=a(c,t);-1===s?(c.push(t),u.push(e)):u[s]=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=a(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=a(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!==a(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 u}),e.default=n},function(t,e,r){"use strict";var n=r(3);r.d(e,"isWindow",function(){return n.a}),r.d(e,"isWindowClosed",function(){return n.b});var i=r(4);r.n(i),r(0)},function(t,e,r){"use strict";var n=r(0);e.b=function(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}(s,t);if(-1!==r){var n=f[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},e.a=function(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{t&&t.__cross_domain_utils_window_check__}catch(t){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===n.a.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.a.FILE)return n.a.FILE+"//";if(r===n.a.ABOUT){var i=function(t){if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}(t);return i&&o(i)?c(i):n.a.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.a.MOCK)?t.mockDomain:e}var s=[],f=[]},function(t,e){}])});
//# sourceMappingURL=cross-domain-safe-weakmap.min.js.map

@@ -137,3 +137,2 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

}
return;
} catch (err) {

@@ -140,0 +139,0 @@ delete this.weakmap;

{
"name": "cross-domain-safe-weakmap",
"version": "1.0.24",
"version": "1.0.25",
"description": "Cross domain safe WeakMap.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -142,3 +142,2 @@ /* @flow */

}
return;

@@ -145,0 +144,0 @@ } catch (err) {

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc