Bug 1592027 - Make browser/extensions/pdfjs/test/ Fission-compatible, r=bdahl
authorKashav Madan <kmadan@mozilla.com>
Fri, 08 Nov 2019 16:35:39 +0000
changeset 501347 5bc477e6c6179d34331241e3f1b9040a69d9656e
parent 501346 254ec8dbbb9669a9600abf1d29aa6307453b55f6
child 501348 f1c1e5f12327eee77905e9b6456e667d548b6c0e
push id114168
push userdluca@mozilla.com
push dateSun, 10 Nov 2019 03:08:55 +0000
treeherdermozilla-inbound@33f64c1ef3e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbdahl
bugs1592027
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1592027 - Make browser/extensions/pdfjs/test/ Fission-compatible, r=bdahl Differential Revision: https://phabricator.services.mozilla.com/D52373
browser/extensions/pdfjs/test/browser.ini
browser/extensions/pdfjs/test/head.js
--- a/browser/extensions/pdfjs/test/browser.ini
+++ b/browser/extensions/pdfjs/test/browser.ini
@@ -1,15 +1,12 @@
 [DEFAULT]
 support-files =
   file_pdfjs_test.pdf
   head.js
 
 [browser_pdfjs_main.js]
-skip-if = fission
 [browser_pdfjs_navigation.js]
-skip-if = fission
 [browser_pdfjs_savedialog.js]
 skip-if = verify
 [browser_pdfjs_views.js]
-skip-if = fission
 [browser_pdfjs_zoom.js]
-skip-if = fission || (verify && debug && (os == 'win'))
+skip-if = verify && debug && (os == 'win')
--- a/browser/extensions/pdfjs/test/head.js
+++ b/browser/extensions/pdfjs/test/head.js
@@ -1,23 +1,17 @@
 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;
-    });
+  let loadPromise = BrowserTestUtils.waitForContentEvent(
+    browser,
+    "documentloaded",
+    false,
+    null,
+    true
+  );
+  await SpecialPowers.spawn(browser, [url], contentUrl => {
+    content.location = contentUrl;
   });
+  return loadPromise;
 }