[Webkit-unassigned] [Bug 251887] REGRESSION(253223 at main): PDF.js viewer fails to load PDF: [Error] TypeError: null is not an object (evaluating 'PDFViewerApplication.eventBus.on')

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 17 08:07:04 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=251887

--- Comment #11 from Michael Catanzaro <mcatanzaro at gnome.org> ---
(In reply to Michael Catanzaro from comment #10)
> We need to delay the entire init() function.

Well, actually window.addEventListener() really does need to be connected to immediately. So I came up with this:

    init() {
        let id = setInterval(() => {
            if (PDFViewerApplication.initialized) {
                this.overrideSettings();
                PDFViewerApplication.eventBus.on("pagesinit", () => {
                    this.autoResize();
                });
                clearInterval(id);
            }
        }, 200);

That seems to work properly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230217/294b4ef8/attachment.htm>


More information about the webkit-unassigned mailing list