From 9418ed19e7dcd799a5bec12a0c7328a98f291bb5 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 2 Feb 2024 12:00:06 +0100 Subject: [PATCH] [api-minor] Remove the, now unused, `pdfjsLibPromise` global This global was only introduced to work-around problems caused by the GENERIC PDF.js build using top level await. Since that was removed in the previous commit, this global is now dead code. --- gulpfile.mjs | 10 ++-------- web/pdfjs.js | 9 --------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/gulpfile.mjs b/gulpfile.mjs index 4f3af9d64..55629e6d2 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -445,10 +445,8 @@ function checkChromePreferencesFile(chromePrefsPath, webPrefs) { function tweakWebpackOutput(jsName) { const replacer = [ - " __webpack_exports__ = {};", - ",__webpack_exports__={};", - " __webpack_exports__ = await __webpack_exports__;", - "\\(__webpack_exports__=await __webpack_exports__\\)", + " __webpack_exports__ = {};", // Normal builds. + ",__webpack_exports__={};", // Minified builds. ]; const regex = new RegExp(`(${replacer.join("|")})`, "gm"); @@ -458,10 +456,6 @@ function tweakWebpackOutput(jsName) { return ` __webpack_exports__ = globalThis.${jsName} = {};`; case ",__webpack_exports__={};": return `,__webpack_exports__=globalThis.${jsName}={};`; - case " __webpack_exports__ = await __webpack_exports__;": - return ` __webpack_exports__ = globalThis.${jsName} = await (globalThis.${jsName}Promise = __webpack_exports__);`; - case "(__webpack_exports__=await __webpack_exports__)": - return `(__webpack_exports__=globalThis.${jsName}=await (globalThis.${jsName}Promise=__webpack_exports__))`; } return match; }); diff --git a/web/pdfjs.js b/web/pdfjs.js index 670df4e07..4db23cc05 100644 --- a/web/pdfjs.js +++ b/web/pdfjs.js @@ -13,15 +13,6 @@ * limitations under the License. */ -// Ensure that the viewer waits for the library to complete loading, -// to avoid breaking e.g. the standalone viewer components (see issue 17228). -if ( - (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && - !globalThis.pdfjsLib -) { - await globalThis.pdfjsLibPromise; -} - const { AbortException, AnnotationEditorLayer,