1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Actually utilize the PDF.js build-system fully when bundling the pdf.sandbox.js file

There's no good reason, as far as I can tell, to use search-and-replace to include the *stringified* `pdf.scripting.js` file in the built `pdf.sandbox.js` file. Instead we could, and even should, utilize the existing `PDFJSDev.eval(...)`-functionality, which is not only simpler but will also be more efficient as well (no need for a regular expression).
This commit is contained in:
Jonas Jenwald 2020-12-04 13:03:24 +01:00
parent 715b8aa389
commit d742e3cde8
2 changed files with 12 additions and 26 deletions

View file

@ -48,7 +48,7 @@ class Sandbox {
"module = Object.create(null);",
// Next line is replaced by code from initialization.js
// when we create the bundle for the sandbox.
"/* INITIALIZATION_CODE */",
PDFJSDev.eval("PDF_SCRIPTING_JS_SOURCE"),
`data = ${sandboxData};`,
`module.exports.initSandbox({ data, extra: {${extraStr}}, out: this});`,
"delete exports;",