Bug 1584931 - P1. Fix flashblock testcase failures when fission is enabled. r=bytesized,mccr8
authorDimi Lee <dlee@mozilla.com>
Wed, 04 Dec 2019 09:00:21 +0000
changeset 505284 7f7d7683109ab33dafe5f0891892582a1432e8bc
parent 505283 0b459def3e0827d848f1ed2ecf703c6164113575
child 505285 e33d5fb3f370647b0e5acd308d6dd6cd269bf136
push id36881
push userdvarga@mozilla.com
push dateWed, 04 Dec 2019 16:22:31 +0000
treeherdermozilla-central@13fb375eaf14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized, mccr8
bugs1584931
milestone73.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 1584931 - P1. Fix flashblock testcase failures when fission is enabled. r=bytesized,mccr8 Although we decided to disable flashblock when fission is enabled, we still need to update testcases so they can run normally in the fission mode. Differential Revision: https://phabricator.services.mozilla.com/D51098
toolkit/components/url-classifier/tests/browser/classifierTester.js
--- a/toolkit/components/url-classifier/tests/browser/classifierTester.js
+++ b/toolkit/components/url-classifier/tests/browser/classifierTester.js
@@ -334,42 +334,56 @@ var classifierTester = {
 
         await domainLoaded;
         ++depth;
       }
       return tab;
     })();
   },
 
-  getPluginInfo(browser, depth) {
-    return SpecialPowers.spawn(
-      browser,
-      [classifierTester.IFRAME_ID, depth],
-      (iframeId, depth) => {
-        let doc = content.document;
-        let win = content.window;
-        for (let i = 0; i < depth; ++i) {
-          let frame = doc.getElementById(iframeId);
-          doc = frame.contentDocument;
-          win = frame.contentWindow;
-        }
+  async getPluginInfo(browser, depth) {
+    async function fn(frame, iframeId, depth) {
+      return SpecialPowers.spawn(
+        frame,
+        [iframeId, depth, fn.toSource()],
+        async (iframeId, depth, fnSource) => {
+          // eslint-disable-next-line no-eval
+          let fnGetIframePluginInfo = eval(`(() => (${fnSource}))()`);
 
-        let pluginObj = doc.getElementById("testObject");
-        if (!(pluginObj instanceof Ci.nsIObjectLoadingContent)) {
-          throw new Error("Unable to find plugin!");
+          let doc = content.document;
+          let win = content.window;
+          let frame = doc.getElementById(iframeId);
+          if (!frame) {
+            throw new Error("Unable to find iframe!");
+          }
+          if (depth != 0) {
+            return fnGetIframePluginInfo(
+              frame.contentWindow,
+              iframeId,
+              --depth
+            );
+          }
+
+          let pluginObj = doc.getElementById("testObject");
+          if (!(pluginObj instanceof Ci.nsIObjectLoadingContent)) {
+            throw new Error("Unable to find plugin!");
+          }
+
+          return {
+            pluginFallbackType: pluginObj.pluginFallbackType,
+            activated: pluginObj.activated,
+            hasRunningPlugin: pluginObj.hasRunningPlugin,
+            listed: "Shockwave Flash" in win.navigator.plugins,
+            flashClassification: doc.documentFlashClassification,
+          };
         }
-        return {
-          pluginFallbackType: pluginObj.pluginFallbackType,
-          activated: pluginObj.activated,
-          hasRunningPlugin: pluginObj.hasRunningPlugin,
-          listed: "Shockwave Flash" in win.navigator.plugins,
-          flashClassification: doc.documentFlashClassification,
-        };
-      }
-    );
+      );
+    }
+
+    return fn(browser, classifierTester.IFRAME_ID, depth);
   },
 
   checkPluginInfo(pluginInfo, expectedClassification, flashSetting) {
     // We've stopped allowing flash to be always activated, so check
     // existing tests that attempt to do so get treated as using ask-to-activate.
     if (flashSetting == classifierTester.ALWAYS_ACTIVATE_PREF_VALUE) {
       flashSetting = classifierTester.ASK_TO_ACTIVATE_PREF_VALUE;
     }