Restore window.alert after use in scripting test (#12987)

This commit is contained in:
calixteman 2021-02-12 05:19:58 -08:00 committed by GitHub
parent fc925827b2
commit a8021208ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,7 @@ 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;
let sandbox, send_queue, test_id, ref, windowAlert;
function getId() {
const id = `${ref++}R`;
@ -48,6 +48,7 @@ describe("Scripting", function () {
send_queue.set(event.detail.id, event.detail);
}
};
windowAlert = window.alert;
window.alert = value => {
const command = "alert";
send_queue.set(command, { command, value });
@ -76,6 +77,7 @@ describe("Scripting", function () {
sandbox.nukeSandbox();
sandbox = null;
send_queue = null;
window.alert = windowAlert;
});
describe("Sandbox", function () {