mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-28 14:56:35 +01:00
0981509e82
* bump parse5; port patch * devDeps: jsdom@11.5.1->16.7.0 - patch-revert https://github.com/jsdom/jsdom/pull/2076 - jsdom's storage-overriding does not play well with test suite usage of localforage: $ yarn test:unit:global ✖ ERROR: TypeError: Cannot set property localStorage of #<Window> which has only a getter at Object.<anonymous> (/app/test/helpers/setup-helper.js:79:32) at Module._compile (node:internal/modules/cjs/loader:1198:14) at Module.m._compile (/app/node_modules/ts-node/src/index.ts:1459:23) at Module._compile (/app/node_modules/pirates/lib/index.js:136:24) at Module._extensions..js (node:internal/modules/cjs/loader:1252:10) at newLoader (/app/node_modules/pirates/lib/index.js:141:7) at Object.require.extensions.<computed> [as .js] (/app/node_modules/ts-node/src/index.ts:1462:12) at Module.load (node:internal/modules/cjs/loader:1076:32) at Function.Module._load (node:internal/modules/cjs/loader:911:12) at Module.require (node:internal/modules/cjs/loader:1100:19) at require (node:internal/modules/cjs/helpers:108:18) at Object.<anonymous> (/app/test/setup.js:4:1) at Module._compile (node:internal/modules/cjs/loader:1198:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10) at Module.load (node:internal/modules/cjs/loader:1076:32) at Function.Module._load (node:internal/modules/cjs/loader:911:12) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29) at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at async Promise.all (index 0) at ESMLoader.import (node:internal/modules/esm/loader:530:24) at importModuleDynamicallyWrapper (node:internal/vm/module:438:15) at formattedImport (/app/node_modules/mocha/lib/nodejs/esm-utils.js:7:14) at exports.requireOrImport (/app/node_modules/mocha/lib/nodejs/esm-utils.js:48:32) at exports.handleRequires (/app/node_modules/mocha/lib/cli/run-helpers.js:94:28) at /app/node_modules/mocha/lib/cli/run.js:353:25 * update lavamoat policies * update lavamoat build policy
81 lines
2.8 KiB
Diff
81 lines
2.8 KiB
Diff
diff --git a/lib/jsdom/browser/Window.js b/lib/jsdom/browser/Window.js
|
|
index 9b2d75f55050f865382e2f0e8a88f066e0bff2da..d4a635da8eae02eaf0543693356f1252f8b6bac0 100644
|
|
--- a/lib/jsdom/browser/Window.js
|
|
+++ b/lib/jsdom/browser/Window.js
|
|
@@ -24,7 +24,6 @@ const External = require("../living/generated/External");
|
|
const Navigator = require("../living/generated/Navigator");
|
|
const Performance = require("../living/generated/Performance");
|
|
const Screen = require("../living/generated/Screen");
|
|
-const Storage = require("../living/generated/Storage");
|
|
const Selection = require("../living/generated/Selection");
|
|
const reportException = require("../living/helpers/runtime-script-errors");
|
|
const { getCurrentEventHandlerValue } = require("../living/helpers/create-event-accessor.js");
|
|
@@ -285,40 +284,6 @@ function Window(options) {
|
|
this._pretendToBeVisual = options.pretendToBeVisual;
|
|
this._storageQuota = options.storageQuota;
|
|
|
|
- // Some properties (such as localStorage and sessionStorage) share data
|
|
- // between windows in the same origin. This object is intended
|
|
- // to contain such data.
|
|
- if (options.commonForOrigin && options.commonForOrigin[documentOrigin]) {
|
|
- this._commonForOrigin = options.commonForOrigin;
|
|
- } else {
|
|
- this._commonForOrigin = {
|
|
- [documentOrigin]: {
|
|
- localStorageArea: new Map(),
|
|
- sessionStorageArea: new Map(),
|
|
- windowsInSameOrigin: [this]
|
|
- }
|
|
- };
|
|
- }
|
|
-
|
|
- this._currentOriginData = this._commonForOrigin[documentOrigin];
|
|
-
|
|
- // ### WEB STORAGE
|
|
-
|
|
- this._localStorage = Storage.create(window, [], {
|
|
- associatedWindow: this,
|
|
- storageArea: this._currentOriginData.localStorageArea,
|
|
- type: "localStorage",
|
|
- url: this._document.documentURI,
|
|
- storageQuota: this._storageQuota
|
|
- });
|
|
- this._sessionStorage = Storage.create(window, [], {
|
|
- associatedWindow: this,
|
|
- storageArea: this._currentOriginData.sessionStorageArea,
|
|
- type: "sessionStorage",
|
|
- url: this._document.documentURI,
|
|
- storageQuota: this._storageQuota
|
|
- });
|
|
-
|
|
// ### SELECTION
|
|
|
|
// https://w3c.github.io/selection-api/#dfn-selection
|
|
@@ -416,26 +381,6 @@ function Window(options) {
|
|
configurable: true
|
|
});
|
|
},
|
|
- get localStorage() {
|
|
- if (idlUtils.implForWrapper(this._document)._origin === "null") {
|
|
- throw DOMException.create(window, [
|
|
- "localStorage is not available for opaque origins",
|
|
- "SecurityError"
|
|
- ]);
|
|
- }
|
|
-
|
|
- return this._localStorage;
|
|
- },
|
|
- get sessionStorage() {
|
|
- if (idlUtils.implForWrapper(this._document)._origin === "null") {
|
|
- throw DOMException.create(window, [
|
|
- "sessionStorage is not available for opaque origins",
|
|
- "SecurityError"
|
|
- ]);
|
|
- }
|
|
-
|
|
- return this._sessionStorage;
|
|
- },
|
|
get customElements() {
|
|
return customElementRegistry;
|
|
},
|