Merge pull request #14572 from Snuffleupagus/_collectJS-string-check
Add a missing string-check in the `_collectJS` helper function
This commit is contained in:
commit
ff6d9c74cc
@ -22,7 +22,8 @@ import {
|
|||||||
stringToPDFString,
|
stringToPDFString,
|
||||||
warn,
|
warn,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { Dict, isName, isRef, isStream, RefSet } from "./primitives.js";
|
import { Dict, isName, isRef, RefSet } from "./primitives.js";
|
||||||
|
import { BaseStream } from "./base_stream.js";
|
||||||
|
|
||||||
function getLookupTableFactory(initializer) {
|
function getLookupTableFactory(initializer) {
|
||||||
let lookup;
|
let lookup;
|
||||||
@ -329,15 +330,15 @@ function _collectJS(entry, xref, list, parents) {
|
|||||||
_collectJS(element, xref, list, parents);
|
_collectJS(element, xref, list, parents);
|
||||||
}
|
}
|
||||||
} else if (entry instanceof Dict) {
|
} else if (entry instanceof Dict) {
|
||||||
if (isName(entry.get("S"), "JavaScript") && entry.has("JS")) {
|
if (isName(entry.get("S"), "JavaScript")) {
|
||||||
const js = entry.get("JS");
|
const js = entry.get("JS");
|
||||||
let code;
|
let code;
|
||||||
if (isStream(js)) {
|
if (js instanceof BaseStream) {
|
||||||
code = js.getString();
|
code = js.getString();
|
||||||
} else {
|
} else if (typeof js === "string") {
|
||||||
code = js;
|
code = js;
|
||||||
}
|
}
|
||||||
code = stringToPDFString(code);
|
code = code && stringToPDFString(code);
|
||||||
if (code) {
|
if (code) {
|
||||||
list.push(code);
|
list.push(code);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user