Bug 1519088 - Test navigation from remote runtime to this-firefox with service workers;r=ladybenko
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 16 Jan 2019 17:27:44 +0000
changeset 514110 d0529e2d98a3fb0259c0276e59bb70d21d782a42
parent 514109 91911f0e1e35a3965514aac9729b5641698f0243
child 514111 34476dc321b5071bded4819e76393ca140e3472b
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersladybenko
bugs1519088
milestone66.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 1519088 - Test navigation from remote runtime to this-firefox with service workers;r=ladybenko Depends on D16474 Differential Revision: https://phabricator.services.mozilla.com/D16475
devtools/client/aboutdebugging-new/test/browser/browser.ini
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_page_with_serviceworker.js
--- a/devtools/client/aboutdebugging-new/test/browser/browser.ini
+++ b/devtools/client/aboutdebugging-new/test/browser/browser.ini
@@ -37,16 +37,17 @@ skip-if = (os == 'linux' && bits == 32) 
 [browser_aboutdebugging_debug-target-pane_usb_runtime.js]
 [browser_aboutdebugging_devtools.js]
 [browser_aboutdebugging_navigate.js]
 [browser_aboutdebugging_persist_connection.js]
 [browser_aboutdebugging_routes.js]
 [browser_aboutdebugging_runtime_connection-prompt.js]
 [browser_aboutdebugging_runtime_usbclient_closed.js]
 [browser_aboutdebugging_select_network_runtime.js]
+[browser_aboutdebugging_select_page_with_serviceworker.js]
 [browser_aboutdebugging_serviceworker_multie10s.js]
 [browser_aboutdebugging_serviceworker_push.js]
 [browser_aboutdebugging_serviceworker_pushservice_url.js]
 [browser_aboutdebugging_sidebar_network_runtimes.js]
 [browser_aboutdebugging_sidebar_usb_runtime.js]
 [browser_aboutdebugging_sidebar_usb_runtime_connect.js]
 [browser_aboutdebugging_sidebar_usb_runtime_refresh.js]
 [browser_aboutdebugging_sidebar_usb_runtime_select.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_page_with_serviceworker.js
@@ -0,0 +1,66 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/* import-globals-from helper-mocks.js */
+Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-mocks.js", this);
+
+const NETWORK_RUNTIME_HOST = "localhost:6080";
+const NETWORK_RUNTIME_APP_NAME = "TestNetworkApp";
+const WORKER_NAME = "testserviceworker";
+
+// Test that navigating from:
+// - a remote runtime page that contains a service worker
+// to:
+// - this firefox
+// does not crash. See Bug 1519088.
+add_task(async function() {
+  const mocks = new Mocks();
+
+  const { document, tab, window } = await openAboutDebugging();
+
+  info("Prepare Network client mock");
+  const networkClient = mocks.createNetworkRuntime(NETWORK_RUNTIME_HOST, {
+    name: NETWORK_RUNTIME_APP_NAME,
+  });
+
+  info("Connect and select the network runtime");
+  await connectToRuntime(NETWORK_RUNTIME_HOST, document);
+  await selectRuntime(NETWORK_RUNTIME_HOST, NETWORK_RUNTIME_APP_NAME, document);
+
+  info(`Add a service worker to the network client`);
+  const workers = {
+    otherWorkers: [],
+    serviceWorkers: [{
+      name: WORKER_NAME,
+      workerTargetFront: { actorID: WORKER_NAME },
+    }],
+    sharedWorkers: [],
+  };
+  networkClient.listWorkers = () => workers;
+  networkClient._eventEmitter.emit("workerListChanged");
+
+  info("Wait until the service worker is displayed");
+  await waitUntil(() => findDebugTargetByText(WORKER_NAME, document));
+
+  info("Go to This Firefox again");
+  const thisFirefoxSidebarItem = findSidebarItemByText("This Firefox", document);
+  const thisFirefoxLink = thisFirefoxSidebarItem.querySelector(".js-sidebar-link");
+  info("Click on the ThisFirefox item in the sidebar");
+  const requestsSuccess = waitForRequestsSuccess(window);
+  thisFirefoxLink.click();
+
+  info("Wait for all target requests to complete");
+  await requestsSuccess;
+
+  info("Check that the runtime info is rendered for This Firefox");
+  const thisFirefoxRuntimeInfo = document.querySelector(".js-runtime-info");
+  ok(thisFirefoxRuntimeInfo, "Runtime info for this-firefox runtime is displayed");
+
+  const text = thisFirefoxRuntimeInfo.textContent;
+  ok(text.includes("Firefox") && text.includes("63.0"),
+    "this-firefox runtime info shows the correct values");
+
+  await removeTab(tab);
+});