ESMify some modules for m-c (bug 1824610)

This commit is contained in:
Calixte Denizet 2023-03-27 11:40:58 +02:00
parent 384bd96165
commit 5f5256b4c4
3 changed files with 12 additions and 20 deletions

View File

@ -13,10 +13,6 @@
* limitations under the License.
*/
"use strict";
var EXPORTED_SYMBOLS = ["PdfJsDefaultPreferences"];
var PdfJsDefaultPreferences = Object.freeze(
export const PdfJsDefaultPreferences = Object.freeze(
PDFJSDev.eval("DEFAULT_PREFERENCES")
);

View File

@ -434,12 +434,15 @@ function createSandboxExternal(defines) {
saveComments: false,
defines,
};
return gulp.src("./src/pdf.sandbox.external.js").pipe(
transform("utf8", content => {
content = preprocessor2.preprocessPDFJSCode(ctx, content);
return `${licenseHeader}\n${content}`;
})
);
return gulp
.src("./src/pdf.sandbox.external.js")
.pipe(rename("pdf.sandbox.external.sys.mjs"))
.pipe(
transform("utf8", content => {
content = preprocessor2.preprocessPDFJSCode(ctx, content);
return `${licenseHeader}\n${content}`;
})
);
}
function createTemporaryScriptingBundle(defines, extraOptions = undefined) {
@ -1381,7 +1384,7 @@ gulp.task(
.pipe(gulp.dest(MOZCENTRAL_L10N_DIR)),
gulp.src("LICENSE").pipe(gulp.dest(MOZCENTRAL_EXTENSION_DIR)),
gulp
.src(FIREFOX_CONTENT_DIR + "PdfJsDefaultPreferences.jsm")
.src(FIREFOX_CONTENT_DIR + "PdfJsDefaultPreferences.sys.mjs")
.pipe(transform("utf8", preprocessDefaultPreferences))
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR)),
]);

View File

@ -16,7 +16,7 @@
// In mozilla-central, this file is loaded as non-module script,
// so it mustn't have any dependencies.
class SandboxSupportBase {
export class SandboxSupportBase {
/**
* @param {DOMWindow} - win
*/
@ -181,10 +181,3 @@ class SandboxSupportBase {
};
}
}
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
exports.SandboxSupportBase = SandboxSupportBase;
} else {
/* eslint-disable-next-line no-unused-vars, no-var */
var EXPORTED_SYMBOLS = ["SandboxSupportBase"];
}