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.22 to 1.0.23

dist/.gitignore

39

dist/cross-domain-safe-weakmap.js

@@ -41,2 +41,16 @@ !function(root, factory) {

}({
"./node_modules/cross-domain-utils/src/constants.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.d(__webpack_exports__, "a", function() {
return PROTOCOL;
});
__webpack_require__.d(__webpack_exports__, "b", function() {
return WILDCARD;
});
var PROTOCOL = {
MOCK: "mock:",
FILE: "file:",
ABOUT: "about:"
}, WILDCARD = "*";
},
"./node_modules/cross-domain-utils/src/index.js": function(module, __webpack_exports__, __webpack_require__) {

@@ -52,3 +66,3 @@ "use strict";

var __WEBPACK_IMPORTED_MODULE_1__types__ = __webpack_require__("./node_modules/cross-domain-utils/src/types.js");
__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__types__);
__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__types__), __webpack_require__("./node_modules/cross-domain-utils/src/constants.js");
},

@@ -58,2 +72,3 @@ "./node_modules/cross-domain-utils/src/types.js": function(module, exports) {},

"use strict";
var constants = __webpack_require__("./node_modules/cross-domain-utils/src/constants.js");
__webpack_exports__.b = function(win) {

@@ -117,3 +132,3 @@ var allowMock = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];

var doc = frame.ownerDocument;
return !(!doc || !doc.body || doc.body.contains(frame));
return !(!doc || !doc.documentElement || doc.documentElement.contains(frame));
}(frame)) return !0;

@@ -161,10 +176,5 @@ }

};
var CONSTANTS = {
MOCK_PROTOCOL: "mock:",
FILE_PROTOCOL: "file:",
ABOUT_PROTOCOL: "about:",
WILDCARD: "*"
}, IE_WIN_ACCESS_ERROR = "Call was rejected by callee.\r\n";
var IE_WIN_ACCESS_ERROR = "Call was rejected by callee.\r\n";
function isAboutProtocol() {
return (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window).location.protocol === CONSTANTS.ABOUT_PROTOCOL;
return (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window).location.protocol === constants.a.ABOUT;
}

@@ -183,4 +193,4 @@ function canReadFromWindow(win) {

if (!protocol) throw new Error("Can not read window protocol");
if (protocol === CONSTANTS.FILE_PROTOCOL) return CONSTANTS.FILE_PROTOCOL + "//";
if (protocol === CONSTANTS.ABOUT_PROTOCOL) {
if (protocol === constants.a.FILE) return constants.a.FILE + "//";
if (protocol === constants.a.ABOUT) {
var parent = function(win) {

@@ -191,3 +201,3 @@ if (win) try {

}(win);
return parent && canReadFromWindow(parent) ? getActualDomain(parent) : CONSTANTS.ABOUT_PROTOCOL + "//";
return parent && canReadFromWindow(parent) ? getActualDomain(parent) : constants.a.ABOUT + "//";
}

@@ -200,3 +210,3 @@ var host = location.host;

var domain = getActualDomain(win = win || window);
return domain && win.mockDomain && 0 === win.mockDomain.indexOf(CONSTANTS.MOCK_PROTOCOL) ? win.mockDomain : domain;
return domain && win.mockDomain && 0 === win.mockDomain.indexOf(constants.a.MOCK) ? win.mockDomain : domain;
}

@@ -332,3 +342,3 @@ var iframeWindows = [], iframeFrames = [];

if (weakmap) try {
return weakmap.has(key);
if (weakmap.has(key)) return !0;
} catch (err) {

@@ -359,3 +369,2 @@ delete this.weakmap;

});
//# sourceMappingURL=cross-domain-safe-weakmap.js.map
//# sourceMappingURL=cross-domain-safe-weakmap.js.map

@@ -1,3 +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={};r.d(n,"WeakMap",function(){return u});var i=r(1);function o(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}var a=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)){var n=this.name,i=t[n];i&&i[0]===t?i[1]=e:a(t,n,{value:[t,e],writable:!0})}else{this._cleanupClosedWindows();var c=this.keys,u=this.values,s=o(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)){this._cleanupClosedWindows();var r=o(this.keys,t);if(-1===r)return;return this.values[r]}var n=t[this.name];if(n&&n[0]===t)return n[1]},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)){var r=t[this.name];r&&r[0]===t&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var n=this.keys,i=o(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{return e.has(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t)){var r=t[this.name];return!(!r||r[0]!==t)}return this._cleanupClosedWindows(),-1!==o(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(2);r.d(e,"isWindow",function(){return n.a}),r.d(e,"isWindowClosed",function(){return n.b});var i=r(3);r.n(i)},function(t,e,r){"use strict";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(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}(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.body||e.body.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 n={MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",ABOUT_PROTOCOL:"about:",WILDCARD:"*"},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_PROTOCOL}function a(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_PROTOCOL)return n.FILE_PROTOCOL+"//";if(r===n.ABOUT_PROTOCOL){var i=function(t){if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}(t);return i&&a(i)?c(i):n.ABOUT_PROTOCOL+"//"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function u(t){var e=c(t=t||window);return e&&t.mockDomain&&0===t.mockDomain.indexOf(n.MOCK_PROTOCOL)?t.mockDomain:e}var s=[],f=[]},function(t,e){}])});
//# sourceMappingURL=cross-domain-safe-weakmap.min.js.map
!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)){var n=this.name,i=t[n];i&&i[0]===t?i[1]=e:o(t,n,{value:[t,e],writable:!0})}else{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)){this._cleanupClosedWindows();var r=a(this.keys,t);if(-1===r)return;return this.values[r]}var n=t[this.name];if(n&&n[0]===t)return n[1]},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)){var r=t[this.name];r&&r[0]===t&&(r[0]=r[1]=void 0)}else{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)){var r=t[this.name];return!(!r||r[0]!==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

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

try {
return weakmap.has(key);
if (weakmap.has(key)) {
return true;
}
} catch (err) {

@@ -210,0 +212,0 @@ delete this.weakmap;

{
"name": "cross-domain-safe-weakmap",
"version": "1.0.22",
"version": "1.0.23",
"description": "Cross domain safe WeakMap.",

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

@@ -214,3 +214,5 @@ /* @flow */

try {
return weakmap.has(key);
if (weakmap.has(key)) {
return true;
}
} catch (err) {

@@ -217,0 +219,0 @@ delete this.weakmap;

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