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.6 to 1.0.7

8

dist/cross-domain-safe-weakmap.js

@@ -104,3 +104,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

if ((0, _native.hasNativeWeakMap)()) {
this.weakmap = new window.WeakMap();
try {
this.weakmap = new window.WeakMap();
} catch (err) {}
}

@@ -119,3 +121,5 @@ this.keys = [];

if (weakmap) {
weakmap["delete"](value);
try {
weakmap["delete"](value);
} catch (err) {}
}

@@ -122,0 +126,0 @@ keys.splice(i, 1);

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("xdsweakmap",[],t):"object"==typeof exports?exports.xdsweakmap=t():e.xdsweakmap=t()}(this,function(){return function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={exports:{},id:a,loaded:!1};return e[a].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})});var i=a(r);t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2);Object.defineProperty(t,"WeakMap",{enumerable:!0,get:function(){return a.WeakMap}})},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.WeakMap=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(3),s=n(4),o=Object.defineProperty,u=Date.now()%1e9;t.WeakMap=function(){function e(){a(this,e),u+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+u,(0,s.hasNativeWeakMap)()&&(this.weakmap=new window.WeakMap),this.keys=[],this.values=[]}return r(e,[{key:"_cleanupClosedWindows",value:function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var a=t[n];(0,i.isClosedWindow)(a)&&(e&&e.delete(a),t.splice(n,1),this.values.splice(n,1),n-=1)}}},{key:"set",value:function(e,t){var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if((0,i.isWindow)(e)){this._cleanupClosedWindows();var a=this.keys,r=this.values,s=a.indexOf(e);s===-1?(a.push(e),r.push(t)):r[s]=t}else{var u=this.name,c=e[u];c&&c[0]===e?c[1]=t:o(e,u,{value:[e,t],writable:!0})}}},{key:"get",value:function(e){var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if((0,i.isWindow)(e)){var n=this.keys,a=n.indexOf(e);if(a===-1)return;return this.values[a]}var r=e[this.name];if(r&&r[0]===e)return r[1]}},{key:"delete",value:function(e){var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if((0,i.isWindow)(e)){this._cleanupClosedWindows();var n=this.keys,a=n.indexOf(e);a!==-1&&(n.splice(a,1),this.values.splice(a,1))}else{var r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}}},{key:"has",value:function(e){var t=this.weakmap;if(t)try{return t.has(e)}catch(e){delete this.weakmap}if((0,i.isWindow)(e))return this._cleanupClosedWindows(),this.keys.indexOf(e)!==-1;var n=e[this.name];return!(!n||n[0]!==e)}}]),e}()},function(e,t){"use strict";function n(e){try{if(e&&e.self===e)return!0}catch(e){}return!1}function a(e){try{if(e&&e!==window&&e.closed)return!0}catch(e){return!e||"Call was rejected by callee.\r\n"!==e.message}return!1}Object.defineProperty(t,"__esModule",{value:!0}),t.isWindow=n,t.isClosedWindow=a},function(e,t){"use strict";function n(){if(!window.WeakMap)return!1;if(!window.Object.freeze)return!1;try{var e=new window.WeakMap,t={},n="__testvalue__";return window.Object.freeze(t),e.set(t,n),e.get(t)===n}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.hasNativeWeakMap=n}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("xdsweakmap",[],t):"object"==typeof exports?exports.xdsweakmap=t():e.xdsweakmap=t()}(this,function(){return function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={exports:{},id:a,loaded:!1};return e[a].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})});var i=a(r);t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2);Object.defineProperty(t,"WeakMap",{enumerable:!0,get:function(){return a.WeakMap}})},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.WeakMap=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(3),s=n(4),o=Object.defineProperty,u=Date.now()%1e9;t.WeakMap=function(){function e(){if(a(this,e),u+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+u,(0,s.hasNativeWeakMap)())try{this.weakmap=new window.WeakMap}catch(e){}this.keys=[],this.values=[]}return r(e,[{key:"_cleanupClosedWindows",value:function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var a=t[n];if((0,i.isClosedWindow)(a)){if(e)try{e.delete(a)}catch(e){}t.splice(n,1),this.values.splice(n,1),n-=1}}}},{key:"set",value:function(e,t){var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if((0,i.isWindow)(e)){this._cleanupClosedWindows();var a=this.keys,r=this.values,s=a.indexOf(e);s===-1?(a.push(e),r.push(t)):r[s]=t}else{var u=this.name,c=e[u];c&&c[0]===e?c[1]=t:o(e,u,{value:[e,t],writable:!0})}}},{key:"get",value:function(e){var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if((0,i.isWindow)(e)){var n=this.keys,a=n.indexOf(e);if(a===-1)return;return this.values[a]}var r=e[this.name];if(r&&r[0]===e)return r[1]}},{key:"delete",value:function(e){var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if((0,i.isWindow)(e)){this._cleanupClosedWindows();var n=this.keys,a=n.indexOf(e);a!==-1&&(n.splice(a,1),this.values.splice(a,1))}else{var r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}}},{key:"has",value:function(e){var t=this.weakmap;if(t)try{return t.has(e)}catch(e){delete this.weakmap}if((0,i.isWindow)(e))return this._cleanupClosedWindows(),this.keys.indexOf(e)!==-1;var n=e[this.name];return!(!n||n[0]!==e)}}]),e}()},function(e,t){"use strict";function n(e){try{if(e&&e.self===e)return!0}catch(e){}return!1}function a(e){try{if(e&&e!==window&&e.closed)return!0}catch(e){return!e||"Call was rejected by callee.\r\n"!==e.message}return!1}Object.defineProperty(t,"__esModule",{value:!0}),t.isWindow=n,t.isClosedWindow=a},function(e,t){"use strict";function n(){if(!window.WeakMap)return!1;if(!window.Object.freeze)return!1;try{var e=new window.WeakMap,t={},n="__testvalue__";return window.Object.freeze(t),e.set(t,n),e.get(t)===n}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.hasNativeWeakMap=n}])});
//# sourceMappingURL=cross-domain-safe-weakmap.min.js.map
{
"name": "cross-domain-safe-weakmap",
"version": "1.0.6",
"version": "1.0.7",
"description": "Cross domain safe WeakMap.",

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

@@ -21,3 +21,7 @@ /* @flow */

if (hasNativeWeakMap()) {
this.weakmap = new window.WeakMap();
try {
this.weakmap = new window.WeakMap();
} catch (err) {
// pass
}
}

@@ -40,3 +44,7 @@

if (weakmap) {
weakmap.delete(value);
try {
weakmap.delete(value);
} catch (err) {
// pass
}
}

@@ -110,3 +118,3 @@

if (isWindow(key)) {
let keys = this.keys;

@@ -113,0 +121,0 @@ let index = keys.indexOf(key);

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