Merge pull request #12321 from Snuffleupagus/BaseViewer-validate-viewer-option
Ensure that the `viewer` property, on `BaseViewer`-instances, is a valid div-element (issue 12320)
This commit is contained in:
commit
3be9c65f04
@ -143,6 +143,17 @@ class BaseViewer {
|
|||||||
|
|
||||||
this.container = options.container;
|
this.container = options.container;
|
||||||
this.viewer = options.viewer || options.container.firstElementChild;
|
this.viewer = options.viewer || options.container.firstElementChild;
|
||||||
|
|
||||||
|
if (
|
||||||
|
(typeof PDFJSDev === "undefined" ||
|
||||||
|
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||||
|
!(
|
||||||
|
this.container instanceof HTMLDivElement &&
|
||||||
|
this.viewer instanceof HTMLDivElement
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
throw new Error("Invalid `container` and/or `viewer` option.");
|
||||||
|
}
|
||||||
this.eventBus = options.eventBus;
|
this.eventBus = options.eventBus;
|
||||||
this.linkService = options.linkService || new SimpleLinkService();
|
this.linkService = options.linkService || new SimpleLinkService();
|
||||||
this.downloadManager = options.downloadManager || null;
|
this.downloadManager = options.downloadManager || null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user