fune/browser/extensions/pdfjs/test/head.js
Victor Porof 2995d5960c Bug 1561435 - Format browser/extensions/, a=automatic-formatting
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D36045

--HG--
extra : source : 0d17c165e0453b1e05ee73771f7a6e18af093578
2019-07-05 09:54:47 +02:00

23 lines
689 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;
});
});
}