[webkit-changes] [WebKit/WebKit] f6ae4b: REGRESSION(253223 at main): PDF.js viewer fails to lo...

Michael Catanzaro noreply at github.com
Fri Feb 17 18:02:16 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f6ae4b26c6021a679da8605890edf6faeddeba7f
      https://github.com/WebKit/WebKit/commit/f6ae4b26c6021a679da8605890edf6faeddeba7f
  Author: Michael Catanzaro <mcatanzaro at redhat.com>
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
    M Source/WebCore/Modules/pdfjs-extras/content-script.js

  Log Message:
  -----------
  REGRESSION(253223 at main): PDF.js viewer fails to load PDF: [Error] TypeError: null is not an object (evaluating 'PDFViewerApplication.eventBus.on')
https://bugs.webkit.org/show_bug.cgi?id=251887

Reviewed by Tim Nguyen.

The PDF document is not loading reliably due to a race condition between
our content script and PDF.js. We need to wait until PDF.js has
initialized itself before trying to use it. This solution is based on a
suggestion by Tim Nguyen, which is itself based on the PDF.js
documentation https://github.com/mozilla/pdf.js/wiki/Third-party-viewer-usage#initialization-promise
but modified to avoid waiting on an event that does not seem to actually
happen (possibly it occurs before our content script is injected).

* Source/WebCore/Modules/pdfjs-extras/content-script.js:
(const.PDFJSContentScript.init):

Canonical link: https://commits.webkit.org/260485@main




More information about the webkit-changes mailing list