зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 9 changesets (bug 1485676) for failing at damp inspector/cold-open.js on a CLOSED TREE
Backed out changeset 4de2e71debfe (bug 1485676) Backed out changeset e63025150c7a (bug 1485676) Backed out changeset f9ef30ae3f7f (bug 1485676) Backed out changeset a83636fab16a (bug 1485676) Backed out changeset b1fd24929e09 (bug 1485676) Backed out changeset acb27b915742 (bug 1485676) Backed out changeset ba2157632772 (bug 1485676) Backed out changeset d1d6b9bc2372 (bug 1485676) Backed out changeset d7646ea8640b (bug 1485676)
This commit is contained in:
Родитель
5c86561d00
Коммит
ad28ad0169
|
@ -35,7 +35,7 @@ function getDevToolsPrefBranchName(extensionId) {
|
|||
*/
|
||||
global.getDevToolsTargetForContext = async (context) => {
|
||||
if (context.devToolsTarget) {
|
||||
await context.devToolsTarget.attach();
|
||||
await context.devToolsTarget.makeRemote();
|
||||
return context.devToolsTarget;
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,9 @@ global.getDevToolsTargetForContext = async (context) => {
|
|||
}
|
||||
|
||||
const tab = context.devToolsToolbox.target.tab;
|
||||
context.devToolsTarget = await DevToolsShim.createTargetForTab(tab);
|
||||
await context.devToolsTarget.attach();
|
||||
context.devToolsTarget = DevToolsShim.createTargetForTab(tab);
|
||||
|
||||
await context.devToolsTarget.makeRemote();
|
||||
|
||||
return context.devToolsTarget;
|
||||
};
|
||||
|
|
|
@ -106,7 +106,7 @@ add_task(async function test_devtools_inspectedWindow_tabId() {
|
|||
|
||||
let backgroundPageCurrentTabId = await extension.awaitMessage("current-tab-id");
|
||||
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
await gDevTools.showToolbox(target, "webconsole");
|
||||
info("developer toolbox opened");
|
||||
|
@ -174,7 +174,7 @@ add_task(async function test_devtools_inspectedWindow_eval() {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
await gDevTools.showToolbox(target, "webconsole");
|
||||
info("developer toolbox opened");
|
||||
|
@ -336,7 +336,7 @@ add_task(async function test_devtools_inspectedWindow_eval_in_page_and_panel() {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
const target = await gDevTools.getTargetForTab(tab);
|
||||
const target = gDevTools.getTargetForTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
info("developer toolbox opened");
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
const target = await gDevTools.getTargetForTab(tab);
|
||||
const target = gDevTools.getTargetForTab(tab);
|
||||
// Open the toolbox on the styleeditor, so that the inspector and the
|
||||
// console panel have not been explicitly activated yet.
|
||||
const toolbox = await gDevTools.showToolbox(target, "styleeditor");
|
||||
|
|
|
@ -37,7 +37,7 @@ async function runReloadTestCase({urlParams, background, devtoolsPage, testCase}
|
|||
|
||||
await extension.startup();
|
||||
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
await gDevTools.showToolbox(target, "webconsole");
|
||||
info("developer toolbox opened");
|
||||
|
|
|
@ -134,7 +134,7 @@ add_task(async function test_devtools_network_on_navigated() {
|
|||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
await gDevTools.showToolbox(target, "webconsole");
|
||||
info("Developer toolbox opened.");
|
||||
|
@ -172,7 +172,7 @@ add_task(async function test_devtools_network_get_har() {
|
|||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
// Open the Toolbox
|
||||
let toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
|
@ -223,7 +223,7 @@ add_task(async function test_devtools_network_on_request_finished() {
|
|||
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
// Open the Toolbox
|
||||
let toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
|
|
|
@ -119,7 +119,7 @@ add_task(async function test_devtools_page_runtime_api_messaging() {
|
|||
info("Wait the content script load");
|
||||
await extension.awaitMessage("content_script_loaded");
|
||||
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
info("Open the developer toolbox");
|
||||
await gDevTools.showToolbox(target, "webconsole");
|
||||
|
@ -247,7 +247,7 @@ add_task(async function test_devtools_page_and_extension_tab_messaging() {
|
|||
info("Wait the extension tab page load");
|
||||
await extension.awaitMessage("extension_tab_loaded");
|
||||
|
||||
let target = await gDevTools.getTargetForTab(tab);
|
||||
let target = gDevTools.getTargetForTab(tab);
|
||||
|
||||
info("Open the developer toolbox");
|
||||
await gDevTools.showToolbox(target, "webconsole");
|
||||
|
|
|
@ -25,14 +25,14 @@ const DEVTOOLS_THEME_PREF = "devtools.theme";
|
|||
*/
|
||||
|
||||
async function openToolboxForTab(tab) {
|
||||
const target = await gDevTools.getTargetForTab(tab);
|
||||
const target = gDevTools.getTargetForTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "testBlankPanel");
|
||||
info("Developer toolbox opened");
|
||||
return {toolbox, target};
|
||||
}
|
||||
|
||||
async function closeToolboxForTab(tab) {
|
||||
const target = await gDevTools.getTargetForTab(tab);
|
||||
const target = gDevTools.getTargetForTab(tab);
|
||||
await gDevTools.closeToolbox(target);
|
||||
await target.destroy();
|
||||
info("Developer toolbox closed");
|
||||
|
|
|
@ -79,7 +79,7 @@ add_task(async function test_devtools_panels_elements_onSelectionChanged() {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
let target = await devtools.TargetFactory.forTab(tab);
|
||||
let target = devtools.TargetFactory.forTab(tab);
|
||||
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
info("developer toolbox opened");
|
||||
|
|
|
@ -114,7 +114,7 @@ add_task(async function test_devtools_panels_elements_sidebar() {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
let target = await devtools.TargetFactory.forTab(tab);
|
||||
let target = devtools.TargetFactory.forTab(tab);
|
||||
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
info("developer toolbox opened");
|
||||
|
|
|
@ -61,7 +61,7 @@ AccessibilityPanel.prototype = {
|
|||
|
||||
// Local monitoring needs to make the target remote.
|
||||
if (!this.target.isRemote) {
|
||||
await this.target.attach();
|
||||
await this.target.makeRemote();
|
||||
}
|
||||
|
||||
this._telemetry = new Telemetry();
|
||||
|
|
|
@ -156,7 +156,7 @@ async function disableAccessibilityInspector(env) {
|
|||
* @return a promise that is resolved once the panel is open.
|
||||
*/
|
||||
async function initAccessibilityPanel(tab = gBrowser.selectedTab) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "accessibility");
|
||||
return toolbox.getCurrentPanel();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class ApplicationPanel {
|
|||
|
||||
async open() {
|
||||
if (!this.toolbox.target.isRemote) {
|
||||
await this.toolbox.target.attach();
|
||||
await this.toolbox.target.makeRemote();
|
||||
}
|
||||
|
||||
await this.panelWin.Application.bootstrap({
|
||||
|
|
|
@ -47,8 +47,8 @@ function navigate(target, url, waitForTargetEvent = "navigate") {
|
|||
|
||||
async function openNewTabAndApplicationPanel(url) {
|
||||
const tab = await addTab(url);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const target = TargetFactory.forTab(tab);
|
||||
await target.makeRemote();
|
||||
|
||||
const toolbox = await gDevTools.showToolbox(target, "application");
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
|
|
|
@ -32,7 +32,7 @@ CanvasDebuggerPanel.prototype = {
|
|||
|
||||
// Local debugging needs to make the target remote.
|
||||
if (!this.target.isRemote) {
|
||||
targetPromise = this.target.attach();
|
||||
targetPromise = this.target.makeRemote();
|
||||
} else {
|
||||
targetPromise = Promise.resolve(this.target);
|
||||
}
|
||||
|
|
|
@ -127,15 +127,14 @@ function initCallWatcherBackend(aUrl) {
|
|||
|
||||
return (async function() {
|
||||
const tab = await addTab(aUrl);
|
||||
|
||||
const target = TargetFactory.forTab(tab);
|
||||
await registerActorInContentProcess("chrome://mochitests/content/browser/devtools/client/canvasdebugger/test/call-watcher-actor.js", {
|
||||
prefix: "callWatcher",
|
||||
constructor: "CallWatcherActor",
|
||||
type: { target: true }
|
||||
});
|
||||
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
await target.makeRemote();
|
||||
|
||||
const front = new CallWatcherFront(target.client, target.form);
|
||||
return { target, front };
|
||||
|
@ -148,9 +147,9 @@ function initCanvasDebuggerBackend(aUrl) {
|
|||
|
||||
return (async function() {
|
||||
const tab = await addTab(aUrl);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
await target.attach();
|
||||
await target.makeRemote();
|
||||
|
||||
const front = new CanvasFront(target.client, target.form);
|
||||
return { target, front };
|
||||
|
@ -162,9 +161,9 @@ function initCanvasDebuggerFrontend(aUrl) {
|
|||
|
||||
return (async function() {
|
||||
const tab = await addTab(aUrl);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
await target.attach();
|
||||
await target.makeRemote();
|
||||
|
||||
Services.prefs.setBoolPref("devtools.canvasdebugger.enabled", true);
|
||||
const toolbox = await gDevTools.showToolbox(target, "canvasdebugger");
|
||||
|
|
|
@ -22,7 +22,7 @@ function DebuggerPanel(iframeWindow, toolbox) {
|
|||
DebuggerPanel.prototype = {
|
||||
open: async function() {
|
||||
if (!this.toolbox.target.isRemote) {
|
||||
await this.toolbox.target.attach();
|
||||
await this.toolbox.target.makeRemote();
|
||||
}
|
||||
|
||||
const {
|
||||
|
|
|
@ -30,7 +30,7 @@ function initDebuggerClient() {
|
|||
}
|
||||
|
||||
async function attachThread(client, actor) {
|
||||
let [response, tabClient] = await client.attachTarget(actor);
|
||||
let [response, tabClient] = await client.attachTab(actor);
|
||||
let [response2, threadClient] = await tabClient.attachThread(null);
|
||||
return threadClient;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ async function takeScreenshot(dbg) {
|
|||
// Attach a debugger to a tab, returning a promise that resolves with the
|
||||
// debugger's toolbox.
|
||||
async function attachDebugger(tab) {
|
||||
let target = await TargetFactory.forTab(tab);
|
||||
let target = TargetFactory.forTab(tab);
|
||||
let toolbox = await gDevTools.showToolbox(target, "jsdebugger");
|
||||
return toolbox;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ DebuggerPanel.prototype = {
|
|||
|
||||
// Local debugging needs to make the target remote.
|
||||
if (!this.target.isRemote) {
|
||||
targetPromise = this.target.attach();
|
||||
targetPromise = this.target.makeRemote();
|
||||
// Listen for tab switching events to manage focus when the content window
|
||||
// is paused and events suppressed.
|
||||
this.target.tab.addEventListener("TabSelect", this);
|
||||
|
|
|
@ -18,7 +18,7 @@ function test() {
|
|||
|
||||
let tab = yield addTab(TAB1_URL);
|
||||
let { tabs } = yield listTabs(client);
|
||||
let [, tabClient] = yield attachTarget(client, findTab(tabs, TAB1_URL));
|
||||
let [, tabClient] = yield attachTab(client, findTab(tabs, TAB1_URL));
|
||||
yield listWorkers(tabClient);
|
||||
|
||||
// If a page still has pending network requests, it will not be moved into
|
||||
|
|
|
@ -13,9 +13,9 @@ function test() {
|
|||
|
||||
let tab = yield addTab(TAB_URL);
|
||||
let { tabs: tabs1 } = yield listTabs(client1);
|
||||
let [, tabClient1] = yield attachTarget(client1, findTab(tabs1, TAB_URL));
|
||||
let [, tabClient1] = yield attachTab(client1, findTab(tabs1, TAB_URL));
|
||||
let { tabs: tabs2 } = yield listTabs(client2);
|
||||
let [, tabClient2] = yield attachTarget(client2, findTab(tabs2, TAB_URL));
|
||||
let [, tabClient2] = yield attachTab(client2, findTab(tabs2, TAB_URL));
|
||||
|
||||
yield listWorkers(tabClient1);
|
||||
yield listWorkers(tabClient2);
|
||||
|
|
|
@ -13,7 +13,7 @@ const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
|
|||
function test() {
|
||||
Task.spawn(function* () {
|
||||
const tab = yield getTab(TAB_URL);
|
||||
const target = yield TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = yield gDevTools.showToolbox(target, "webconsole");
|
||||
|
||||
is(toolbox.currentToolId, "webconsole", "Console is the current panel");
|
||||
|
|
|
@ -46,7 +46,7 @@ function testParentProcessTargetActor() {
|
|||
gClient.addListener("newGlobal", onNewGlobal);
|
||||
|
||||
let actor = aResponse.form.actor;
|
||||
gClient.attachTarget(actor).then(([response, tabClient]) => {
|
||||
gClient.attachTab(actor).then(([response, tabClient]) => {
|
||||
tabClient.attachThread(null).then(([aResponse, aThreadClient]) => {
|
||||
gThreadClient = aThreadClient;
|
||||
gThreadClient.addListener("newSource", onNewSource);
|
||||
|
|
|
@ -12,7 +12,7 @@ function test() {
|
|||
|
||||
let tab = yield addTab(TAB_URL);
|
||||
let { tabs } = yield listTabs(client);
|
||||
let [, tabClient] = yield attachTarget(client, findTab(tabs, TAB_URL));
|
||||
let [, tabClient] = yield attachTab(client, findTab(tabs, TAB_URL));
|
||||
|
||||
let { workers } = yield listWorkers(tabClient);
|
||||
is(workers.length, 0);
|
||||
|
|
|
@ -29,7 +29,7 @@ function test() {
|
|||
|
||||
let { tabs } = yield listTabs(client);
|
||||
let targetTab = findTab(tabs, TAB_URL);
|
||||
yield attachTarget(client, targetTab);
|
||||
yield attachTab(client, targetTab);
|
||||
|
||||
yield testGetAllocationStack(client, targetTab, tab);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ function test() {
|
|||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
yield connect(client);
|
||||
let chrome = yield client.getProcess();
|
||||
let [, tabClient] = yield attachTarget(client, chrome.form);
|
||||
let [, tabClient] = yield attachTab(client, chrome.form);
|
||||
yield tabClient.attachThread();
|
||||
|
||||
yield testGetAllocationStack(client, chrome.form, () => {
|
||||
|
|
|
@ -47,7 +47,7 @@ function test() {
|
|||
|
||||
let { tabs } = yield listTabs(client);
|
||||
let targetTab = findTab(tabs, TAB_URL);
|
||||
yield attachTarget(client, targetTab);
|
||||
yield attachTab(client, targetTab);
|
||||
|
||||
yield testGetFulfillmentStack(client, targetTab, tab);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ function test() {
|
|||
|
||||
let { tabs } = yield listTabs(client);
|
||||
let targetTab = findTab(tabs, TAB_URL);
|
||||
yield attachTarget(client, targetTab);
|
||||
yield attachTab(client, targetTab);
|
||||
|
||||
yield testGetRejectionStack(client, targetTab, tab);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ add_task(async function() {
|
|||
|
||||
let tab = await addTab(TAB_URL);
|
||||
let { tabs } = await listTabs(client);
|
||||
let [, tabClient] = await attachTarget(client, findTab(tabs, TAB_URL));
|
||||
let [, tabClient] = await attachTab(client, findTab(tabs, TAB_URL));
|
||||
|
||||
await listWorkers(tabClient);
|
||||
await createWorkerInTab(tab, WORKER_URL);
|
||||
|
|
|
@ -43,7 +43,7 @@ registerCleanupFunction(async function() {
|
|||
|
||||
while (gBrowser && gBrowser.tabs && gBrowser.tabs.length > 1) {
|
||||
info("Destroying toolbox.");
|
||||
let target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
await gDevTools.closeToolbox(target);
|
||||
|
||||
info("Removing tab.");
|
||||
|
@ -179,7 +179,7 @@ function getAddonActorForId(aClient, aAddonId) {
|
|||
|
||||
async function attachTargetActorForUrl(aClient, aUrl) {
|
||||
let grip = await getTargetActorForUrl(aClient, aUrl);
|
||||
let [ response ] = await aClient.attachTarget(grip.actor);
|
||||
let [ response ] = await aClient.attachTab(grip.actor);
|
||||
return [grip, response];
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ let initDebugger = Task.async(function*(urlOrTab, options) {
|
|||
info("Debugee tab added successfully: " + urlOrTab);
|
||||
|
||||
let debuggee = tab.linkedBrowser.contentWindowAsCPOW.wrappedJSObject;
|
||||
let target = yield TargetFactory.forTab(tab);
|
||||
let target = TargetFactory.forTab(tab);
|
||||
|
||||
let toolbox = yield gDevTools.showToolbox(target, "jsdebugger");
|
||||
info("Debugger panel shown successfully.");
|
||||
|
@ -639,7 +639,7 @@ AddonDebugger.prototype = {
|
|||
customIframe: this.frame
|
||||
};
|
||||
|
||||
this.target = yield TargetFactory.forRemoteTab(targetOptions);
|
||||
this.target = TargetFactory.forTab(targetOptions);
|
||||
let toolbox = yield gDevTools.showToolbox(this.target, "jsdebugger", Toolbox.HostType.CUSTOM, toolboxOptions);
|
||||
|
||||
info("Addon debugger panel shown successfully.");
|
||||
|
@ -1085,9 +1085,9 @@ function findTab(tabs, url) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function attachTarget(client, tab) {
|
||||
function attachTab(client, tab) {
|
||||
info("Attaching to tab with url '" + tab.url + "'.");
|
||||
return client.attachTarget(tab.actor);
|
||||
return client.attachTab(tab.actor);
|
||||
}
|
||||
|
||||
function listWorkers(tabClient) {
|
||||
|
@ -1297,7 +1297,7 @@ async function initWorkerDebugger(TAB_URL, WORKER_URL) {
|
|||
|
||||
let tab = await addTab(TAB_URL);
|
||||
let { tabs } = await listTabs(client);
|
||||
let [, tabClient] = await attachTarget(client, findTab(tabs, TAB_URL));
|
||||
let [, tabClient] = await attachTab(client, findTab(tabs, TAB_URL));
|
||||
|
||||
await createWorkerInTab(tab, WORKER_URL);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ DomPanel.prototype = {
|
|||
|
||||
// Local monitoring needs to make the target remote.
|
||||
if (!this.target.isRemote) {
|
||||
await this.target.attach();
|
||||
await this.target.makeRemote();
|
||||
}
|
||||
|
||||
this.initialize();
|
||||
|
|
|
@ -62,11 +62,14 @@ function addTestTab(url) {
|
|||
* The default tab is taken from the global variable |tab|.
|
||||
* @return a promise that is resolved once the web console is open.
|
||||
*/
|
||||
async function initDOMPanel(tab) {
|
||||
const target = await TargetFactory.forTab(tab || gBrowser.selectedTab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "dom");
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
return panel;
|
||||
function initDOMPanel(tab) {
|
||||
return new Promise(resolve => {
|
||||
const target = TargetFactory.forTab(tab || gBrowser.selectedTab);
|
||||
gDevTools.showToolbox(target, "dom").then(toolbox => {
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
resolve(panel);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,15 +78,11 @@ function createToolMenuElements(toolDefinition, doc) {
|
|||
return;
|
||||
}
|
||||
|
||||
const oncommand = (async function(id, event) {
|
||||
try {
|
||||
const window = event.target.ownerDocument.defaultView;
|
||||
await gDevToolsBrowser.selectToolCommand(window.gBrowser, id, Cu.now());
|
||||
sendEntryPointTelemetry();
|
||||
} catch (e) {
|
||||
console.error(`Exception while opening ${id}: ${e}\n${e.stack}`);
|
||||
}
|
||||
}).bind(null, id);
|
||||
const oncommand = function(id, event) {
|
||||
const window = event.target.ownerDocument.defaultView;
|
||||
gDevToolsBrowser.selectToolCommand(window.gBrowser, id, Cu.now());
|
||||
sendEntryPointTelemetry();
|
||||
}.bind(null, id);
|
||||
|
||||
const menuitem = createMenuItem({
|
||||
doc,
|
||||
|
|
|
@ -58,8 +58,8 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
* of there
|
||||
*/
|
||||
// used by browser-sets.inc, command
|
||||
async toggleToolboxCommand(gBrowser, startTime) {
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
toggleToolboxCommand(gBrowser, startTime) {
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const toolbox = gDevTools.getToolbox(target);
|
||||
|
||||
// If a toolbox exists, using toggle from the Main window :
|
||||
|
@ -202,8 +202,8 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
*/
|
||||
// Used when: - registering a new tool
|
||||
// - new xul window, to add menu items
|
||||
async selectToolCommand(gBrowser, toolId, startTime) {
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
selectToolCommand(gBrowser, toolId, startTime) {
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const toolbox = gDevTools.getToolbox(target);
|
||||
const toolDefinition = gDevTools.getToolDefinition(toolId);
|
||||
|
||||
|
@ -243,17 +243,17 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
* Optional, indicates the time at which the key event fired. This is a
|
||||
* `Cu.now()` timing.
|
||||
*/
|
||||
async onKeyShortcut(window, key, startTime) {
|
||||
onKeyShortcut(window, key, startTime) {
|
||||
// If this is a toolbox's panel key shortcut, delegate to selectToolCommand
|
||||
if (key.toolId) {
|
||||
await gDevToolsBrowser.selectToolCommand(window.gBrowser, key.toolId, startTime);
|
||||
gDevToolsBrowser.selectToolCommand(window.gBrowser, key.toolId, startTime);
|
||||
return;
|
||||
}
|
||||
// Otherwise implement all other key shortcuts individually here
|
||||
switch (key.id) {
|
||||
case "toggleToolbox":
|
||||
case "toggleToolboxF12":
|
||||
await gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, startTime);
|
||||
gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, startTime);
|
||||
break;
|
||||
case "webide":
|
||||
gDevToolsBrowser.openWebIDE();
|
||||
|
@ -274,7 +274,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
ScratchpadManager.openScratchpad();
|
||||
break;
|
||||
case "inspectorMac":
|
||||
await gDevToolsBrowser.selectToolCommand(window.gBrowser, "inspector", startTime);
|
||||
gDevToolsBrowser.selectToolCommand(window.gBrowser, "inspector", startTime);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
@ -481,8 +481,8 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
const debugService = Cc["@mozilla.org/dom/slow-script-debug;1"]
|
||||
.getService(Ci.nsISlowScriptDebug);
|
||||
|
||||
async function slowScriptDebugHandler(tab, callback) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
function slowScriptDebugHandler(tab, callback) {
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
gDevTools.showToolbox(target, "jsdebugger").then(toolbox => {
|
||||
const threadClient = toolbox.threadClient;
|
||||
|
@ -544,7 +544,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
|
||||
slowScriptDebugHandler(tab, function() {
|
||||
callback.finishDebuggerStartup();
|
||||
}).catch(console.error);
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ const Services = require("Services");
|
|||
const {DevToolsShim} = require("chrome://devtools-startup/content/DevToolsShim.jsm");
|
||||
|
||||
loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true);
|
||||
loader.lazyRequireGetter(this, "TabTarget", "devtools/client/framework/target", true);
|
||||
loader.lazyRequireGetter(this, "ToolboxHostManager", "devtools/client/framework/toolbox-host-manager", true);
|
||||
loader.lazyRequireGetter(this, "HUDService", "devtools/client/webconsole/hudservice", true);
|
||||
loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry");
|
||||
|
@ -619,7 +620,7 @@ DevTools.prototype = {
|
|||
* cached instances managed by DevTools target factory.
|
||||
*/
|
||||
createTargetForTab: function(tab) {
|
||||
return TargetFactory.createTargetForTab(tab);
|
||||
return new TabTarget(tab);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -691,7 +692,7 @@ DevTools.prototype = {
|
|||
* markup view.
|
||||
*/
|
||||
async inspectNode(tab, nodeSelectors, startTime) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
const toolbox = await gDevTools.showToolbox(target, "inspector", null, null,
|
||||
startTime, "inspect_dom");
|
||||
|
@ -731,7 +732,7 @@ DevTools.prototype = {
|
|||
* selected in the accessibility inspector.
|
||||
*/
|
||||
async inspectA11Y(tab, nodeSelectors, startTime) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
const toolbox = await gDevTools.showToolbox(
|
||||
target, "accessibility", null, null, startTime);
|
||||
|
|
|
@ -20,84 +20,22 @@ const promiseTargets = new WeakMap();
|
|||
* Functions for creating Targets
|
||||
*/
|
||||
const TargetFactory = exports.TargetFactory = {
|
||||
|
||||
/**
|
||||
* Construct a Target. The target will be cached for each Tab so that we create only
|
||||
* one per tab.
|
||||
*
|
||||
* Construct a Target
|
||||
* @param {XULTab} tab
|
||||
* The tab to use in creating a new target.
|
||||
*
|
||||
* @return A target object
|
||||
*/
|
||||
forTab: async function(tab) {
|
||||
forTab: function(tab) {
|
||||
let target = targets.get(tab);
|
||||
if (target) {
|
||||
return target;
|
||||
if (target == null) {
|
||||
target = new TabTarget(tab);
|
||||
targets.set(tab, target);
|
||||
}
|
||||
const promise = this.createTargetForTab(tab);
|
||||
// Immediately set the target's promise in cache to prevent race
|
||||
targets.set(tab, promise);
|
||||
target = await promise;
|
||||
// Then replace the promise with the target object
|
||||
targets.set(tab, target);
|
||||
return target;
|
||||
},
|
||||
|
||||
/**
|
||||
* Instantiate a target for the given tab.
|
||||
*
|
||||
* This will automatically:
|
||||
* - spawn a DebuggerServer in the parent process,
|
||||
* - create a DebuggerClient and connect it to this local DebuggerServer,
|
||||
* - call RootActor's `getTab` request to retrieve the FrameTargetActor's form,
|
||||
* - instantiate a TabTarget instance.
|
||||
*
|
||||
* @param {XULTab} tab
|
||||
* The tab to use in creating a new target.
|
||||
*
|
||||
* @return A target object
|
||||
*/
|
||||
async createTargetForTab(tab) {
|
||||
function createLocalServer() {
|
||||
// Since a remote protocol connection will be made, let's start the
|
||||
// DebuggerServer here, once and for all tools.
|
||||
DebuggerServer.init();
|
||||
|
||||
// When connecting to a local tab, we only need the root actor.
|
||||
// Then we are going to call DebuggerServer.connectToFrame and talk
|
||||
// directly with actors living in the child process.
|
||||
// We also need browser actors for actor registry which enabled addons
|
||||
// to register custom actors.
|
||||
// TODO: the comment and implementation are out of sync here. See Bug 1420134.
|
||||
DebuggerServer.registerAllActors();
|
||||
// Enable being able to get child process actors
|
||||
DebuggerServer.allowChromeProcess = true;
|
||||
}
|
||||
|
||||
function createLocalClient() {
|
||||
return new DebuggerClient(DebuggerServer.connectPipe());
|
||||
}
|
||||
|
||||
createLocalServer();
|
||||
const client = createLocalClient();
|
||||
|
||||
// Connect the local client to the local server
|
||||
await client.connect();
|
||||
|
||||
// Fetch the FrameTargetActor form
|
||||
const response = await client.getTab({ tab });
|
||||
|
||||
return new TabTarget({
|
||||
client,
|
||||
form: response.tab,
|
||||
// A local TabTarget will never perform chrome debugging.
|
||||
chrome: false,
|
||||
isBrowsingContext: true,
|
||||
tab,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a promise of a Target for a remote tab.
|
||||
* @param {Object} options
|
||||
|
@ -115,7 +53,7 @@ const TargetFactory = exports.TargetFactory = {
|
|||
let targetPromise = promiseTargets.get(options);
|
||||
if (targetPromise == null) {
|
||||
const target = new TabTarget(options);
|
||||
targetPromise = target.attach().then(() => target);
|
||||
targetPromise = target.makeRemote().then(() => target);
|
||||
promiseTargets.set(options, targetPromise);
|
||||
}
|
||||
return targetPromise;
|
||||
|
@ -173,52 +111,32 @@ const TargetFactory = exports.TargetFactory = {
|
|||
*/
|
||||
|
||||
/**
|
||||
* A TabTarget represents a debuggable context. It can be a browser tab, a tab on
|
||||
* a remote device, like a tab on Firefox for Android. But it can also be an add-on,
|
||||
* as well as firefox parent process, or just one of its content process.
|
||||
* A TabTarget is related to a given TargetActor, for which we pass the form as
|
||||
* argument.
|
||||
*
|
||||
* For now, only workers are having a distinct Target class called WorkerTarget.
|
||||
*
|
||||
* @param {Object} form
|
||||
* The TargetActor's form to be connected to.
|
||||
* @param {DebuggerClient} client
|
||||
* The DebuggerClient instance to be used to debug this target.
|
||||
* @param {Boolean} chrome
|
||||
* True, if we allow to see privileged resources like JSM, xpcom,
|
||||
* frame scripts...
|
||||
* @param {Boolean} isBrowsingContext (optional)
|
||||
* To be set to True if the Target actor inherits from BrowsingContextActor.
|
||||
* This argument is considered to be True is not passed.
|
||||
* @param {xul:tab} tab (optional)
|
||||
* If the target is a local Firefox tab, a reference to the firefox
|
||||
* frontend tab object.
|
||||
* A TabTarget represents a page living in a browser tab. Generally these will
|
||||
* be web pages served over http(s), but they don't have to be.
|
||||
*/
|
||||
function TabTarget({ form, client, chrome, isBrowsingContext = true, tab = null }) {
|
||||
function TabTarget(tab) {
|
||||
EventEmitter.decorate(this);
|
||||
this.destroy = this.destroy.bind(this);
|
||||
this.activeTab = this.activeConsole = null;
|
||||
|
||||
this._form = form;
|
||||
this._url = form.url;
|
||||
this._title = form.title;
|
||||
|
||||
this._client = client;
|
||||
this._chrome = chrome;
|
||||
|
||||
// When debugging local tabs, we also have a reference to the Firefox tab
|
||||
// This is used to:
|
||||
// * distinguish local tabs from remote (see target.isLocalTab)
|
||||
// * being able to hookup into Firefox UI (see Hosts)
|
||||
if (tab) {
|
||||
// Only real tabs need initialization here. Placeholder objects for remote
|
||||
// targets will be initialized after a makeRemote method call.
|
||||
if (tab && !["client", "form", "chrome"].every(tab.hasOwnProperty, tab)) {
|
||||
this._tab = tab;
|
||||
this._setupListeners();
|
||||
} else {
|
||||
this._form = tab.form;
|
||||
this._url = this._form.url;
|
||||
this._title = this._form.title;
|
||||
|
||||
this._client = tab.client;
|
||||
this._chrome = tab.chrome;
|
||||
}
|
||||
|
||||
// Default isBrowsingContext to true if not explicitly specified
|
||||
this._isBrowsingContext = isBrowsingContext;
|
||||
|
||||
if (typeof tab.isBrowsingContext == "boolean") {
|
||||
this._isBrowsingContext = tab.isBrowsingContext;
|
||||
} else {
|
||||
this._isBrowsingContext = true;
|
||||
}
|
||||
// Cache of already created targed-scoped fronts
|
||||
// [typeName:string => Front instance]
|
||||
this.fronts = new Map();
|
||||
|
@ -462,68 +380,105 @@ TabTarget.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Attach the target and its console actor.
|
||||
*
|
||||
* This method will mainly call `attach` request on the target actor as well
|
||||
* as the console actor.
|
||||
* For webextension, it also preliminary converts addonTargetActor to a
|
||||
* WebExtensionTargetActor.
|
||||
* Adds remote protocol capabilities to the target, so that it can be used
|
||||
* for tools that support the Remote Debugging Protocol even for local
|
||||
* connections.
|
||||
*/
|
||||
attach() {
|
||||
if (this._attach) {
|
||||
return this._attach;
|
||||
makeRemote: async function() {
|
||||
if (this._remote) {
|
||||
return this._remote;
|
||||
}
|
||||
|
||||
// Attach the target actor
|
||||
const attachTarget = async () => {
|
||||
const [response, tabClient] = await this._client.attachTarget(this._form.actor);
|
||||
this.activeTab = tabClient;
|
||||
this.threadActor = response.threadActor;
|
||||
};
|
||||
if (this.isLocalTab) {
|
||||
// Since a remote protocol connection will be made, let's start the
|
||||
// DebuggerServer here, once and for all tools.
|
||||
DebuggerServer.init();
|
||||
|
||||
// Attach the console actor
|
||||
const attachConsole = async () => {
|
||||
const [, consoleClient] = await this._client.attachConsole(
|
||||
this._form.consoleActor, []);
|
||||
this.activeConsole = consoleClient;
|
||||
// When connecting to a local tab, we only need the root actor.
|
||||
// Then we are going to call DebuggerServer.connectToFrame and talk
|
||||
// directly with actors living in the child process.
|
||||
// We also need browser actors for actor registry which enabled addons
|
||||
// to register custom actors.
|
||||
// TODO: the comment and implementation are out of sync here. See Bug 1420134.
|
||||
DebuggerServer.registerAllActors();
|
||||
// Enable being able to get child process actors
|
||||
DebuggerServer.allowChromeProcess = true;
|
||||
|
||||
this._onInspectObject = packet => this.emit("inspect-object", packet);
|
||||
this.activeConsole.on("inspectObject", this._onInspectObject);
|
||||
};
|
||||
|
||||
this._attach = (async () => {
|
||||
if (this._form.isWebExtension &&
|
||||
this._client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
// A local TabTarget will never perform chrome debugging.
|
||||
this._chrome = false;
|
||||
} else if (this._form.isWebExtension &&
|
||||
this.client.mainRoot.traits.webExtensionAddonConnect) {
|
||||
// The addonTargetActor form is related to a WebExtensionActor instance,
|
||||
// which isn't a target actor on its own, it is an actor living in the parent
|
||||
// process with access to the addon metadata, it can control the addon (e.g.
|
||||
// reloading it) and listen to the AddonManager events related to the lifecycle of
|
||||
// the addon (e.g. when the addon is disabled or uninstalled).
|
||||
// To retrieve the target actor instance, we call its "connect" method, (which
|
||||
// fetches the target actor form from a WebExtensionTargetActor instance).
|
||||
const {form} = await this._client.request({
|
||||
to: this._form.actor, type: "connect",
|
||||
});
|
||||
// The addonTargetActor form is related to a WebExtensionActor instance,
|
||||
// which isn't a target actor on its own, it is an actor living in the parent
|
||||
// process with access to the addon metadata, it can control the addon (e.g.
|
||||
// reloading it) and listen to the AddonManager events related to the lifecycle of
|
||||
// the addon (e.g. when the addon is disabled or uninstalled).
|
||||
// To retrieve the target actor instance, we call its "connect" method, (which
|
||||
// fetches the target actor form from a WebExtensionTargetActor instance).
|
||||
const {form} = await this._client.request({
|
||||
to: this._form.actor, type: "connect",
|
||||
});
|
||||
|
||||
this._form = form;
|
||||
this._url = form.url;
|
||||
this._title = form.title;
|
||||
this._form = form;
|
||||
this._url = form.url;
|
||||
this._title = form.title;
|
||||
}
|
||||
|
||||
this._setupRemoteListeners();
|
||||
|
||||
this._remote = new Promise((resolve, reject) => {
|
||||
const attachTab = async () => {
|
||||
try {
|
||||
const [response, tabClient] = await this._client.attachTab(this._form.actor);
|
||||
this.activeTab = tabClient;
|
||||
this.threadActor = response.threadActor;
|
||||
} catch (e) {
|
||||
reject("Unable to attach to the tab: " + e);
|
||||
return;
|
||||
}
|
||||
attachConsole();
|
||||
};
|
||||
|
||||
const onConsoleAttached = ([response, consoleClient]) => {
|
||||
this.activeConsole = consoleClient;
|
||||
|
||||
this._onInspectObject = packet => this.emit("inspect-object", packet);
|
||||
this.activeConsole.on("inspectObject", this._onInspectObject);
|
||||
|
||||
resolve(null);
|
||||
};
|
||||
|
||||
const attachConsole = () => {
|
||||
this._client.attachConsole(this._form.consoleActor, [])
|
||||
.then(onConsoleAttached, response => {
|
||||
reject(
|
||||
`Unable to attach to the console [${response.error}]: ${response.message}`);
|
||||
});
|
||||
};
|
||||
|
||||
if (this.isLocalTab) {
|
||||
this._client.connect()
|
||||
.then(() => this._client.getTab({tab: this.tab}))
|
||||
.then(response => {
|
||||
this._form = response.tab;
|
||||
this._url = this._form.url;
|
||||
this._title = this._form.title;
|
||||
|
||||
attachTab();
|
||||
}, e => reject(e));
|
||||
} else if (this.isBrowsingContext) {
|
||||
// In the remote debugging case, the protocol connection will have been
|
||||
// already initialized in the connection screen code.
|
||||
attachTab();
|
||||
} else {
|
||||
// AddonActor and chrome debugging on RootActor doesn't inherit from
|
||||
// BrowsingContextTargetActor and doesn't need to be attached.
|
||||
attachConsole();
|
||||
}
|
||||
});
|
||||
|
||||
this._setupRemoteListeners();
|
||||
|
||||
// AddonActor and chrome debugging on RootActor don't inherit from
|
||||
// BrowsingContextTargetActor (i.e. this.isBrowsingContext=false) and don't need
|
||||
// to be attached.
|
||||
if (this.isBrowsingContext) {
|
||||
await attachTarget();
|
||||
}
|
||||
|
||||
// But all target actor have a console actor to attach
|
||||
return attachConsole();
|
||||
})();
|
||||
|
||||
return this._attach;
|
||||
return this._remote;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -539,9 +494,7 @@ TabTarget.prototype = {
|
|||
* Teardown event listeners.
|
||||
*/
|
||||
_teardownListeners: function() {
|
||||
if (this._tab.ownerDocument.defaultView) {
|
||||
this._tab.ownerDocument.defaultView.removeEventListener("unload", this);
|
||||
}
|
||||
this._tab.ownerDocument.defaultView.removeEventListener("unload", this);
|
||||
this._tab.removeEventListener("TabClose", this);
|
||||
this._tab.removeEventListener("TabRemotenessChange", this);
|
||||
},
|
||||
|
@ -645,14 +598,14 @@ TabTarget.prototype = {
|
|||
|
||||
// Save a reference to the tab as it will be nullified on destroy
|
||||
const tab = this._tab;
|
||||
const onToolboxDestroyed = async (target) => {
|
||||
const onToolboxDestroyed = target => {
|
||||
if (target != this) {
|
||||
return;
|
||||
}
|
||||
gDevTools.off("toolbox-destroyed", target);
|
||||
|
||||
// Recreate a fresh target instance as the current one is now destroyed
|
||||
const newTarget = await TargetFactory.forTab(tab);
|
||||
const newTarget = TargetFactory.forTab(tab);
|
||||
gDevTools.showToolbox(newTarget);
|
||||
};
|
||||
gDevTools.on("toolbox-destroyed", onToolboxDestroyed);
|
||||
|
@ -728,7 +681,7 @@ TabTarget.prototype = {
|
|||
this._client = null;
|
||||
this._tab = null;
|
||||
this._form = null;
|
||||
this._attach = null;
|
||||
this._remote = null;
|
||||
this._root = null;
|
||||
this._title = null;
|
||||
this._url = null;
|
||||
|
@ -842,7 +795,7 @@ WorkerTarget.prototype = {
|
|||
return undefined;
|
||||
},
|
||||
|
||||
attach: function() {
|
||||
makeRemote: function() {
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function test() {
|
|||
}
|
||||
|
||||
// Test scenario 1: the tool definition build method returns a promise.
|
||||
async function runTests1(tab) {
|
||||
function runTests1(tab) {
|
||||
const toolDefinition = {
|
||||
id: toolId1,
|
||||
isTargetSupported: () => true,
|
||||
|
@ -36,7 +36,7 @@ async function runTests1(tab) {
|
|||
ok(gDevTools.getToolDefinitionMap().has(toolId1),
|
||||
"The tool is registered");
|
||||
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
||||
const events = {};
|
||||
|
||||
|
@ -76,7 +76,7 @@ async function runTests1(tab) {
|
|||
}
|
||||
|
||||
// Test scenario 2: the tool definition build method returns panel instance.
|
||||
async function runTests2() {
|
||||
function runTests2() {
|
||||
const toolDefinition = {
|
||||
id: toolId2,
|
||||
isTargetSupported: () => true,
|
||||
|
@ -95,7 +95,7 @@ async function runTests2() {
|
|||
ok(gDevTools.getToolDefinitionMap().has(toolId2),
|
||||
"The tool is registered");
|
||||
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
||||
const events = {};
|
||||
|
||||
|
@ -183,8 +183,8 @@ var continueTests = async function(toolbox, panel) {
|
|||
};
|
||||
|
||||
function destroyToolbox(toolbox) {
|
||||
toolbox.destroy().then(async function() {
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
toolbox.destroy().then(function() {
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
ok(gDevTools._toolboxes.get(target) == null, "gDevTools doesn't know about target");
|
||||
ok(toolbox.target == null, "toolbox doesn't know about target.");
|
||||
finishUp();
|
||||
|
|
|
@ -9,7 +9,7 @@ function test() {
|
|||
addTab("about:blank").then(runTests);
|
||||
}
|
||||
|
||||
async function runTests(aTab) {
|
||||
function runTests(aTab) {
|
||||
const toolDefinition = {
|
||||
id: "testTool",
|
||||
visibilityswitch: "devtools.testTool.enabled",
|
||||
|
@ -34,7 +34,7 @@ async function runTests(aTab) {
|
|||
|
||||
const collectedEvents = [];
|
||||
|
||||
const target = await TargetFactory.forTab(aTab);
|
||||
const target = TargetFactory.forTab(aTab);
|
||||
gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) {
|
||||
const panel = toolbox.getPanel(toolDefinition.id);
|
||||
ok(panel, "Tool open");
|
||||
|
|
|
@ -15,7 +15,7 @@ add_task(async function() {
|
|||
await pushPref("devtools.testing", false);
|
||||
|
||||
let tab = await addTab(URL_ROOT + "doc_viewsource.html");
|
||||
let target = await TargetFactory.forTab(tab);
|
||||
let target = TargetFactory.forTab(tab);
|
||||
let toolbox = await gDevTools.showToolbox(target, "styleeditor");
|
||||
let panel = toolbox.getPanel("styleeditor");
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function getZoomValue() {
|
|||
add_task(async function() {
|
||||
info("Create a test tab and open the toolbox");
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
|
||||
const {RIGHT, BOTTOM} = Toolbox.HostType;
|
||||
|
|
|
@ -18,7 +18,7 @@ const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"
|
|||
add_task(async function() {
|
||||
info("Create a test tab and open the toolbox");
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
|
||||
const shortcut = L10N.getStr("toolbox.toggleHost.key");
|
||||
|
|
|
@ -14,7 +14,7 @@ const MenuItem = require("devtools/client/framework/menu-item");
|
|||
add_task(async function() {
|
||||
info("Create a test tab and open the toolbox");
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
|
||||
await testMenuItems();
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
var toolbox, target;
|
||||
|
||||
function test() {
|
||||
addTab("about:blank").then(async function(aTab) {
|
||||
target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
addTab("about:blank").then(function(aTab) {
|
||||
target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
loadWebConsole(aTab).then(function() {
|
||||
console.log("loaded");
|
||||
});
|
||||
|
@ -45,9 +45,9 @@ function selectAndCheckById(id) {
|
|||
}
|
||||
|
||||
function testToggle() {
|
||||
toolbox.once("destroyed", async () => {
|
||||
toolbox.once("destroyed", () => {
|
||||
// Cannot reuse a target after it's destroyed.
|
||||
target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
gDevTools.showToolbox(target, "styleeditor").then(function(aToolbox) {
|
||||
toolbox = aToolbox;
|
||||
is(toolbox.currentToolId, "styleeditor", "The style editor is selected");
|
||||
|
|
|
@ -5,8 +5,8 @@ add_task(async function() {
|
|||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
await target.attach();
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
await target.makeRemote();
|
||||
is(target.tab, gBrowser.selectedTab, "Target linked to the right tab.");
|
||||
|
||||
const willNavigate = once(target, "will-navigate");
|
||||
|
|
|
@ -10,7 +10,7 @@ var { WebAudioFront } =
|
|||
require("devtools/shared/fronts/webaudio");
|
||||
|
||||
async function testTarget(client, target) {
|
||||
await target.attach();
|
||||
await target.makeRemote();
|
||||
|
||||
is(target.hasActor("timeline"), true, "target.hasActor() true when actor exists.");
|
||||
is(target.hasActor("webaudio"), true, "target.hasActor() true when actor exists.");
|
||||
|
|
|
@ -30,7 +30,7 @@ add_task(async function() {
|
|||
document.documentElement.appendChild(iframe);
|
||||
|
||||
const tab = await addTab(TEST_URL);
|
||||
let target = await TargetFactory.forTab(tab);
|
||||
let target = TargetFactory.forTab(tab);
|
||||
const options = { customIframe: iframe };
|
||||
let toolbox = await gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options);
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ const TEST_URL = "data:text/html,test for dynamically registering and unregister
|
|||
var toolbox;
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URL).then(async tab => {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
addTab(TEST_URL).then(tab => {
|
||||
const target = TargetFactory.forTab(tab);
|
||||
gDevTools.showToolbox(target).then(testRegister);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ const URL = "data:text/html;charset=utf8,test for getPanelWhenReady";
|
|||
|
||||
add_task(async function() {
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
toolbox = await gDevTools.showToolbox(target);
|
||||
|
||||
const debuggerPanelPromise = toolbox.getPanelWhenReady("jsdebugger");
|
||||
|
|
|
@ -17,7 +17,7 @@ function test() {
|
|||
const TOOL_ID_2 = "webconsole";
|
||||
await addTab(URL);
|
||||
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
toolbox = await gDevTools.showToolbox(target, TOOL_ID_1, Toolbox.HostType.BOTTOM);
|
||||
|
||||
// select tool 2
|
||||
|
|
|
@ -14,7 +14,7 @@ const URL = "data:text/html;charset=utf8,test for opening toolbox in different h
|
|||
add_task(async function runTest() {
|
||||
info("Create a test tab and open the toolbox");
|
||||
const tab = await addTab(URL);
|
||||
target = await TargetFactory.forTab(tab);
|
||||
target = TargetFactory.forTab(tab);
|
||||
toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
|
||||
await testBottomHost();
|
||||
|
@ -95,7 +95,7 @@ async function testToolSelect() {
|
|||
|
||||
async function testDestroy() {
|
||||
await toolbox.destroy();
|
||||
target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
toolbox = await gDevTools.showToolbox(target);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@ add_task(async function() {
|
|||
const tab = await addTab(URL);
|
||||
const nbox = gBrowser.getNotificationBox();
|
||||
const {clientHeight: nboxHeight, clientWidth: nboxWidth} = nbox;
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target);
|
||||
const toolbox = await gDevTools.showToolbox(TargetFactory.forTab(tab));
|
||||
|
||||
is(nbox.clientHeight, nboxHeight, "Opening the toolbox hasn't changed the height of the nbox");
|
||||
is(nbox.clientWidth, nboxWidth, "Opening the toolbox hasn't changed the width of the nbox");
|
||||
|
@ -45,8 +44,7 @@ add_task(async function() {
|
|||
const tab = await addTab(URL);
|
||||
const nbox = gBrowser.getNotificationBox();
|
||||
const {clientHeight: nboxHeight, clientWidth: nboxWidth} = nbox;
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target);
|
||||
const toolbox = await gDevTools.showToolbox(TargetFactory.forTab(tab));
|
||||
|
||||
is(nbox.clientHeight, nboxHeight, "Opening the toolbox hasn't changed the height of the nbox");
|
||||
is(nbox.clientWidth, nboxWidth, "Opening the toolbox hasn't changed the width of the nbox");
|
||||
|
|
|
@ -15,7 +15,7 @@ add_task(async function() {
|
|||
|
||||
info("Create a test tab and open the toolbox");
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
|
||||
await changeToolboxHost(toolbox);
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function() {
|
|||
"and unregistering tools";
|
||||
registerNewTool();
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
toolbox = await gDevTools.showToolbox(target);
|
||||
|
||||
doc = toolbox.doc;
|
||||
|
|
|
@ -15,8 +15,8 @@ TEST_URL += "<iframe src=\"data:text/plain,iframe\"></iframe>";
|
|||
var doc = null, toolbox = null, panelWin = null, modifiedPrefs = [];
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URL).then(async (tab) => {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
addTab(TEST_URL).then(tab => {
|
||||
const target = TargetFactory.forTab(tab);
|
||||
gDevTools.showToolbox(target)
|
||||
.then(testSelectTool)
|
||||
.then(testToggleToolboxButtons)
|
||||
|
@ -25,13 +25,13 @@ function test() {
|
|||
});
|
||||
}
|
||||
|
||||
async function testPrefsAreRespectedWhenReopeningToolbox() {
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
function testPrefsAreRespectedWhenReopeningToolbox() {
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
||||
return new Promise(resolve => {
|
||||
info("Closing toolbox to test after reopening");
|
||||
gDevTools.closeToolbox(target).then(async () => {
|
||||
const tabTarget = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
gDevTools.closeToolbox(target).then(() => {
|
||||
const tabTarget = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
gDevTools.showToolbox(tabTarget)
|
||||
.then(testSelectTool)
|
||||
.then(() => {
|
||||
|
|
|
@ -36,7 +36,7 @@ add_task(async function() {
|
|||
|
||||
// Close toolbox in tab 2 and ensure the cache is enabled again
|
||||
await tabs[2].toolbox.destroy();
|
||||
tabs[2].target = await TargetFactory.forTab(tabs[2].tab);
|
||||
tabs[2].target = TargetFactory.forTab(tabs[2].tab);
|
||||
await checkCacheEnabled(tabs[2], true);
|
||||
|
||||
// Open toolbox in tab 2 and ensure the cache is then disabled.
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
const TEST_URI = URL_ROOT + "browser_toolbox_options_disable_js.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI).then(async (tab) => {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
addTab(TEST_URI).then(tab => {
|
||||
const target = TargetFactory.forTab(tab);
|
||||
gDevTools.showToolbox(target).then(testSelectTool);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ function test() {
|
|||
}
|
||||
|
||||
function init() {
|
||||
addTab(TEST_URI).then(async tab => {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
addTab(TEST_URI).then(tab => {
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const linkedBrowser = tab.linkedBrowser;
|
||||
|
||||
loadFrameScriptUtils(linkedBrowser);
|
||||
|
|
|
@ -16,7 +16,7 @@ add_task(async function() {
|
|||
await pushPref(FRAME_BUTTON_PREF, false);
|
||||
|
||||
const tab = await addTab(TEST_URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
info("Open the toolbox on the Options panel");
|
||||
const toolbox = await gDevTools.showToolbox(target, "options");
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function() {
|
|||
|
||||
async function openToolboxOptionsInNewTab() {
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target);
|
||||
const doc = toolbox.doc;
|
||||
const panel = await toolbox.selectTool("options");
|
||||
|
|
|
@ -10,9 +10,9 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
|
|||
var toolbox, tab1, tab2;
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URL).then(async (tab) => {
|
||||
addTab(TEST_URL).then(tab => {
|
||||
tab2 = BrowserTestUtils.addTab(gBrowser);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
gDevTools.showToolbox(target)
|
||||
.then(testBottomHost, console.error)
|
||||
.catch(console.error);
|
||||
|
|
|
@ -7,7 +7,7 @@ const TEST_URL = "data:text/html,test for toolbox being ready";
|
|||
|
||||
add_task(async function() {
|
||||
const tab = await addTab(TEST_URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
ok(toolbox.isReady, "toolbox isReady is set");
|
||||
|
|
|
@ -28,7 +28,7 @@ const testToolDefinition = {
|
|||
add_task(async function() {
|
||||
gDevTools.registerTool(testToolDefinition);
|
||||
let tab = await addTab("about:blank");
|
||||
let target = await TargetFactory.forTab(tab);
|
||||
let target = TargetFactory.forTab(tab);
|
||||
|
||||
let toolbox = await gDevTools.showToolbox(target, testToolDefinition.id);
|
||||
is(toolbox.currentToolId, "testTool", "test-tool was selected");
|
||||
|
@ -37,7 +37,7 @@ add_task(async function() {
|
|||
// Make the previously selected tool unavailable.
|
||||
testToolDefinition.isTargetSupported = () => false;
|
||||
|
||||
target = await TargetFactory.forTab(tab);
|
||||
target = TargetFactory.forTab(tab);
|
||||
toolbox = await gDevTools.showToolbox(target);
|
||||
is(toolbox.currentToolId, "webconsole", "web console was selected");
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ function test() {
|
|||
|
||||
gDevTools.registerTool(toolDefinition);
|
||||
|
||||
addTab("about:blank").then(async function(aTab) {
|
||||
const target = await TargetFactory.forTab(aTab);
|
||||
addTab("about:blank").then(function(aTab) {
|
||||
const target = TargetFactory.forTab(aTab);
|
||||
gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) {
|
||||
const panel = toolbox.getPanel(toolDefinition.id);
|
||||
panel.toolbox = toolbox;
|
||||
|
|
|
@ -33,8 +33,8 @@ function test() {
|
|||
|
||||
gDevTools.registerTool(toolDefinition);
|
||||
|
||||
addTab("about:blank").then(async function(aTab) {
|
||||
const target = await TargetFactory.forTab(aTab);
|
||||
addTab("about:blank").then(function(aTab) {
|
||||
const target = TargetFactory.forTab(aTab);
|
||||
gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) {
|
||||
const panel = toolbox.getPanel(toolDefinition.id);
|
||||
ok(true, "Tool open");
|
||||
|
|
|
@ -28,7 +28,7 @@ const testToolDefinition = {
|
|||
add_task(async function() {
|
||||
const tab = await addTab("about:blank");
|
||||
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
gDevTools.registerTool(testToolDefinition);
|
||||
const toolbox = await gDevTools.showToolbox(target, testToolDefinition.id);
|
||||
|
|
|
@ -28,7 +28,7 @@ const testToolDefinition = {
|
|||
|
||||
add_task(async function() {
|
||||
const tab = await addTab("about:blank");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
gDevTools.registerTool(testToolDefinition);
|
||||
const toolbox = await gDevTools.showToolbox(target, testToolDefinition.id);
|
||||
|
|
|
@ -16,7 +16,7 @@ const URL = "data:text/html;charset=utf8,test split console key delegation";
|
|||
|
||||
add_task(async function() {
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
gToolbox = await gDevTools.showToolbox(target, "jsdebugger");
|
||||
panelWin = gToolbox.getPanel("jsdebugger").panelWin;
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"
|
|||
|
||||
add_task(async function() {
|
||||
const tab = await addTab("about:blank");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const target = TargetFactory.forTab(tab);
|
||||
await target.makeRemote();
|
||||
|
||||
const toolIDs = gDevTools.getToolDefinitionArray()
|
||||
.filter(
|
||||
|
|
|
@ -59,7 +59,7 @@ add_task(async function() {
|
|||
ok(!snapshot.parent, "No events have been logged for the main process");
|
||||
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "inspector");
|
||||
|
||||
await toolbox.openSplitConsole();
|
||||
|
|
|
@ -49,7 +49,7 @@ add_task(async function() {
|
|||
|
||||
async function openAndCloseToolbox(toolId, host) {
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, toolId);
|
||||
|
||||
await toolbox.switchHost(host);
|
||||
|
|
|
@ -96,7 +96,7 @@ add_task(async function() {
|
|||
ok(!snapshot.parent, "No events have been logged for the main process");
|
||||
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
// Set up some cached messages for the web console.
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, () => {
|
||||
|
|
|
@ -83,7 +83,7 @@ add_task(async function() {
|
|||
ok(!snapshot.parent, "No events have been logged for the main process");
|
||||
|
||||
const tab = await addTab(URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
// Open the toolbox
|
||||
await gDevTools.showToolbox(target, "inspector");
|
||||
|
|
|
@ -14,7 +14,7 @@ var toolbox;
|
|||
|
||||
add_task(async function themeRegistration() {
|
||||
const tab = await addTab("data:text/html,test");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
toolbox = await gDevTools.showToolbox(target, "options");
|
||||
|
||||
const themeId = await new Promise(resolve => {
|
||||
|
|
|
@ -34,8 +34,7 @@ add_task(async function() {
|
|||
|
||||
async function testToggle(key, modifiers) {
|
||||
const tab = await addTab(URL + " ; key : '" + key + "'");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await gDevTools.showToolbox(target);
|
||||
await gDevTools.showToolbox(TargetFactory.forTab(tab));
|
||||
|
||||
await testToggleDockedToolbox(tab, key, modifiers);
|
||||
await testToggleDetachedToolbox(tab, key, modifiers);
|
||||
|
@ -44,7 +43,7 @@ async function testToggle(key, modifiers) {
|
|||
}
|
||||
|
||||
async function testToggleDockedToolbox(tab, key, modifiers) {
|
||||
const toolbox = await getToolboxForTab(tab);
|
||||
const toolbox = getToolboxForTab(tab);
|
||||
|
||||
isnot(toolbox.hostType, Toolbox.HostType.WINDOW,
|
||||
"Toolbox is docked in the main window");
|
||||
|
@ -63,7 +62,7 @@ async function testToggleDockedToolbox(tab, key, modifiers) {
|
|||
}
|
||||
|
||||
async function testToggleDetachedToolbox(tab, key, modifiers) {
|
||||
const toolbox = await getToolboxForTab(tab);
|
||||
const toolbox = getToolboxForTab(tab);
|
||||
|
||||
info("change the toolbox hostType to WINDOW");
|
||||
|
||||
|
@ -98,9 +97,8 @@ async function testToggleDetachedToolbox(tab, key, modifiers) {
|
|||
ok(true, "Toolbox destroyed");
|
||||
}
|
||||
|
||||
async function getToolboxForTab(tab) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
return gDevTools.getToolbox(target);
|
||||
function getToolboxForTab(tab) {
|
||||
return gDevTools.getToolbox(TargetFactory.forTab(tab));
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
|
|
|
@ -34,8 +34,8 @@ function test() {
|
|||
(async function() {
|
||||
toggleAllTools(true);
|
||||
const tab = await addTab("about:blank");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const target = TargetFactory.forTab(tab);
|
||||
await target.makeRemote();
|
||||
await performChecks(target);
|
||||
gBrowser.removeCurrentTab();
|
||||
toggleAllTools(false);
|
||||
|
|
|
@ -18,8 +18,8 @@ var toolbox;
|
|||
var target;
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URL).then(async (tab) => {
|
||||
target = await TargetFactory.forTab(tab);
|
||||
addTab(TEST_URL).then(tab => {
|
||||
target = TargetFactory.forTab(tab);
|
||||
|
||||
gDevTools.showToolbox(target)
|
||||
.then(toolboxRegister)
|
||||
|
|
|
@ -17,10 +17,10 @@ const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"
|
|||
var target, toolbox, description, reloadsSent, toolIDs;
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URL).then(async () => {
|
||||
target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
addTab(TEST_URL).then(() => {
|
||||
target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
||||
target.attach().then(() => {
|
||||
target.makeRemote().then(() => {
|
||||
toolIDs = gDevTools.getToolDefinitionArray()
|
||||
.filter(def => def.isTargetSupported(target))
|
||||
.map(def => def.id);
|
||||
|
|
|
@ -11,8 +11,8 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
|
|||
|
||||
var toolbox, toolIDs, toolShortcuts = [], idIndex, modifiedPrefs = [];
|
||||
|
||||
async function test() {
|
||||
addTab("about:blank").then(async function() {
|
||||
function test() {
|
||||
addTab("about:blank").then(function() {
|
||||
toolIDs = [];
|
||||
for (const [id, definition] of gDevTools._tools) {
|
||||
const shortcut = Startup.KeyShortcuts.filter(s => s.toolId == id)[0];
|
||||
|
@ -32,7 +32,7 @@ async function test() {
|
|||
}
|
||||
}
|
||||
}
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
idIndex = 0;
|
||||
gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.WINDOW)
|
||||
.then(testShortcuts);
|
||||
|
|
|
@ -21,8 +21,8 @@ function test() {
|
|||
|
||||
let toolbox;
|
||||
|
||||
addTab(URL_1).then(async function() {
|
||||
let target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
addTab(URL_1).then(function() {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM)
|
||||
.then(function(aToolbox) {
|
||||
toolbox = aToolbox;
|
||||
|
@ -69,9 +69,9 @@ function test() {
|
|||
// destroying the toolbox.
|
||||
executeSoon(function() {
|
||||
toolbox.destroy()
|
||||
.then(async function() {
|
||||
.then(function() {
|
||||
// After destroying the toolbox, a fresh target is required.
|
||||
target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
return gDevTools.showToolbox(target, null, Toolbox.HostType.WINDOW);
|
||||
})
|
||||
.then(function(aToolbox) {
|
||||
|
|
|
@ -21,7 +21,7 @@ add_task(async function() {
|
|||
Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true);
|
||||
|
||||
await addTab(URL);
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let toolbox = await gDevTools.showToolbox(target, null,
|
||||
Toolbox.HostType.BOTTOM);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ add_task(async function() {
|
|||
// This test assume that zoom value will be default value. i.e. x1.0.
|
||||
Services.prefs.setCharPref("devtools.toolbox.zoomValue", "1.0");
|
||||
await addTab("about:blank");
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const toolbox = await gDevTools.showToolbox(target,
|
||||
"styleeditor",
|
||||
Toolbox.HostType.BOTTOM);
|
||||
|
|
|
@ -20,7 +20,7 @@ add_task(async function() {
|
|||
|
||||
info("Load iframe page for checking the frame menu with x1.4 zoom.");
|
||||
await addTab(TEST_URL);
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const toolbox = await gDevTools.showToolbox(target,
|
||||
"inspector",
|
||||
Toolbox.HostType.WINDOW);
|
||||
|
|
|
@ -37,7 +37,7 @@ var tabs = [
|
|||
|
||||
async function initTab(tabX, startToolbox) {
|
||||
tabX.tab = await addTab(TEST_URI);
|
||||
tabX.target = await TargetFactory.forTab(tabX.tab);
|
||||
tabX.target = TargetFactory.forTab(tabX.tab);
|
||||
|
||||
if (startToolbox) {
|
||||
tabX.toolbox = await gDevTools.showToolbox(tabX.target, "options");
|
||||
|
|
|
@ -84,7 +84,7 @@ OptionsPanel.prototype = {
|
|||
async open() {
|
||||
// For local debugging we need to make the target remote.
|
||||
if (!this.target.isRemote) {
|
||||
await this.target.attach();
|
||||
await this.target.makeRemote();
|
||||
}
|
||||
|
||||
this.setupToolsList();
|
||||
|
@ -452,7 +452,7 @@ OptionsPanel.prototype = {
|
|||
}
|
||||
|
||||
if (this.target.activeTab && !this.target.chrome) {
|
||||
const [ response ] = await this.target.client.attachTarget(this.target.activeTab._actor);
|
||||
const [ response ] = await this.target.client.attachTab(this.target.activeTab._actor);
|
||||
this._origJavascriptEnabled = !response.javascriptEnabled;
|
||||
this.disableJSNode.checked = this._origJavascriptEnabled;
|
||||
this.disableJSNode.addEventListener("click", this._disableJSClicked);
|
||||
|
|
|
@ -447,7 +447,7 @@ Toolbox.prototype = {
|
|||
// the iframe being ready (makes startup faster)
|
||||
|
||||
// Load the toolbox-level actor fronts and utilities now
|
||||
await this._target.attach();
|
||||
await this._target.makeRemote();
|
||||
|
||||
// Start tracking network activity on toolbox open for targets such as tabs.
|
||||
// (Workers and potentially others don't manage the console client in the target.)
|
||||
|
|
|
@ -43,7 +43,7 @@ const openAnimationInspector = async function() {
|
|||
* @return {Promise} that resolves when the toolbox has closed.
|
||||
*/
|
||||
const closeAnimationInspector = async function() {
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
return gDevTools.closeToolbox(target);
|
||||
};
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ Inspector.prototype = {
|
|||
localizeMarkup(this.panelDoc);
|
||||
|
||||
this._cssProperties = await initCssProperties(this.toolbox);
|
||||
await this.target.attach();
|
||||
await this.target.makeRemote();
|
||||
await this._getPageStyle();
|
||||
|
||||
// This may throw if the document is still loading and we are
|
||||
|
|
|
@ -61,7 +61,7 @@ add_task(async function() {
|
|||
"changing the color preserved the unit for " + color.name);
|
||||
}
|
||||
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
await gDevTools.closeToolbox(target);
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
|
|
@ -32,7 +32,7 @@ add_task(async function() {
|
|||
await selectNode("#testid", inspector);
|
||||
await basicTest(view, name, result);
|
||||
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
await gDevTools.closeToolbox(target);
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ add_task(async function() {
|
|||
await checkFlexboxHighlighter();
|
||||
|
||||
info("Close the toolbox before reloading the tab.");
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
await gDevTools.closeToolbox(target);
|
||||
|
||||
await refreshTab();
|
||||
|
|
|
@ -27,7 +27,7 @@ add_task(async function() {
|
|||
await checkGridHighlighter();
|
||||
|
||||
info("Close the toolbox before reloading the tab");
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
await gDevTools.closeToolbox(target);
|
||||
|
||||
await refreshTab();
|
||||
|
|
|
@ -16,7 +16,7 @@ add_task(async function() {
|
|||
await addTab("data:text/html;charset=utf-8,test inspector destroy");
|
||||
|
||||
info("Open the toolbox on the debugger panel");
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "jsdebugger");
|
||||
|
||||
info("Switch to the inspector panel and immediately end the test");
|
||||
|
|
|
@ -35,7 +35,7 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
async function testToolboxInitialization(testActor, tab) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
info("Opening inspector with gDevTools.");
|
||||
const toolbox = await gDevTools.showToolbox(target, "inspector");
|
||||
|
@ -75,7 +75,7 @@ async function testContextMenuInitialization(testActor) {
|
|||
async function testContextMenuInspectorAlreadyOpen(testActor) {
|
||||
info("Changing node by clicking on 'Inspect Element' context menu item");
|
||||
|
||||
const inspector = await getActiveInspector();
|
||||
const inspector = getActiveInspector();
|
||||
ok(inspector, "Inspector is active");
|
||||
|
||||
await clickOnInspectMenuItem(testActor, "#closing");
|
||||
|
@ -86,9 +86,7 @@ async function testContextMenuInspectorAlreadyOpen(testActor) {
|
|||
}
|
||||
|
||||
async function testMarkupView(selector, inspector) {
|
||||
if (!inspector) {
|
||||
inspector = await getActiveInspector();
|
||||
}
|
||||
inspector = inspector || getActiveInspector();
|
||||
const nodeFront = await getNodeFront(selector, inspector);
|
||||
try {
|
||||
is(inspector.selection.nodeFront, nodeFront,
|
||||
|
@ -100,9 +98,7 @@ async function testMarkupView(selector, inspector) {
|
|||
}
|
||||
|
||||
async function testBreadcrumbs(selector, inspector) {
|
||||
if (!inspector) {
|
||||
inspector = await getActiveInspector();
|
||||
}
|
||||
inspector = inspector || getActiveInspector();
|
||||
const nodeFront = await getNodeFront(selector, inspector);
|
||||
|
||||
const b = inspector.breadcrumbs;
|
||||
|
|
|
@ -44,7 +44,7 @@ async function testContextMenuWithinIframe(testActor, nodeFrontGetter) {
|
|||
await clickOnInspectMenuItem(testActor, selector);
|
||||
|
||||
info("Checking inspector state.");
|
||||
const inspector = await getActiveInspector();
|
||||
const inspector = getActiveInspector();
|
||||
const nodeFront = await nodeFrontGetter(inspector);
|
||||
|
||||
is(inspector.selection.nodeFront, nodeFront,
|
||||
|
@ -52,7 +52,7 @@ async function testContextMenuWithinIframe(testActor, nodeFrontGetter) {
|
|||
}
|
||||
|
||||
async function changeToolboxToInnerFrame() {
|
||||
const { toolbox } = await getActiveInspector();
|
||||
const { toolbox } = getActiveInspector();
|
||||
|
||||
const btn = toolbox.doc.getElementById("command-button-frames");
|
||||
const panel = toolbox.doc.getElementById("command-button-frames-panel");
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
async function testToolboxInitialization(tab, inspector, toolbox) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
|
||||
ok(true, "Inspector started, and notification received.");
|
||||
ok(inspector, "Inspector instance is accessible.");
|
||||
|
|
|
@ -72,9 +72,9 @@ add_task(async function() {
|
|||
checkResults();
|
||||
});
|
||||
|
||||
async function openToolbox(tab) {
|
||||
function openToolbox(tab) {
|
||||
info("Opening webconsole.");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
return gDevTools.showToolbox(target, "webconsole");
|
||||
}
|
||||
|
||||
|
|
|
@ -183,8 +183,8 @@ var openInspectorForURL = async function(url, hostType) {
|
|||
return { tab, inspector, toolbox, testActor };
|
||||
};
|
||||
|
||||
async function getActiveInspector() {
|
||||
const target = await TargetFactory.forTab(gBrowser.selectedTab);
|
||||
function getActiveInspector() {
|
||||
const target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
return gDevTools.getToolbox(target).getPanel("inspector");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Services.prefs.setBoolPref("devtools.memory.enabled", true);
|
|||
*/
|
||||
this.openMemoryPanel = async function(tab) {
|
||||
info("Opening memory panel.");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "memory");
|
||||
info("Memory panel shown successfully.");
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
|
@ -37,7 +37,7 @@ this.openMemoryPanel = async function(tab) {
|
|||
*/
|
||||
this.closeMemoryPanel = async function(tab) {
|
||||
info("Closing memory panel.");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = gDevTools.getToolbox(target);
|
||||
await toolbox.destroy();
|
||||
info("Closed memory panel successfully.");
|
||||
|
|
|
@ -41,13 +41,9 @@ loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scrat
|
|||
exports.menuitems = [
|
||||
{ id: "menu_devToolbox",
|
||||
l10nKey: "devToolboxMenuItem",
|
||||
async oncommand(event) {
|
||||
try {
|
||||
const window = event.target.ownerDocument.defaultView;
|
||||
await gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, Cu.now());
|
||||
} catch (e) {
|
||||
console.error(`Exception while opening the toolbox: ${e}\n${e.stack}`);
|
||||
}
|
||||
oncommand(event) {
|
||||
const window = event.target.ownerDocument.defaultView;
|
||||
gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, Cu.now());
|
||||
},
|
||||
keyId: "toggleToolbox",
|
||||
checkbox: true
|
||||
|
@ -101,8 +97,8 @@ exports.menuitems = [
|
|||
l10nKey: "eyedropper",
|
||||
async oncommand(event) {
|
||||
const window = event.target.ownerDocument.defaultView;
|
||||
const target = await TargetFactory.forTab(window.gBrowser.selectedTab);
|
||||
await target.attach();
|
||||
const target = TargetFactory.forTab(window.gBrowser.selectedTab);
|
||||
await target.makeRemote();
|
||||
const inspectorFront = await target.getFront("inspector");
|
||||
inspectorFront.pickColorFromPage({copyOnSelect: true, fromMenu: true});
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@ function NetMonitorPanel(iframeWindow, toolbox) {
|
|||
NetMonitorPanel.prototype = {
|
||||
async open() {
|
||||
if (!this.toolbox.target.isRemote) {
|
||||
await this.toolbox.target.attach();
|
||||
await this.toolbox.target.makeRemote();
|
||||
}
|
||||
|
||||
// Reuse an existing Network monitor API object if available.
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче