Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESMify some modules for m-c (bug 1824610) #16217

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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")
);
17 changes: 10 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)),
]);
Expand Down
9 changes: 1 addition & 8 deletions src/pdf.sandbox.external.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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"];
}