1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

Replace the testMode parameter in src/pdf.sandbox.js with a constant, set using the pre-processor

This simplifies not just this code, but the unit-tests as well, and should be sufficient as far as I can tell.
Note also that currently, in the *built* `pdf.sandbox.js` file, there's even a line reading `testMode = testMode && false;` because of an accidentally flipped pre-processor statement.

Finally, in the `scripting_spec.js` unit-test, defines `sandboxBundleSrc` at the top of the file to make it easier to find and/or change it when necessary.
This commit is contained in:
Jonas Jenwald 2020-12-05 16:35:49 +01:00
parent c39f1aedb2
commit c549069ebd
2 changed files with 13 additions and 15 deletions

View file

@ -15,6 +15,8 @@
import { loadScript } from "../../src/display/display_utils.js";
const sandboxBundleSrc = "../../build/generic/build/pdf.sandbox.js";
describe("Scripting", function () {
let sandbox, send_queue, test_id, ref;
@ -44,11 +46,9 @@ describe("Scripting", function () {
send_queue.set(event.detail.id, event.detail);
}
};
const promise = loadScript("../../build/generic/build/pdf.sandbox.js").then(
() => {
return window.pdfjsSandbox.QuickJSSandbox(true);
}
);
const promise = loadScript(sandboxBundleSrc).then(() => {
return window.pdfjsSandbox.QuickJSSandbox();
});
sandbox = {
createSandbox(data) {
promise.then(sbx => sbx.create(data));