Bug 1507125 - Stop destroying DebuggerServer when moving from This Firefox runtime page;r=daisuke

Differential Revision: https://phabricator.services.mozilla.com/D13137

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2018-11-29 06:29:41 +00:00
Родитель bd5c778053
Коммит 700381caa2
5 изменённых файлов: 53 добавлений и 11 удалений

Просмотреть файл

@ -4,8 +4,6 @@
"use strict";
const { DebuggerServer } = require("devtools/server/main");
const Actions = require("./index");
const {
@ -115,10 +113,6 @@ function disconnectRuntime(id) {
await clientWrapper.close();
if (runtime.type === RUNTIMES.THIS_FIREFOX) {
DebuggerServer.destroy();
}
dispatch({
type: DISCONNECT_RUNTIME_SUCCESS,
runtime: {

Просмотреть файл

@ -26,6 +26,7 @@ skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug
[browser_aboutdebugging_debug-target-pane_collapsibilities_preference.js]
[browser_aboutdebugging_debug-target-pane_empty.js]
[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]

Просмотреть файл

@ -0,0 +1,40 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check that DevTools are not closed when leaving This Firefox runtime page.
*/
add_task(async function() {
info("Force all debug target panes to be expanded");
prepareCollapsibilitiesTest();
const { document, tab, window } = await openAboutDebugging();
const connectSidebarItem = findSidebarItemByText("Connect", document);
const connectLink = connectSidebarItem.querySelector(".js-sidebar-link");
ok(connectSidebarItem, "Found the Connect sidebar item");
info("Open devtools on the current about:debugging tab");
const toolbox = await openToolboxForTab(tab, "inspector");
const inspector = toolbox.getPanel("inspector");
info("DevTools starts workers, wait for requests to settle");
const store = window.AboutDebugging.store;
await waitForDispatch(store, "REQUEST_WORKERS_SUCCESS");
await waitForRequestsToSettle(store);
info("Click on the Connect item in the sidebar");
connectLink.click();
await waitForDispatch(store, "UNWATCH_RUNTIME_SUCCESS");
info("Wait until Connect page is displayed");
await waitUntil(() => document.querySelector(".js-connect-page"));
const markupViewElement = inspector.panelDoc.getElementById("markup-box");
ok(markupViewElement, "Inspector is still rendered");
await removeTab(tab);
});

Просмотреть файл

@ -49,8 +49,12 @@ add_task(async function() {
const backgroundTab2 = await addTab(TAB_URL_2, { background: true });
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("Wait until ThisFirefox page is displayed");
await waitUntil(() => document.querySelector(".js-runtime-page"));
ok(isSidebarItemSelected(thisFirefoxSidebarItem),

Просмотреть файл

@ -55,7 +55,8 @@ async function openAboutDebugging(page, win) {
const browser = tab.linkedBrowser;
const document = browser.contentDocument;
const window = browser.contentWindow;
await waitForInitialDispatch(window);
info("wait for the initial about:debugging requests to be successful");
await waitForRequestsSuccess(window);
return { tab, document, window };
}
@ -67,14 +68,16 @@ async function reloadAboutDebugging(tab) {
const browser = tab.linkedBrowser;
const document = browser.contentDocument;
const window = browser.contentWindow;
await waitForInitialDispatch(window);
info("wait for the initial about:debugging requests to be successful");
await waitForRequestsSuccess(window);
return document;
}
function waitForInitialDispatch(win) {
info("wait for the initial about debugging actions to be dispatched");
// Wait for all about:debugging target request actions to succeed.
// They will typically be triggered after watching a new runtime or loading
// about:debugging.
function waitForRequestsSuccess(win) {
const { AboutDebugging } = win;
return Promise.all([
waitForDispatch(AboutDebugging.store, "REQUEST_EXTENSIONS_SUCCESS"),