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

[api-major] Change getJavaScript to return null, rather than an empty Array, when no JavaScript exists

Other API methods already return `null`, rather than empty Arrays/Objects, hence it makes sense to change `getJavaScript` to be consistent.
This commit is contained in:
Jonas Jenwald 2017-10-15 22:13:58 +02:00
parent 4fdb0f57d7
commit 1cd1582cb9
4 changed files with 16 additions and 8 deletions

View file

@ -1037,10 +1037,12 @@ let PDFViewerApplication = {
return;
}
pdfDocument.getJavaScript().then((javaScript) => {
if (javaScript.length) {
console.warn('Warning: JavaScript is not supported');
this.fallback(UNSUPPORTED_FEATURES.javaScript);
if (!javaScript) {
return;
}
console.warn('Warning: JavaScript is not supported');
this.fallback(UNSUPPORTED_FEATURES.javaScript);
// Hack to support auto printing.
let regex = /\bprint\s*\(/;
for (let i = 0, ii = javaScript.length; i < ii; i++) {