@ms-cloudpack/esm-stub-utilities 0.6.5 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,13 +25,13 @@ require('regenerator-runtime');
|
|
|
25
25
|
|
|
26
26
|
// Ensure assigning to and reading from `window.foo` globals works as expected by copying all the
|
|
27
27
|
// properties from the jsdom `window` to node's `global`, then assigning `global` to `window`.
|
|
28
|
-
Object.
|
|
28
|
+
Object.entries(Object.getOwnPropertyDescriptors(window)).forEach(([k, desc]) => {
|
|
29
29
|
// Skip storage to avoid errors "localStorage is not available for opaque origins"
|
|
30
30
|
// (these errors could in theory be resolved by passing a URL to jsdom-global setup, but that
|
|
31
31
|
// triggers some weird issues with whatwg-url using TextDecoder in a way that works in other
|
|
32
32
|
// environments but throws in the sandbox)
|
|
33
33
|
if (!(k in global) && !['localStorage', 'sessionStorage'].includes(k)) {
|
|
34
|
-
|
|
34
|
+
Object.defineProperty(global, k, desc);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
/** @type {*} */ (global).window = global;
|