Bug 1587971 - Fix test_ext_contentscript_cache.html with Fission draft
authorTomislav Jovanovic <tomica@gmail.com>
Sat, 12 Oct 2019 23:47:37 +0000
changeset 2378204 6ce7feb714a7f96326482d59e37c9075d2bc51d9
parent 2378121 7fc0a96a5ca10811216de69f4f54b7a13e3fee28
child 2378205 0a201452cc5e680b676cf3e535ad984c21a62130
push id434589
push userreviewbot
push dateSat, 12 Oct 2019 23:47:52 +0000
treeherdertry@0a201452cc5e [default view] [failures only]
bugs1587971
milestone71.0a1
Bug 1587971 - Fix test_ext_contentscript_cache.html with Fission Reviewers: rpl Tags: #secure-revision Bug #: 1587971 Differential Revision: https://phabricator.services.mozilla.com/D48918 Differential Diff: PHID-DIFF-3fqbigipp3e4ephtv4qi
toolkit/components/extensions/test/mochitest/mochitest-common.ini
toolkit/components/extensions/test/mochitest/test_ext_contentscript_cache.html
--- a/toolkit/components/extensions/test/mochitest/mochitest-common.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini
@@ -68,17 +68,16 @@ skip-if = (toolkit == 'android') # andro
 [test_ext_canvas_resistFingerprinting.html]
 [test_ext_clipboard.html]
 [test_ext_clipboard_image.html]
 skip-if = headless # Bug 1405872
 [test_ext_contentscript_about_blank.html]
 skip-if = os == 'android' # bug 1369440
 [test_ext_contentscript_cache.html]
 skip-if = (os == 'linux' && debug) || (toolkit == 'android' && debug) # bug 1348241
-fail-if = fission
 [test_ext_contentscript_canvas.html]
 skip-if =
   (verify && debug && (os == 'linux')) ||
   (fission && debug) # Fails intermittently under Fission.
 [test_ext_contentscript_devtools_metadata.html]
 [test_ext_contentscript_incognito.html]
 skip-if = os == 'android' # Android does not support multiple windows.
 [test_ext_contentscript_permission.html]
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_cache.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_contentscript_cache.html
@@ -10,21 +10,23 @@
 <body>
 
 <script type="text/javascript">
 "use strict";
 
 // This file defines content scripts.
 /* eslint-env mozilla/frame-script */
 
+const BASE = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest";
+
 add_task(async function test_contentscript_cache() {
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       content_scripts: [{
-        "matches": ["http://example.com/"],
+        "matches": ["http://mochi.test/*/file_sample.html"],
         "js": ["content_script.js"],
         "run_at": "document_start",
       }],
 
       permissions: ["<all_urls>", "tabs"],
     },
 
     async background() {
@@ -47,17 +49,17 @@ add_task(async function test_contentscri
   let scriptUrl = `${origin}/content_script.js`;
 
   let {ExtensionManager} = SpecialPowers.Cu.import("resource://gre/modules/ExtensionChild.jsm", {});
   let ext = ExtensionManager.extensions.get(extension.id);
 
   ext.staticScripts.expiryTimeout = 3000;
   is(ext.staticScripts.size, 0, "Should have no cached scripts");
 
-  let win = window.open("http://example.com/");
+  let win = window.open(`${BASE}/file_sample.html`);
   await extension.awaitMessage("content-script-loaded");
 
   if (AppConstants.platform !== "android") {
     is(ext.staticScripts.size, 1, "Should have one cached script");
     ok(ext.staticScripts.has(scriptUrl), "Script cache should contain script URL");
   }
 
   let chromeScript, chromeScriptDone;
@@ -86,18 +88,17 @@ add_task(async function test_contentscri
 
   if (chromeScript) {
     await chromeScriptDone;
     chromeScript.destroy();
   }
 
   win.close();
 
-
-  win = window.open("http://example.com/");
+  win = window.open(`${BASE}/file_sample.html`);
   await extension.awaitMessage("content-script-loaded");
 
   is(ext.staticScripts.size, 1, "Should have one cached script");
   ok(ext.staticScripts.has(scriptUrl));
 
   SpecialPowers.Services.obs.notifyObservers(null, "memory-pressure", "heap-minimize");
 
   is(ext.staticScripts.size, 0, "Should have no cached scripts after heap-minimize");