mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 06:08:24 +02:00
By updating the PDF viewer mochitests to instead use the new support for re-dispatching general `EventBus` events to the DOM, as implemented in https://github.com/mozilla/pdf.js/pull/10019, this will allow (future) removal of the hard-coded DOM event dispatching currently present in the https://github.com/mozilla/pdf.js/blob/master/web/dom_events.js file.
20 lines
658 B
JavaScript
20 lines
658 B
JavaScript
async function waitForPdfJS(browser, url) {
|
|
await SpecialPowers.pushPrefEnv({
|
|
set: [
|
|
["pdfjs.eventBusDispatchToDOM", true],
|
|
],
|
|
});
|
|
// Runs tests after all "load" event handlers have fired off
|
|
return ContentTask.spawn(browser, url, async function(contentUrl) {
|
|
await new Promise((resolve) => {
|
|
// NB: Add the listener to the global object so that we receive the
|
|
// event fired from the new window.
|
|
addEventListener("documentloaded", function listener() {
|
|
removeEventListener("documentloaded", listener, false);
|
|
resolve();
|
|
}, false, true);
|
|
|
|
content.location = contentUrl;
|
|
});
|
|
});
|
|
}
|