-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api-minor] Remove the getGlobalEventBus
viewer functionality, and the eventBusDispatchToDOM
option/preference (PR 11631 follow-up)
#11655
[api-minor] Remove the getGlobalEventBus
viewer functionality, and the eventBusDispatchToDOM
option/preference (PR 11631 follow-up)
#11655
Conversation
16597fe
to
84b3903
Compare
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/37b2c40e3b80499/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/883b2a08c119dd4/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/883b2a08c119dd4/output.txt Total script time: 2.65 mins
|
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/37b2c40e3b80499/output.txt Total script time: 4.68 mins
|
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/f14ebe61632868d/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/9c391ac7aa98334/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/9c391ac7aa98334/output.txt Total script time: 2.70 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/f14ebe61632868d/output.txt Total script time: 4.60 mins
|
84b3903
to
ceda04e
Compare
ceda04e
to
2dfbb71
Compare
…Viewer. r=bdahl As part of the work to clean-up the event dispatching in the PDF Viewer, particularily re-dispatching of internal `EventBus` events to the DOM, this patch is necessary to unblock the upstream work that's currently pending in [PR 11655](mozilla/pdf.js#11655). Finally, the patch also removes the `ChromeActions.supportsDocumentColors` method given that it's been unused since [bug 1611175](https://bugzilla.mozilla.org/show_bug.cgi?id=1611175) and [PR 11521](mozilla/pdf.js#11521). Differential Revision: https://phabricator.services.mozilla.com/D68533
…Viewer. r=bdahl As part of the work to clean-up the event dispatching in the PDF Viewer, particularily re-dispatching of internal `EventBus` events to the DOM, this patch is necessary to unblock the upstream work that's currently pending in [PR 11655](mozilla/pdf.js#11655). Finally, the patch also removes the `ChromeActions.supportsDocumentColors` method given that it's been unused since [bug 1611175](https://bugzilla.mozilla.org/show_bug.cgi?id=1611175) and [PR 11521](mozilla/pdf.js#11521). Differential Revision: https://phabricator.services.mozilla.com/D68533 --HG-- extra : moz-landing-system : lando
With the necessary |
/botio unittest |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/58523c4b812b501/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/7e794cb40ea3d4a/output.txt |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/7e794cb40ea3d4a/output.txt Total script time: 2.08 mins
|
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/58523c4b812b501/output.txt Total script time: 2.73 mins
|
…1631 follow-up) The correct/intended way of working with the "viewer components" is by providing an `EventBus` instance upon initialization, and the `getGlobalEventBus` was only added for backwards compatibility. Note, for example, that using `getGlobalEventBus` doesn't really work at all well with a use-case where there's *multiple* `PDFViewer` instances on a one page, since it may then be difficult/impossible to tell which viewer a particular event originated from. All of the "viewer components" examples have been previously updated, such that there's no longer any code/examples which relies on the now removed `getGlobalEventBus` functionality.
… thus the general ability to dispatch "viewer components" events to the DOM This functionality was only added to the default viewer for backwards compatibility and to support the various PDF viewer tests in mozilla-central, with the intention to eventually remove it completely. While the different mozilla-central tests cannot be *easily* converted from DOM events, it's however possible to limit that functionality to only MOZCENTRAL builds *and* when tests are running. Rather than depending of the re-dispatching of internal events to the DOM, the default viewer can instead be used in e.g. the following way: ```javascript document.addEventListener("webviewerloaded", function() { PDFViewerApplication.initializedPromise.then(function() { // The viewer has now been initialized, and its properties can be accessed. PDFViewerApplication.eventBus.on("pagerendered", function(event) { console.log("Has rendered page number: " + event.pageNumber); }); }); }); ```
2dfbb71
to
664b79a
Compare
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/8c0ef502ac37788/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/8c0ef502ac37788/output.txt Total script time: 2.40 mins Published |
Nice work! |
…Viewer. r=bdahl As part of the work to clean-up the event dispatching in the PDF Viewer, particularily re-dispatching of internal `EventBus` events to the DOM, this patch is necessary to unblock the upstream work that's currently pending in [PR 11655](mozilla/pdf.js#11655). Finally, the patch also removes the `ChromeActions.supportsDocumentColors` method given that it's been unused since [bug 1611175](https://bugzilla.mozilla.org/show_bug.cgi?id=1611175) and [PR 11521](mozilla/pdf.js#11521). Differential Revision: https://phabricator.services.mozilla.com/D68533 UltraBlame original commit: 535dc6cf908145933612e554ca3680013a154757
…Viewer. r=bdahl As part of the work to clean-up the event dispatching in the PDF Viewer, particularily re-dispatching of internal `EventBus` events to the DOM, this patch is necessary to unblock the upstream work that's currently pending in [PR 11655](mozilla/pdf.js#11655). Finally, the patch also removes the `ChromeActions.supportsDocumentColors` method given that it's been unused since [bug 1611175](https://bugzilla.mozilla.org/show_bug.cgi?id=1611175) and [PR 11521](mozilla/pdf.js#11521). Differential Revision: https://phabricator.services.mozilla.com/D68533 UltraBlame original commit: 535dc6cf908145933612e554ca3680013a154757
…Viewer. r=bdahl As part of the work to clean-up the event dispatching in the PDF Viewer, particularily re-dispatching of internal `EventBus` events to the DOM, this patch is necessary to unblock the upstream work that's currently pending in [PR 11655](mozilla/pdf.js#11655). Finally, the patch also removes the `ChromeActions.supportsDocumentColors` method given that it's been unused since [bug 1611175](https://bugzilla.mozilla.org/show_bug.cgi?id=1611175) and [PR 11521](mozilla/pdf.js#11521). Differential Revision: https://phabricator.services.mozilla.com/D68533 UltraBlame original commit: 535dc6cf908145933612e554ca3680013a154757
Since [1] PDF.js does not dispatch events to the DOM any more. Therefore the client needs to listen for the `documentloaded` event from `PDFApplicationViewer.eventBus`. The `eventBus` property is only available once the viewer is initialized, so the client needs to wait for `initializedPromise` to resolve before checking it. [1] mozilla/pdf.js#11655
Since [1] PDF.js does not dispatch events to the DOM any more. Therefore the client needs to listen for the `documentloaded` event from `PDFApplicationViewer.eventBus`. The `eventBus` property is only available once the viewer is initialized, so the client needs to wait for `initializedPromise` to resolve before checking it. [1] mozilla/pdf.js#11655
Since [1] PDF.js does not dispatch events to the DOM any more. Therefore the client needs to listen for the `documentloaded` event from `PDFApplicationViewer.eventBus`. The `eventBus` property is only available once the viewer is initialized, so the client needs to wait for `initializedPromise` to resolve before checking it. [1] mozilla/pdf.js#11655
…om various tests. r=pdfjs-reviewers,perftest-reviewers,marco,sparky This preference was removed over three years ago, please see the upstream patch in mozilla/pdf.js#11655 Differential Revision: https://phabricator.services.mozilla.com/D183153
…om various tests. r=pdfjs-reviewers,perftest-reviewers,marco,sparky This preference was removed over three years ago, please see the upstream patch in mozilla/pdf.js#11655 Differential Revision: https://phabricator.services.mozilla.com/D183153
…om various tests. r=pdfjs-reviewers,perftest-reviewers,marco,sparky This preference was removed over three years ago, please see the upstream patch in mozilla/pdf.js#11655 Differential Revision: https://phabricator.services.mozilla.com/D183153 UltraBlame original commit: 96f24646390be39f604f0815e8fdc2560d4608be
…om various tests. r=pdfjs-reviewers,perftest-reviewers,marco,sparky This preference was removed over three years ago, please see the upstream patch in mozilla/pdf.js#11655 Differential Revision: https://phabricator.services.mozilla.com/D183153 UltraBlame original commit: 96f24646390be39f604f0815e8fdc2560d4608be
…om various tests. r=pdfjs-reviewers,perftest-reviewers,marco,sparky This preference was removed over three years ago, please see the upstream patch in mozilla/pdf.js#11655 Differential Revision: https://phabricator.services.mozilla.com/D183153 UltraBlame original commit: 96f24646390be39f604f0815e8fdc2560d4608be
[api-minor] Remove the
getGlobalEventBus
viewer functionality (PR 11631 follow-up)The correct/intended way of working with the "viewer components" is by providing an
EventBus
instance upon initialization, and thegetGlobalEventBus
was only added for backwards compatibility.Note, for example, that using
getGlobalEventBus
doesn't really work at all well with a use-case where there's multiplePDFViewer
instances on a one page, since it may then be difficult/impossible to tell which viewer a particular event originated from.All of the "viewer components" examples have been previously updated, such that there's no longer any code/examples which relies on the now removed
getGlobalEventBus
functionality.[api-minor] Remove the
eventBusDispatchToDOM
option/preference, and thus the general ability to dispatch "viewer components" events to the DOMThis functionality was only added to the default viewer for backwards compatibility and to support the various PDF viewer tests in mozilla-central, with the intention to eventually remove it completely.
While the different mozilla-central tests cannot be easily converted from DOM events, it's however possible to limit that functionality to only MOZCENTRAL builds and when tests are running.
Rather than depending of the re-dispatching of internal events to the DOM, the default viewer can instead be used in e.g. the following way: