|
5 | 5 | const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
6 | 6 | const objectKeys = Object.keys;
|
7 | 7 |
|
8 |
| - /* global cloneInto, exportFunction, false */ |
9 |
| - // Tests don't define this variable so fallback to behave like chrome |
10 |
| - const functionToString = Function.prototype.toString; |
11 |
| - |
12 |
| - /** |
13 |
| - * add a fake toString() method to a wrapper function to resemble the original function |
14 |
| - * @param {*} newFn |
15 |
| - * @param {*} origFn |
16 |
| - */ |
17 |
| - function wrapToString (newFn, origFn) { |
18 |
| - if (typeof newFn !== 'function' || typeof origFn !== 'function') { |
19 |
| - return |
20 |
| - } |
21 |
| - newFn.toString = function () { |
22 |
| - if (this === newFn) { |
23 |
| - return functionToString.call(origFn) |
24 |
| - } else { |
25 |
| - return functionToString.call(this) |
26 |
| - } |
27 |
| - }; |
28 |
| - } |
29 |
| - |
30 | 8 | /* global cloneInto, exportFunction, false */
|
31 | 9 | let messageSecret;
|
32 | 10 |
|
|
2103 | 2081 |
|
2104 | 2082 | constructor () {
|
2105 | 2083 | this.globals = {
|
2106 |
| - window, |
2107 |
| - JSONparse: window.JSON.parse, |
2108 |
| - JSONstringify: window.JSON.stringify, |
2109 |
| - Promise: window.Promise, |
2110 |
| - Error: window.Error, |
2111 |
| - String: window.String |
| 2084 | + window: globalThis, |
| 2085 | + globalThis, |
| 2086 | + JSONparse: globalThis.JSON.parse, |
| 2087 | + JSONstringify: globalThis.JSON.stringify, |
| 2088 | + Promise: globalThis.Promise, |
| 2089 | + Error: globalThis.Error, |
| 2090 | + String: globalThis.String |
2112 | 2091 | };
|
2113 | 2092 | }
|
2114 | 2093 |
|
|
2303 | 2282 | return new Messaging(context, match())
|
2304 | 2283 | }
|
2305 | 2284 |
|
| 2285 | + /* global false */ |
| 2286 | + // Tests don't define this variable so fallback to behave like chrome |
| 2287 | + const functionToString = Function.prototype.toString; |
| 2288 | + |
| 2289 | + /** |
| 2290 | + * add a fake toString() method to a wrapper function to resemble the original function |
| 2291 | + * @param {*} newFn |
| 2292 | + * @param {*} origFn |
| 2293 | + */ |
| 2294 | + function wrapToString (newFn, origFn) { |
| 2295 | + if (typeof newFn !== 'function' || typeof origFn !== 'function') { |
| 2296 | + return |
| 2297 | + } |
| 2298 | + newFn.toString = function () { |
| 2299 | + if (this === newFn) { |
| 2300 | + return functionToString.call(origFn) |
| 2301 | + } else { |
| 2302 | + return functionToString.call(this) |
| 2303 | + } |
| 2304 | + }; |
| 2305 | + } |
| 2306 | + |
2306 | 2307 | /* global cloneInto, exportFunction */
|
2307 | 2308 |
|
2308 | 2309 |
|
|
2396 | 2397 | get debugMessaging () {
|
2397 | 2398 | if (this.#debugMessaging) return this.#debugMessaging
|
2398 | 2399 |
|
2399 |
| - if (this.platform?.name === 'extension') { |
| 2400 | + if (this.platform?.name === 'extension' && typeof "apple-isolated" !== 'undefined') { |
2400 | 2401 | this.#debugMessaging = createMessaging({ name: 'debug', isDebug: this.isDebug }, "apple-isolated");
|
2401 | 2402 | return this.#debugMessaging
|
2402 | 2403 | } else {
|
|
0 commit comments