Backed out changeset fca556472346 (bug 1288885)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 28 Jul 2016 10:06:34 +0200
changeset 347044 6254ca38371816e02e356e5a3a2067c4e1af3128
parent 347043 0391561d533b6131fddacb3939208f85f1b966e0
child 347045 68f0efbb38b4f0462f1229f65440f126bea6c5b9
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1288885
milestone50.0a1
backs outfca55647234643b6fde3b62b3337e491432ab0dc
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
Backed out changeset fca556472346 (bug 1288885)
toolkit/components/extensions/test/mochitest/mochitest.ini
toolkit/components/extensions/test/mochitest/test_ext_background_generated_load_events.html
toolkit/components/extensions/test/mochitest/test_ext_background_generated_reload.html
toolkit/components/extensions/test/mochitest/test_ext_background_sub_windows.html
toolkit/components/extensions/test/mochitest/test_ext_background_window_properties.html
toolkit/components/extensions/test/xpcshell/test_ext_background_generated_load_events.js
toolkit/components/extensions/test/xpcshell/test_ext_background_generated_reload.js
toolkit/components/extensions/test/xpcshell/test_ext_background_sub_windows.js
toolkit/components/extensions/test/xpcshell/test_ext_background_window_properties.js
toolkit/components/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/components/extensions/test/mochitest/mochitest.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest.ini
@@ -66,18 +66,22 @@ skip-if = (os == 'android' || buildapp =
 [test_ext_sendmessage_reply2.html]
 skip-if = (os == 'android' || buildapp == 'b2g') # sender.tab is undefined on b2g. Bug 1258975 on android.
 [test_ext_sendmessage_doublereply.html]
 skip-if = (os == 'android' || buildapp == 'b2g') # sender.tab is undefined on b2g. Bug 1258975 on android.
 [test_ext_storage_content.html]
 [test_ext_storage_tab.html]
 skip-if = os == 'android' # Android does not currently support tabs.
 [test_ext_cookies.html]
+[test_ext_background_window_properties.html]
+[test_ext_background_sub_windows.html]
 [test_ext_background_api_injection.html]
 [test_ext_background_generated_url.html]
+[test_ext_background_generated_reload.html]
+[test_ext_background_generated_load_events.html]
 [test_ext_i18n.html]
 skip-if = (os == 'android') # Bug 1258975 on android.
 [test_ext_web_accessible_resources.html]
 skip-if = (os == 'android') # Bug 1258975 on android.
 [test_ext_webrequest.html]
 skip-if = (os == 'android' || buildapp == 'b2g') # webrequest api uninplemented (bug 1199504). Bug 1258975 on android.
 [test_ext_webnavigation.html]
 skip-if = (os == 'android' || buildapp == 'b2g') # needs TabManager which is not yet implemented. Bug 1258975 on android.
rename from toolkit/components/extensions/test/xpcshell/test_ext_background_generated_load_events.js
rename to toolkit/components/extensions/test/mochitest/test_ext_background_generated_load_events.html
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_generated_load_events.js
+++ b/toolkit/components/extensions/test/mochitest/test_ext_background_generated_load_events.html
@@ -1,23 +1,47 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test load events in _generated_background_page.html</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+  <script type="text/javascript" src="head.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+
+<script>
 "use strict";
 
 /* eslint-disable mozilla/balanced-listeners */
 
 add_task(function* test_DOMContentLoaded_in_generated_background_page() {
+  function backgroundScript() {
+    function reportListener(event) {
+      browser.test.sendMessage("eventname", event.type);
+    }
+    document.addEventListener("DOMContentLoaded", reportListener);
+    window.addEventListener("load", reportListener);
+  }
   let extension = ExtensionTestUtils.loadExtension({
-    background() {
-      function reportListener(event) {
-        browser.test.sendMessage("eventname", event.type);
-      }
-      document.addEventListener("DOMContentLoaded", reportListener);
-      window.addEventListener("load", reportListener);
+    manifest: {
+      background: {
+        scripts: ["bg.js"],
+      },
+      web_accessible_resources: ["_generated_background_page.html"],
+    },
+    files: {
+      "bg.js": `(${backgroundScript})();`,
     },
   });
 
   yield extension.startup();
-  equal("DOMContentLoaded", yield extension.awaitMessage("eventname"));
-  equal("load", yield extension.awaitMessage("eventname"));
+  is("DOMContentLoaded", yield extension.awaitMessage("eventname"));
+  is("load", yield extension.awaitMessage("eventname"));
 
   yield extension.unload();
 });
+
+</script>
+</body>
+</html>
rename from toolkit/components/extensions/test/xpcshell/test_ext_background_generated_reload.js
rename to toolkit/components/extensions/test/mochitest/test_ext_background_generated_reload.html
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_generated_reload.js
+++ b/toolkit/components/extensions/test/mochitest/test_ext_background_generated_reload.html
@@ -1,24 +1,50 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test reload of _generated_background_page.html</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+  <script type="text/javascript" src="head.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+
+<script>
 "use strict";
 
 add_task(function* test_reload_generated_background_page() {
+  function backgroundScript() {
+    if (location.hash !== "#firstrun") {
+      browser.test.sendMessage("first run");
+      location.hash = "#firstrun";
+      browser.test.assertEq("#firstrun", location.hash);
+      location.reload();
+    } else {
+      browser.test.notifyPass("second run");
+    }
+  }
   let extension = ExtensionTestUtils.loadExtension({
-    background() {
-      if (location.hash !== "#firstrun") {
-        browser.test.sendMessage("first run");
-        location.hash = "#firstrun";
-        browser.test.assertEq("#firstrun", location.hash);
-        location.reload();
-      } else {
-        browser.test.notifyPass("second run");
-      }
+    manifest: {
+      background: {
+        scripts: ["bg.js"],
+      },
+    },
+    files: {
+      "bg.js": `(${backgroundScript})();`,
     },
   });
 
   yield extension.startup();
+  info("Waiting for first message");
   yield extension.awaitMessage("first run");
+  info("Waiting for second message");
   yield extension.awaitFinish("second run");
+  info("Received both messages");
 
   yield extension.unload();
 });
+
+</script>
+</body>
+</html>
rename from toolkit/components/extensions/test/xpcshell/test_ext_background_sub_windows.js
rename to toolkit/components/extensions/test/mochitest/test_ext_background_sub_windows.html
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_sub_windows.js
+++ b/toolkit/components/extensions/test/mochitest/test_ext_background_sub_windows.html
@@ -1,15 +1,26 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for sub-frames of WebExtension background pages</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+  <script type="text/javascript" src="head.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="text/javascript">
 "use strict";
 
 add_task(function* testBackgroundWindow() {
   let extension = ExtensionTestUtils.loadExtension({
-    background() {
+    background: "new " + function() {
       browser.test.log("background script executed");
 
       browser.test.sendMessage("background-script-load");
 
       let img = document.createElement("img");
       img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
       document.body.appendChild(img);
 
@@ -25,21 +36,30 @@ add_task(function* testBackgroundWindow(
             browser.test.notifyPass("background sub-window test done");
           }, 0);
         };
         document.body.appendChild(iframe);
       };
     },
   });
 
+  info("extension loaded");
+
   let loadCount = 0;
   extension.onMessage("background-script-load", () => {
     loadCount++;
   });
 
   yield extension.startup();
 
+  info("startup complete loaded");
+
   yield extension.awaitFinish("background sub-window test done");
 
-  equal(loadCount, 1, "background script loaded only once");
+  is(loadCount, 1, "background script loaded only once");
 
   yield extension.unload();
 });
+
+</script>
+
+</body>
+</html>
rename from toolkit/components/extensions/test/xpcshell/test_ext_background_window_properties.js
rename to toolkit/components/extensions/test/mochitest/test_ext_background_window_properties.html
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_window_properties.js
+++ b/toolkit/components/extensions/test/mochitest/test_ext_background_window_properties.html
@@ -1,15 +1,26 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for simple WebExtension</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+  <script type="text/javascript" src="head.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="text/javascript">
 "use strict";
 
 add_task(function* testBackgroundWindowProperties() {
   let extension = ExtensionTestUtils.loadExtension({
-    background() {
+    background: "(" + function() {
       let expectedValues = {
         screenX: 0,
         screenY: 0,
         outerWidth: 0,
         outerHeight: 0,
       };
 
       for (let k in window) {
@@ -21,14 +32,22 @@ add_task(function* testBackgroundWindowP
             void window[k];
           }
         } catch (e) {
           browser.test.assertEq(null, e, `unexpected exception accessing window property: ${k}`);
         }
       }
 
       browser.test.notifyPass("background.testWindowProperties.done");
-    },
+    } + ")();",
   });
+  info("load complete");
   yield extension.startup();
+  info("startup complete");
   yield extension.awaitFinish("background.testWindowProperties.done");
   yield extension.unload();
+  info("extension unloaded successfully");
 });
+
+</script>
+
+</body>
+</html>
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -4,21 +4,17 @@ tail =
 firefox-appdir = browser
 skip-if = toolkit == 'gonk' || appname == "thunderbird"
 support-files =
   data/**
 
 [test_csp_custom_policies.js]
 [test_csp_validator.js]
 [test_ext_alarms.js]
-[test_ext_background_generated_load_events.js]
-[test_ext_background_generated_reload.js]
 [test_ext_background_runtime_connect_params.js]
-[test_ext_background_sub_windows.js]
-[test_ext_background_window_properties.js]
 [test_ext_contexts.js]
 [test_ext_downloads.js]
 [test_ext_downloads_download.js]
 [test_ext_downloads_misc.js]
 [test_ext_downloads_search.js]
 [test_ext_extension.js]
 [test_ext_idle.js]
 [test_ext_json_parser.js]