Commit 1aa16c70 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[piexwasm] Use globalThis instead of assuming it is |window|

The global object could be window, self or global, depending on the JS
environment piex-wasm runs in (Web Page, Web Worker, NodeJS, etc). The
|globalThis| object points to the global object in all cases.

No change in behavior (for files app), no new tests.

Bug: 1132695
Change-Id: I8c6f3d21de29bce63f88352fbe89364d8a76c6bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434077Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811160}
parent bcb3c1e9
...@@ -20,10 +20,10 @@ console.log('[PiexLoader] loaded'); ...@@ -20,10 +20,10 @@ console.log('[PiexLoader] loaded');
let PiexWasmModule; let PiexWasmModule;
/** /**
* |window| var Module defined in page <script src='piex/piex.js.wasm'>. * Module defined by 'piex.js.wasm' script.
* @type {!PiexWasmModule} * @type {!PiexWasmModule}
*/ */
const PiexModule = /** @type {!PiexWasmModule} */ (window['Module']) || {}; const PiexModule = /** @type {!PiexWasmModule} */ (globalThis['Module']) || {};
/** /**
* Set true if the Module.onAbort() handler is called. * Set true if the Module.onAbort() handler is called.
...@@ -162,7 +162,7 @@ function readSourceData(source) { ...@@ -162,7 +162,7 @@ function readSourceData(source) {
} }
const url = /** @type {string} */ (source); const url = /** @type {string} */ (source);
window.webkitResolveLocalFileSystemURL(url, readEntry, failure); globalThis.webkitResolveLocalFileSystemURL(url, readEntry, failure);
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment