зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1712686 - [devtools] Pull DevToolsClient from commands object instead of target fronts. r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D115862
This commit is contained in:
Родитель
b3d2b323ab
Коммит
2466a0adea
|
@ -14,7 +14,7 @@ async function waitForUrl(url, toolbox, browserTab, win) {
|
|||
browserTab.linkedBrowser.currentURI.spec === url
|
||||
),
|
||||
toolbox.target.once("navigate"),
|
||||
toolbox.target.client.waitForRequestsToSettle(),
|
||||
toolbox.commands.client.waitForRequestsToSettle(),
|
||||
waitForAboutDebuggingRequests(win.AboutDebugging.store),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ add_task(async function() {
|
|||
const toolbox = getToolbox(devtoolsWindow);
|
||||
const refreshes = Promise.all([
|
||||
toolbox.target.once("navigate"),
|
||||
toolbox.target.client.waitForRequestsToSettle(),
|
||||
toolbox.commands.client.waitForRequestsToSettle(),
|
||||
waitForAboutDebuggingRequests(window.AboutDebugging.store),
|
||||
]);
|
||||
clickReload(devtoolsDocument);
|
||||
|
|
|
@ -62,7 +62,7 @@ async function testReloadAboutDevToolsToolbox(toolId) {
|
|||
await toolbox.selectTool(toolId);
|
||||
|
||||
info("Wait for requests to settle before reloading");
|
||||
await toolbox.target.client.waitForRequestsToSettle();
|
||||
await toolbox.commands.client.waitForRequestsToSettle();
|
||||
|
||||
info("Reload about:devtools-toolbox page");
|
||||
devtoolsBrowser.reload();
|
||||
|
|
|
@ -130,7 +130,7 @@ async function closeAboutDevtoolsToolbox(
|
|||
const devtoolsBrowser = devtoolsTab.linkedBrowser;
|
||||
const devtoolsWindow = devtoolsBrowser.contentWindow;
|
||||
const toolbox = getToolbox(devtoolsWindow);
|
||||
await toolbox.target.client.waitForRequestsToSettle();
|
||||
await toolbox.commands.client.waitForRequestsToSettle();
|
||||
|
||||
info("Close about:devtools-toolbox page");
|
||||
const onToolboxDestroyed = gDevTools.once("toolbox-destroyed");
|
||||
|
|
|
@ -20,7 +20,7 @@ const TAB_URL = URL_ROOT + "resources/service-workers/debug.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, tab, target, toolbox } = await openNewTabAndApplicationPanel(
|
||||
const { panel, tab, toolbox, commands } = await openNewTabAndApplicationPanel(
|
||||
TAB_URL
|
||||
);
|
||||
|
||||
|
@ -60,7 +60,7 @@ add_task(async function() {
|
|||
const workerScript = findSource(debuggerContext, "debug-sw.js");
|
||||
await removeBreakpoint(debuggerContext, workerScript.id, 11);
|
||||
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
|
|
|
@ -18,7 +18,7 @@ const EMPTY_URL = (URL_ROOT + "resources/service-workers/empty.html").replace(
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, toolbox, tab } = await openNewTabAndApplicationPanel(
|
||||
const { panel, commands, tab } = await openNewTabAndApplicationPanel(
|
||||
SIMPLE_URL
|
||||
);
|
||||
const doc = panel.panelWin.document;
|
||||
|
@ -62,7 +62,7 @@ add_task(async function() {
|
|||
"Second service worker registration is displayed for the correct domain"
|
||||
);
|
||||
|
||||
await unregisterAllWorkers(toolbox.target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
|
|
|
@ -10,7 +10,7 @@ add_task(async function() {
|
|||
await enableApplicationPanel();
|
||||
|
||||
await openTabAndWaitForWorker(WORKER1_URL);
|
||||
const { panel, tab, toolbox } = await openTabAndWaitForWorker(WORKER2_URL);
|
||||
const { panel, tab, commands } = await openTabAndWaitForWorker(WORKER2_URL);
|
||||
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
|
@ -44,7 +44,7 @@ add_task(async function() {
|
|||
const url2El = workers[1].querySelector(".js-source-url");
|
||||
is(url2El.textContent, "debug-sw.js", "Second worker has correct URL");
|
||||
|
||||
await unregisterAllWorkers(toolbox.target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
|
@ -52,7 +52,7 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
async function openTabAndWaitForWorker(url) {
|
||||
const { panel, toolbox, tab } = await openNewTabAndApplicationPanel(url);
|
||||
const { panel, commands, tab } = await openNewTabAndApplicationPanel(url);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -60,5 +60,5 @@ async function openTabAndWaitForWorker(url) {
|
|||
info("Wait until the service worker appears in the application panel");
|
||||
await waitUntil(() => getWorkerContainers(doc).length === 1);
|
||||
|
||||
return { panel, toolbox, tab };
|
||||
return { panel, commands, tab };
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ const OTHER_SCOPE_URL = URL_ROOT + "resources/service-workers/scope-page.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, toolbox, tab } = await openNewTabAndApplicationPanel(
|
||||
const { panel, commands, tab } = await openNewTabAndApplicationPanel(
|
||||
SIMPLE_URL
|
||||
);
|
||||
const doc = panel.panelWin.document;
|
||||
|
@ -46,7 +46,7 @@ add_task(async function() {
|
|||
|
||||
ok(true, "Second service worker registration is displayed");
|
||||
|
||||
await unregisterAllWorkers(toolbox.target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
|
|
|
@ -15,7 +15,7 @@ const TAB_URL = (
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, target, tab } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -39,7 +39,7 @@ add_task(async function() {
|
|||
"Service worker has the expected Unicode url"
|
||||
);
|
||||
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
|
|
|
@ -11,7 +11,7 @@ add_task(async function() {
|
|||
info("Test that we are displaying correctly the sidebar");
|
||||
|
||||
await enableApplicationPanel();
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel();
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel();
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
info("Waiting for the sidebar to be displayed");
|
||||
|
@ -23,7 +23,7 @@ add_task(async function() {
|
|||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
await target.client.waitForRequestsToSettle();
|
||||
await commands.client.waitForRequestsToSettle();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
@ -31,13 +31,13 @@ add_task(async function() {
|
|||
info("Test that we are displaying correctly the selected page - manifest");
|
||||
|
||||
await enableApplicationPanel();
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel();
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel();
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
info("Select service worker page");
|
||||
selectPage(panel, "service-workers");
|
||||
await waitUntil(() => doc.querySelector(".js-service-workers-page") !== null);
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
info("Select manifest page in the sidebar");
|
||||
const link = doc.querySelector(".js-sidebar-manifest");
|
||||
|
@ -48,7 +48,7 @@ add_task(async function() {
|
|||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
await target.client.waitForRequestsToSettle();
|
||||
await commands.client.waitForRequestsToSettle();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
@ -59,7 +59,7 @@ add_task(async function() {
|
|||
const url = URL_ROOT + "resources/manifest/load-ok.html";
|
||||
|
||||
await enableApplicationPanel();
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(url);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(url);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "manifest");
|
||||
|
@ -77,6 +77,6 @@ add_task(async function() {
|
|||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
await target.client.waitForRequestsToSettle();
|
||||
await commands.client.waitForRequestsToSettle();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function() {
|
|||
await pushPref("dom.serviceWorkers.idle_timeout", 1000);
|
||||
await pushPref("dom.serviceWorkers.idle_extended_timeout", 1000);
|
||||
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -46,7 +46,7 @@ add_task(async function() {
|
|||
});
|
||||
ok(true, "Worker status is 'Running'");
|
||||
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function() {
|
|||
await enableApplicationPanel();
|
||||
|
||||
info("Open a page that runs in the parent process");
|
||||
const { panel, toolbox, tab } = await openNewTabAndApplicationPanel(
|
||||
const { panel, commands, tab } = await openNewTabAndApplicationPanel(
|
||||
PARENT_PROCESS_URI
|
||||
);
|
||||
const doc = panel.panelWin.document;
|
||||
|
@ -36,7 +36,7 @@ add_task(async function() {
|
|||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
await unregisterAllWorkers(toolbox.target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ const TAB_URL = URL_ROOT + "resources/service-workers/simple.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, tab, toolbox, target } = await openNewTabAndApplicationPanel(
|
||||
const { panel, tab, toolbox, commands } = await openNewTabAndApplicationPanel(
|
||||
TAB_URL
|
||||
);
|
||||
|
||||
|
@ -42,8 +42,8 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
// clean up and close the tab
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
info("Closing the tab.");
|
||||
await target.client.waitForRequestsToSettle();
|
||||
await commands.client.waitForRequestsToSettle();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ add_task(async function() {
|
|||
await enableApplicationPanel();
|
||||
|
||||
const TAB_URL = URL_ROOT + "resources/service-workers/empty.html";
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
setupTelemetryTest();
|
||||
|
@ -21,6 +21,6 @@ add_task(async function() {
|
|||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
await target.client.waitForRequestsToSettle();
|
||||
await commands.client.waitForRequestsToSettle();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ add_task(async function() {
|
|||
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -38,8 +38,8 @@ add_task(async function() {
|
|||
checkTelemetryEvent({ method: "start_worker" });
|
||||
|
||||
// clean up and close the tab
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
info("Closing the tab.");
|
||||
await target.client.waitForRequestsToSettle();
|
||||
await commands.client.waitForRequestsToSettle();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ const TAB_URL = URL_ROOT + "resources/service-workers/simple.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -30,8 +30,8 @@ add_task(async function() {
|
|||
checkTelemetryEvent({ method: "unregister_worker" });
|
||||
|
||||
// clean up and close the tab
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
info("Closing the tab.");
|
||||
await target.client.waitForRequestsToSettle();
|
||||
await commands.client.waitForRequestsToSettle();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ const TAB_URL = URL_ROOT + "resources/service-workers/simple.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -28,7 +28,7 @@ add_task(async function() {
|
|||
ok(true, "Service worker list is empty");
|
||||
|
||||
// just in case cleanup
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
|
||||
// close the tab
|
||||
info("Closing the tab.");
|
||||
|
|
|
@ -15,7 +15,7 @@ add_task(async function() {
|
|||
false
|
||||
);
|
||||
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -42,7 +42,7 @@ add_task(async function() {
|
|||
ok(sourceTab, "The service worker source was opened in a new tab");
|
||||
|
||||
// clean up
|
||||
await unregisterAllWorkers(target.client, doc);
|
||||
await unregisterAllWorkers(commands.client, doc);
|
||||
// close the tabs
|
||||
info("Closing the tabs.");
|
||||
await BrowserTestUtils.removeTab(sourceTab);
|
||||
|
|
|
@ -101,7 +101,8 @@ async function openNewTabAndApplicationPanel(url) {
|
|||
});
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
const target = toolbox.target;
|
||||
return { panel, tab, target, toolbox };
|
||||
const commands = toolbox.commands;
|
||||
return { panel, tab, target, toolbox, commands };
|
||||
}
|
||||
|
||||
async function unregisterAllWorkers(client, doc) {
|
||||
|
|
|
@ -53,7 +53,6 @@ class DebuggerPanel {
|
|||
} = await this.panelWin.Debugger.bootstrap({
|
||||
commands: this.commands,
|
||||
resourceCommand: this.toolbox.resourceCommand,
|
||||
devToolsClient: this.toolbox.target.client,
|
||||
workers: {
|
||||
sourceMaps: this.toolbox.sourceMapService,
|
||||
evaluationsParser: this.toolbox.parserService,
|
||||
|
@ -88,7 +87,7 @@ class DebuggerPanel {
|
|||
currentThreadActorID &&
|
||||
currentThreadActorID !== getCurrentThread(oldState)
|
||||
) {
|
||||
const threadFront = this.toolbox.target.client.getFrontByID(
|
||||
const threadFront = this.commands.client.getFrontByID(
|
||||
currentThreadActorID
|
||||
);
|
||||
this.toolbox.selectTarget(threadFront?.targetFront.actorID);
|
||||
|
|
|
@ -167,7 +167,7 @@ async function waitForElementWithSelector(dbg, selector) {
|
|||
}
|
||||
|
||||
function waitForRequestsToSettle(dbg) {
|
||||
return dbg.toolbox.target.client.waitForRequestsToSettle();
|
||||
return dbg.commands.client.waitForRequestsToSettle();
|
||||
}
|
||||
|
||||
function assertClass(el, className, exists = true) {
|
||||
|
|
|
@ -387,7 +387,7 @@ var gDevToolsBrowser = (exports.gDevToolsBrowser = {
|
|||
// the devtools client and also the server created in the
|
||||
// content process
|
||||
toolbox.target.on("target-destroyed", () => {
|
||||
toolbox.target.client.close();
|
||||
toolbox.commands.client.close();
|
||||
});
|
||||
|
||||
return toolbox;
|
||||
|
|
|
@ -47,5 +47,5 @@ add_task(async function() {
|
|||
// Ideally the debugger should only resolve when the worker targets have been
|
||||
// retrieved, which should be fixed by Bug 1621337 or a followup.
|
||||
info("Wait for all pending requests to settle on the DevToolsClient");
|
||||
await toolbox.target.client.waitForRequestsToSettle();
|
||||
await toolbox.commands.client.waitForRequestsToSettle();
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@ add_task(async function() {
|
|||
const tab = await addTab(EXAMPLE_COM_URI);
|
||||
const toolbox = await gDevTools.showToolboxForTab(tab);
|
||||
const target = toolbox.target;
|
||||
const client = target.client;
|
||||
const client = toolbox.commands.client;
|
||||
|
||||
info("Retrieve the initial list of tab descriptors");
|
||||
const tabDescriptors = await client.mainRoot.listTabs();
|
||||
|
|
|
@ -47,7 +47,7 @@ add_task(async function() {
|
|||
);
|
||||
target = await descriptor.getTarget();
|
||||
assertTarget(target, TEST_URI);
|
||||
await target.client.close();
|
||||
await descriptor.client.close();
|
||||
|
||||
info("Test invalid tab id");
|
||||
try {
|
||||
|
@ -65,7 +65,7 @@ add_task(async function() {
|
|||
target = await descriptor.getTarget();
|
||||
const topWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
assertTarget(target, topWindow.location.href, true);
|
||||
await target.client.close();
|
||||
await descriptor.client.close();
|
||||
|
||||
await testRemoteTCP();
|
||||
await testRemoteWebSocket();
|
||||
|
@ -118,12 +118,12 @@ async function testRemoteTCP() {
|
|||
const topWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
assertTarget(target, topWindow.location.href, true);
|
||||
|
||||
const settings = target.client._transport.connectionSettings;
|
||||
const settings = descriptor.client._transport.connectionSettings;
|
||||
is(settings.host, "127.0.0.1");
|
||||
is(parseInt(settings.port, 10), port);
|
||||
is(settings.webSocket, false);
|
||||
|
||||
await target.client.close();
|
||||
await descriptor.client.close();
|
||||
|
||||
teardownDevToolsServer(server);
|
||||
}
|
||||
|
@ -141,11 +141,11 @@ async function testRemoteWebSocket() {
|
|||
const topWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
assertTarget(target, topWindow.location.href, true);
|
||||
|
||||
const settings = target.client._transport.connectionSettings;
|
||||
const settings = descriptor.client._transport.connectionSettings;
|
||||
is(settings.host, "127.0.0.1");
|
||||
is(parseInt(settings.port, 10), port);
|
||||
is(settings.webSocket, true);
|
||||
await target.client.close();
|
||||
await descriptor.client.close();
|
||||
|
||||
teardownDevToolsServer(server);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ function runTools(tab) {
|
|||
ok(panel, toolId + " panel has been registered in the toolbox");
|
||||
}
|
||||
|
||||
const client = toolbox.target.client;
|
||||
const client = toolbox.commands.client;
|
||||
await toolbox.destroy();
|
||||
|
||||
// We need to check the client after the toolbox destruction.
|
||||
|
|
|
@ -24,7 +24,7 @@ async function viewSource() {
|
|||
// Ideally the debugger should only resolve when the worker targets have been
|
||||
// retrieved, which should be fixed by Bug 1621337 or a followup.
|
||||
info("Wait for all pending requests to settle on the DevToolsClient");
|
||||
await toolbox.target.client.waitForRequestsToSettle();
|
||||
await toolbox.commands.client.waitForRequestsToSettle();
|
||||
|
||||
await closeToolboxAndTab(toolbox);
|
||||
finish();
|
||||
|
|
|
@ -58,5 +58,5 @@ add_task(async function() {
|
|||
// Ideally the debugger should only resolve when the worker targets have been
|
||||
// retrieved, which should be fixed by Bug 1621337 or a followup.
|
||||
info("Wait for all pending requests to settle on the DevToolsClient");
|
||||
await toolbox.target.client.waitForRequestsToSettle();
|
||||
await toolbox.commands.client.waitForRequestsToSettle();
|
||||
});
|
||||
|
|
|
@ -462,7 +462,7 @@ OptionsPanel.prototype = {
|
|||
// regular Firefox Profile to the Browser Toolbox profile.
|
||||
// If the preference is not updated on the regular Firefox profile, the
|
||||
// new value will be lost on the next Browser Toolbox restart.
|
||||
const { mainRoot } = this.target.client;
|
||||
const { mainRoot } = this.commands.client;
|
||||
const preferenceFront = await mainRoot.getFront("preference");
|
||||
preferenceFront.setBoolPref(
|
||||
"devtools.browsertoolbox.fission",
|
||||
|
|
|
@ -634,7 +634,7 @@ Toolbox.prototype = {
|
|||
return null;
|
||||
}
|
||||
|
||||
return this.target.client.getFrontByID(selectedTarget.actorID);
|
||||
return this.commands.client.getFrontByID(selectedTarget.actorID);
|
||||
},
|
||||
|
||||
_onToolboxStateChange(state, oldState) {
|
||||
|
@ -3066,7 +3066,7 @@ Toolbox.prototype = {
|
|||
* client. See the definition of the preference actor for more information.
|
||||
*/
|
||||
get preferenceFront() {
|
||||
const frontPromise = this.target.client.mainRoot.getFront("preference");
|
||||
const frontPromise = this.commands.client.mainRoot.getFront("preference");
|
||||
frontPromise.then(front => {
|
||||
// Set the _preferenceFront property to allow the resetPreferences toolbox method
|
||||
// to cleanup the preference set when the toolbox is closed.
|
||||
|
@ -3676,11 +3676,7 @@ Toolbox.prototype = {
|
|||
|
||||
// This flag will be checked by Fronts in order to decide if they should
|
||||
// skip their destroy.
|
||||
if (this.target.client) {
|
||||
// Note: this.target.client might be null if the target was already
|
||||
// destroyed (eg: tab is closed during remote debugging).
|
||||
this.target.client.isToolboxDestroy = true;
|
||||
}
|
||||
this.commands.client.isToolboxDestroy = true;
|
||||
|
||||
this.off("select", this._onToolSelected);
|
||||
this.off("host-changed", this._refreshHostTitle);
|
||||
|
|
|
@ -35,6 +35,13 @@ export interface Toolbox {
|
|||
target: Target;
|
||||
}
|
||||
|
||||
/**
|
||||
* TS-TODO - Stub.
|
||||
*/
|
||||
export interface Commands {
|
||||
client: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The actor version of the ActorReadyGeckoProfilerInterface returns promises,
|
||||
* while if it's instantiated directly it will not return promises.
|
||||
|
|
|
@ -15,13 +15,14 @@
|
|||
* @typedef {import("./@types/perf").PanelWindow} PanelWindow
|
||||
* @typedef {import("./@types/perf").Toolbox} Toolbox
|
||||
* @typedef {import("./@types/perf").Target} Target
|
||||
* @typedef {import("./@types/perf").Commands} Commands
|
||||
*/
|
||||
|
||||
class PerformancePanel {
|
||||
/**
|
||||
* @param {PanelWindow} iframeWindow
|
||||
* @param {Toolbox} toolbox
|
||||
* @param {Object} commands
|
||||
* @param {Commands} commands
|
||||
*/
|
||||
constructor(iframeWindow, toolbox, commands) {
|
||||
this.panelWin = iframeWindow;
|
||||
|
@ -60,7 +61,7 @@ class PerformancePanel {
|
|||
this.panelWin.gToolbox = this.toolbox;
|
||||
this.panelWin.gIsPanelDestroyed = false;
|
||||
|
||||
const perfFront = await this.target.client.mainRoot.getFront("perf");
|
||||
const perfFront = await this.commands.client.mainRoot.getFront("perf");
|
||||
|
||||
this.panelWin.gInit(perfFront, "devtools");
|
||||
return this;
|
||||
|
|
|
@ -38,7 +38,7 @@ async function testButton(toolbox) {
|
|||
ok(button, "Captain, we have the button");
|
||||
|
||||
await delayedClicks(toolbox, button, 4);
|
||||
await toolbox.target.client.waitForRequestsToSettle();
|
||||
await toolbox.commands.client.waitForRequestsToSettle();
|
||||
checkResults();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
"use strict";
|
||||
|
||||
class ConsoleCommands {
|
||||
constructor({ devToolsClient, hud }) {
|
||||
this.devToolsClient = devToolsClient;
|
||||
this.hud = hud;
|
||||
constructor({ commands }) {
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
getFrontByID(id) {
|
||||
return this.devToolsClient.getFrontByID(id);
|
||||
return this.commands.client.getFrontByID(id);
|
||||
}
|
||||
|
||||
async evaluateJSAsync(expression, options = {}) {
|
||||
|
@ -22,7 +21,7 @@ class ConsoleCommands {
|
|||
selectedTargetFront,
|
||||
} = options;
|
||||
|
||||
let targetFront = this.hud.currentTarget;
|
||||
let targetFront = this.commands.targetCommand.targetFront;
|
||||
|
||||
const selectedActor =
|
||||
selectedObjectActor || selectedNodeActor || frameActor;
|
||||
|
|
|
@ -47,7 +47,7 @@ class WebConsoleConnectionProxy {
|
|||
return this._connecter;
|
||||
}
|
||||
|
||||
if (!this.target.client) {
|
||||
if (this.target.isDestroyed()) {
|
||||
return Promise.reject("target was destroyed");
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@ class WebConsoleConnectionProxy {
|
|||
this.target.on("navigate", this._onTabNavigated);
|
||||
|
||||
const connection = (async () => {
|
||||
this.client = this.target.client;
|
||||
this.webConsoleFront = await this.target.getFront("console");
|
||||
|
||||
// There is no way to view response bodies from the Browser Console, so do
|
||||
|
@ -180,7 +179,7 @@ class WebConsoleConnectionProxy {
|
|||
* A promise object that is resolved when disconnect completes.
|
||||
*/
|
||||
disconnect() {
|
||||
if (!this.client) {
|
||||
if (!this.webConsoleFront) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -188,7 +187,6 @@ class WebConsoleConnectionProxy {
|
|||
this.target.off("will-navigate", this._onTabWillNavigate);
|
||||
this.target.off("navigate", this._onTabNavigated);
|
||||
|
||||
this.client = null;
|
||||
this.webConsoleFront = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,12 +154,8 @@ class WebConsoleUI {
|
|||
// and may overload the Browser Console.
|
||||
await this._attachTargets();
|
||||
|
||||
this._commands = new ConsoleCommands({
|
||||
devToolsClient: this.hud.currentTarget.client,
|
||||
proxy: this.getProxy(),
|
||||
hud: this.hud,
|
||||
threadFront: this.hud.toolbox && this.hud.toolbox.threadFront,
|
||||
currentTarget: this.hud.currentTarget,
|
||||
this._consoleCommands = new ConsoleCommands({
|
||||
commands: this.hud.commands,
|
||||
});
|
||||
|
||||
await this.wrapper.init();
|
||||
|
|
|
@ -90,7 +90,7 @@ class WebConsoleWrapper {
|
|||
webConsoleUI,
|
||||
hud: this.hud,
|
||||
toolbox: this.toolbox,
|
||||
client: this.webConsoleUI._commands,
|
||||
client: this.webConsoleUI._consoleCommands,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class WebConsole {
|
|||
}
|
||||
|
||||
getFrontByID(id) {
|
||||
return this.currentTarget.client.getFrontByID(id);
|
||||
return this.commands.client.getFrontByID(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -444,7 +444,7 @@ class WebConsole {
|
|||
* devtools/client/fronts/webconsole.js
|
||||
*/
|
||||
evaluateJSAsync(expression, options = {}) {
|
||||
return this.ui._commands.evaluateJSAsync(expression, options);
|
||||
return this.ui._consoleCommands.evaluateJSAsync(expression, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче