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

In order to simplify m-c code, move some in pdf.js

* move set/clear|Timeout/Interval and crackURL code in pdf.js
 * remove the "backdoor" in the proxy (used to dispatch event) and so return the dispatch function in the initializer
 * remove listeners if an error occured during sandbox initialization
 * add support for alert and prompt in the sandbox
 * add a function to eval in the global scope
This commit is contained in:
Calixte Denizet 2020-12-04 00:39:50 +01:00
parent 3447f7c703
commit 8bff4f1ea9
14 changed files with 472 additions and 265 deletions

View file

@ -48,6 +48,10 @@ describe("Scripting", function () {
send_queue.set(event.detail.id, event.detail);
}
};
window.alert = value => {
const command = "alert";
send_queue.set(command, { command, value });
};
const promise = loadScript(sandboxBundleSrc).then(() => {
return window.pdfjsSandbox.QuickJSSandbox();
});
@ -104,7 +108,6 @@ describe("Scripting", function () {
},
calculationOrder: [],
appInfo: { language: "en-US", platform: "Linux x86_64" },
dispatchEventName: "_dispatchMe",
};
sandbox.createSandbox(data);
sandbox
@ -132,7 +135,6 @@ describe("Scripting", function () {
appInfo: { language: "en-US", platform: "Linux x86_64" },
objects: {},
calculationOrder: [],
dispatchEventName: "_dispatchMe",
});
done();
});
@ -263,7 +265,6 @@ describe("Scripting", function () {
},
appInfo: { language: "en-US", platform: "Linux x86_64" },
calculationOrder: [],
dispatchEventName: "_dispatchMe",
};
sandbox.createSandbox(data);
sandbox
@ -301,7 +302,6 @@ describe("Scripting", function () {
},
appInfo: { language: "en-US", platform: "Linux x86_64" },
calculationOrder: [],
dispatchEventName: "_dispatchMe",
};
sandbox.createSandbox(data);
sandbox
@ -343,7 +343,6 @@ describe("Scripting", function () {
},
appInfo: { language: "en-US", platform: "Linux x86_64" },
calculationOrder: [],
dispatchEventName: "_dispatchMe",
};
sandbox.createSandbox(data);
sandbox
@ -384,7 +383,6 @@ describe("Scripting", function () {
},
appInfo: { language: "en-US", platform: "Linux x86_64" },
calculationOrder: [],
dispatchEventName: "_dispatchMe",
};
sandbox.createSandbox(data);
sandbox
@ -429,7 +427,6 @@ describe("Scripting", function () {
},
appInfo: { language: "en-US", platform: "Linux x86_64" },
calculationOrder: [refId2],
dispatchEventName: "_dispatchMe",
};
sandbox.createSandbox(data);
sandbox
@ -458,7 +455,6 @@ describe("Scripting", function () {
appInfo: { language: "en-US", platform: "Linux x86_64" },
objects: {},
calculationOrder: [],
dispatchEventName: "_dispatchMe",
});
done();
});
@ -553,7 +549,6 @@ describe("Scripting", function () {
appInfo: { language: "en-US", platform: "Linux x86_64" },
objects: {},
calculationOrder: [],
dispatchEventName: "_dispatchMe",
});
done();
});