Bug 1485676 - Connect to local server from TargetFactory.forTab and make TabTarget always remote-like. r=yulia

Tags: #secure-revision

Bug #: 1485676

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

MozReview-Commit-ID: JAwiySsBZBu
This commit is contained in:
Alexandre Poirot 2018-08-21 08:05:21 -07:00
Родитель b553b3b567
Коммит 48f5790c9b
120 изменённых файлов: 300 добавлений и 245 удалений

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

@ -79,7 +79,7 @@ add_task(async function test_devtools_panels_elements_onSelectionChanged() {
await extension.startup();
let target = devtools.TargetFactory.forTab(tab);
let target = await 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 = devtools.TargetFactory.forTab(tab);
let target = await devtools.TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "webconsole");
info("developer toolbox opened");

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

@ -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 = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "accessibility");
return toolbox.getCurrentPanel();
}

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

@ -47,7 +47,7 @@ function navigate(target, url, waitForTargetEvent = "navigate") {
async function openNewTabAndApplicationPanel(url) {
const tab = await addTab(url);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
const toolbox = await gDevTools.showToolbox(target, "application");

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

@ -127,15 +127,15 @@ 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.makeRemote();
const front = new CallWatcherFront(target.client, target.form);
return { target, front };
})();
@ -147,7 +147,7 @@ function initCanvasDebuggerBackend(aUrl) {
return (async function() {
const tab = await addTab(aUrl);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
@ -161,7 +161,7 @@ function initCanvasDebuggerFrontend(aUrl) {
return (async function() {
const tab = await addTab(aUrl);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();

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

@ -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 = TargetFactory.forTab(tab);
let target = await TargetFactory.forTab(tab);
let toolbox = await gDevTools.showToolbox(target, "jsdebugger");
return toolbox;
}

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

@ -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 = TargetFactory.forTab(tab);
const target = yield TargetFactory.forTab(tab);
const toolbox = yield gDevTools.showToolbox(target, "webconsole");
is(toolbox.currentToolId, "webconsole", "Console is the current panel");

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

@ -43,7 +43,7 @@ registerCleanupFunction(async function() {
while (gBrowser && gBrowser.tabs && gBrowser.tabs.length > 1) {
info("Destroying toolbox.");
let target = TargetFactory.forTab(gBrowser.selectedTab);
let target = await TargetFactory.forTab(gBrowser.selectedTab);
await gDevTools.closeToolbox(target);
info("Removing tab.");
@ -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 = TargetFactory.forTab(tab);
let target = yield TargetFactory.forTab(tab);
let toolbox = yield gDevTools.showToolbox(target, "jsdebugger");
info("Debugger panel shown successfully.");

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

@ -62,14 +62,11 @@ 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.
*/
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);
});
});
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;
}
/**

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

@ -481,8 +481,8 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
const debugService = Cc["@mozilla.org/dom/slow-script-debug;1"]
.getService(Ci.nsISlowScriptDebug);
function slowScriptDebugHandler(tab, callback) {
const target = TargetFactory.forTab(tab);
async function slowScriptDebugHandler(tab, callback) {
const target = await 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);
};
},

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

@ -691,7 +691,7 @@ DevTools.prototype = {
* markup view.
*/
async inspectNode(tab, nodeSelectors, startTime) {
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "inspector", null, null,
startTime, "inspect_dom");
@ -731,7 +731,7 @@ DevTools.prototype = {
* selected in the accessibility inspector.
*/
async inspectA11Y(tab, nodeSelectors, startTime) {
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(
target, "accessibility", null, null, startTime);

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

@ -20,22 +20,78 @@ const promiseTargets = new WeakMap();
* Functions for creating Targets
*/
const TargetFactory = exports.TargetFactory = {
/**
* Construct a Target
* Construct a Target. The target will be cached for each Tab so that we create only
* one per tab.
*
* @param {XULTab} tab
* The tab to use in creating a new target.
*
* @return A target object
*/
forTab: function(tab) {
forTab: async function(tab) {
let target = targets.get(tab);
if (target == null) {
target = new TabTarget(tab);
targets.set(tab, target);
if (target) {
return 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;
},
/**
* Constructor a target for the given tab.
*
* @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
@ -111,32 +167,52 @@ const TargetFactory = exports.TargetFactory = {
*/
/**
* 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.
* 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.
*/
function TabTarget(tab) {
function TabTarget({ form, client, chrome, isBrowsingContext = true, tab = null }) {
EventEmitter.decorate(this);
this.destroy = this.destroy.bind(this);
this.activeTab = this.activeConsole = null;
// 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._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) {
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
if (typeof tab.isBrowsingContext == "boolean") {
this._isBrowsingContext = tab.isBrowsingContext;
} else {
this._isBrowsingContext = true;
}
this._isBrowsingContext = isBrowsingContext;
// Cache of already created targed-scoped fronts
// [typeName:string => Front instance]
this.fronts = new Map();
@ -389,26 +465,8 @@ TabTarget.prototype = {
return this._remote;
}
if (this.isLocalTab) {
// 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;
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) {
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.
@ -457,17 +515,7 @@ TabTarget.prototype = {
});
};
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) {
if (this.isBrowsingContext) {
// In the remote debugging case, the protocol connection will have been
// already initialized in the connection screen code.
attachTab();
@ -494,7 +542,9 @@ TabTarget.prototype = {
* Teardown event listeners.
*/
_teardownListeners: function() {
this._tab.ownerDocument.defaultView.removeEventListener("unload", this);
if (this._tab.ownerDocument.defaultView) {
this._tab.ownerDocument.defaultView.removeEventListener("unload", this);
}
this._tab.removeEventListener("TabClose", this);
this._tab.removeEventListener("TabRemotenessChange", this);
},
@ -598,14 +648,14 @@ TabTarget.prototype = {
// Save a reference to the tab as it will be nullified on destroy
const tab = this._tab;
const onToolboxDestroyed = target => {
const onToolboxDestroyed = async (target) => {
if (target != this) {
return;
}
gDevTools.off("toolbox-destroyed", target);
// Recreate a fresh target instance as the current one is now destroyed
const newTarget = TargetFactory.forTab(tab);
const newTarget = await TargetFactory.forTab(tab);
gDevTools.showToolbox(newTarget);
};
gDevTools.on("toolbox-destroyed", onToolboxDestroyed);

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

@ -15,7 +15,7 @@ function test() {
}
// Test scenario 1: the tool definition build method returns a promise.
function runTests1(tab) {
async function runTests1(tab) {
const toolDefinition = {
id: toolId1,
isTargetSupported: () => true,
@ -36,7 +36,7 @@ function runTests1(tab) {
ok(gDevTools.getToolDefinitionMap().has(toolId1),
"The tool is registered");
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const events = {};
@ -76,7 +76,7 @@ function runTests1(tab) {
}
// Test scenario 2: the tool definition build method returns panel instance.
function runTests2() {
async function runTests2() {
const toolDefinition = {
id: toolId2,
isTargetSupported: () => true,
@ -95,7 +95,7 @@ function runTests2() {
ok(gDevTools.getToolDefinitionMap().has(toolId2),
"The tool is registered");
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const events = {};
@ -183,8 +183,8 @@ var continueTests = async function(toolbox, panel) {
};
function destroyToolbox(toolbox) {
toolbox.destroy().then(function() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
toolbox.destroy().then(async function() {
const target = await 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);
}
function runTests(aTab) {
async function runTests(aTab) {
const toolDefinition = {
id: "testTool",
visibilityswitch: "devtools.testTool.enabled",
@ -34,7 +34,7 @@ function runTests(aTab) {
const collectedEvents = [];
const target = TargetFactory.forTab(aTab);
const target = await 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 = TargetFactory.forTab(tab);
let target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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(function(aTab) {
target = TargetFactory.forTab(gBrowser.selectedTab);
addTab("about:blank").then(async function(aTab) {
target = await TargetFactory.forTab(gBrowser.selectedTab);
loadWebConsole(aTab).then(function() {
console.log("loaded");
});
@ -45,9 +45,9 @@ function selectAndCheckById(id) {
}
function testToggle() {
toolbox.once("destroyed", () => {
toolbox.once("destroyed", async () => {
// Cannot reuse a target after it's destroyed.
target = TargetFactory.forTab(gBrowser.selectedTab);
target = await TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, "styleeditor").then(function(aToolbox) {
toolbox = aToolbox;
is(toolbox.currentToolId, "styleeditor", "The style editor is selected");

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

@ -5,7 +5,7 @@ add_task(async function() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await target.makeRemote();
is(target.tab, gBrowser.selectedTab, "Target linked to the right tab.");

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

@ -30,7 +30,7 @@ add_task(async function() {
document.documentElement.appendChild(iframe);
const tab = await addTab(TEST_URL);
let target = TargetFactory.forTab(tab);
let target = await 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(tab => {
const target = TargetFactory.forTab(tab);
addTab(TEST_URL).then(async tab => {
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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 = TargetFactory.forTab(tab);
target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
target = await TargetFactory.forTab(gBrowser.selectedTab);
toolbox = await gDevTools.showToolbox(target);
}

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

@ -19,7 +19,8 @@ add_task(async function() {
const tab = await addTab(URL);
const nbox = gBrowser.getNotificationBox();
const {clientHeight: nboxHeight, clientWidth: nboxWidth} = nbox;
const toolbox = await gDevTools.showToolbox(TargetFactory.forTab(tab));
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target);
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");
@ -44,7 +45,8 @@ add_task(async function() {
const tab = await addTab(URL);
const nbox = gBrowser.getNotificationBox();
const {clientHeight: nboxHeight, clientWidth: nboxWidth} = nbox;
const toolbox = await gDevTools.showToolbox(TargetFactory.forTab(tab));
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target);
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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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(tab => {
const target = TargetFactory.forTab(tab);
addTab(TEST_URL).then(async (tab) => {
const target = await TargetFactory.forTab(tab);
gDevTools.showToolbox(target)
.then(testSelectTool)
.then(testToggleToolboxButtons)
@ -25,13 +25,13 @@ function test() {
});
}
function testPrefsAreRespectedWhenReopeningToolbox() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
async function testPrefsAreRespectedWhenReopeningToolbox() {
const target = await TargetFactory.forTab(gBrowser.selectedTab);
return new Promise(resolve => {
info("Closing toolbox to test after reopening");
gDevTools.closeToolbox(target).then(() => {
const tabTarget = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.closeToolbox(target).then(async () => {
const tabTarget = await 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 = TargetFactory.forTab(tabs[2].tab);
tabs[2].target = await 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(tab => {
const target = TargetFactory.forTab(tab);
addTab(TEST_URI).then(async (tab) => {
const target = await TargetFactory.forTab(tab);
gDevTools.showToolbox(target).then(testSelectTool);
});
}

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

@ -29,8 +29,8 @@ function test() {
}
function init() {
addTab(TEST_URI).then(tab => {
const target = TargetFactory.forTab(tab);
addTab(TEST_URI).then(async tab => {
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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(tab => {
addTab(TEST_URL).then(async (tab) => {
tab2 = BrowserTestUtils.addTab(gBrowser);
const target = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
let target = await 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 = TargetFactory.forTab(tab);
target = await 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(function(aTab) {
const target = TargetFactory.forTab(aTab);
addTab("about:blank").then(async function(aTab) {
const target = await 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(function(aTab) {
const target = TargetFactory.forTab(aTab);
addTab("about:blank").then(async function(aTab) {
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
gToolbox = await gDevTools.showToolbox(target, "jsdebugger");
panelWin = gToolbox.getPanel("jsdebugger").panelWin;

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

@ -14,7 +14,7 @@ const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"
add_task(async function() {
const tab = await addTab("about:blank");
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
const toolIDs = gDevTools.getToolDefinitionArray()

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

@ -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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
toolbox = await gDevTools.showToolbox(target, "options");
const themeId = await new Promise(resolve => {

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

@ -34,7 +34,8 @@ add_task(async function() {
async function testToggle(key, modifiers) {
const tab = await addTab(URL + " ; key : '" + key + "'");
await gDevTools.showToolbox(TargetFactory.forTab(tab));
const target = await TargetFactory.forTab(tab);
await gDevTools.showToolbox(target);
await testToggleDockedToolbox(tab, key, modifiers);
await testToggleDetachedToolbox(tab, key, modifiers);
@ -43,7 +44,7 @@ async function testToggle(key, modifiers) {
}
async function testToggleDockedToolbox(tab, key, modifiers) {
const toolbox = getToolboxForTab(tab);
const toolbox = await getToolboxForTab(tab);
isnot(toolbox.hostType, Toolbox.HostType.WINDOW,
"Toolbox is docked in the main window");
@ -62,7 +63,7 @@ async function testToggleDockedToolbox(tab, key, modifiers) {
}
async function testToggleDetachedToolbox(tab, key, modifiers) {
const toolbox = getToolboxForTab(tab);
const toolbox = await getToolboxForTab(tab);
info("change the toolbox hostType to WINDOW");
@ -97,8 +98,9 @@ async function testToggleDetachedToolbox(tab, key, modifiers) {
ok(true, "Toolbox destroyed");
}
function getToolboxForTab(tab) {
return gDevTools.getToolbox(TargetFactory.forTab(tab));
async function getToolboxForTab(tab) {
const target = await TargetFactory.forTab(tab);
return gDevTools.getToolbox(target);
}
function cleanup() {

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

@ -34,7 +34,7 @@ function test() {
(async function() {
toggleAllTools(true);
const tab = await addTab("about:blank");
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
await performChecks(target);
gBrowser.removeCurrentTab();

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

@ -18,8 +18,8 @@ var toolbox;
var target;
function test() {
addTab(TEST_URL).then(tab => {
target = TargetFactory.forTab(tab);
addTab(TEST_URL).then(async (tab) => {
target = await TargetFactory.forTab(tab);
gDevTools.showToolbox(target)
.then(toolboxRegister)

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

@ -17,8 +17,8 @@ const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"
var target, toolbox, description, reloadsSent, toolIDs;
function test() {
addTab(TEST_URL).then(() => {
target = TargetFactory.forTab(gBrowser.selectedTab);
addTab(TEST_URL).then(async () => {
target = await TargetFactory.forTab(gBrowser.selectedTab);
target.makeRemote().then(() => {
toolIDs = gDevTools.getToolDefinitionArray()

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

@ -11,8 +11,8 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
var toolbox, toolIDs, toolShortcuts = [], idIndex, modifiedPrefs = [];
function test() {
addTab("about:blank").then(function() {
async function test() {
addTab("about:blank").then(async function() {
toolIDs = [];
for (const [id, definition] of gDevTools._tools) {
const shortcut = Startup.KeyShortcuts.filter(s => s.toolId == id)[0];
@ -32,7 +32,7 @@ function test() {
}
}
}
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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(function() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
addTab(URL_1).then(async function() {
let target = await 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(function() {
.then(async function() {
// After destroying the toolbox, a fresh target is required.
target = TargetFactory.forTab(gBrowser.selectedTab);
target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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 = TargetFactory.forTab(tabX.tab);
tabX.target = await TargetFactory.forTab(tabX.tab);
if (startToolbox) {
tabX.toolbox = await gDevTools.showToolbox(tabX.target, "options");

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

@ -43,7 +43,7 @@ const openAnimationInspector = async function() {
* @return {Promise} that resolves when the toolbox has closed.
*/
const closeAnimationInspector = async function() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.closeToolbox(target);
};

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

@ -61,7 +61,7 @@ add_task(async function() {
"changing the color preserved the unit for " + color.name);
}
const target = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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 = TargetFactory.forTab(gBrowser.selectedTab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = getActiveInspector();
const inspector = await getActiveInspector();
ok(inspector, "Inspector is active");
await clickOnInspectMenuItem(testActor, "#closing");
@ -86,7 +86,9 @@ async function testContextMenuInspectorAlreadyOpen(testActor) {
}
async function testMarkupView(selector, inspector) {
inspector = inspector || getActiveInspector();
if (!inspector) {
inspector = await getActiveInspector();
}
const nodeFront = await getNodeFront(selector, inspector);
try {
is(inspector.selection.nodeFront, nodeFront,
@ -98,7 +100,9 @@ async function testMarkupView(selector, inspector) {
}
async function testBreadcrumbs(selector, inspector) {
inspector = inspector || getActiveInspector();
if (!inspector) {
inspector = await 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 = getActiveInspector();
const inspector = await 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 } = getActiveInspector();
const { toolbox } = await getActiveInspector();
const btn = toolbox.doc.getElementById("command-button-frames");
const panel = toolbox.doc.getElementById("command-button-frames-panel");

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

@ -72,9 +72,9 @@ add_task(async function() {
checkResults();
});
function openToolbox(tab) {
async function openToolbox(tab) {
info("Opening webconsole.");
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
return gDevTools.showToolbox(target, "webconsole");
}

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

@ -183,8 +183,8 @@ var openInspectorForURL = async function(url, hostType) {
return { tab, inspector, toolbox, testActor };
};
function getActiveInspector() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
async function getActiveInspector() {
const target = await 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 = TargetFactory.forTab(tab);
const target = await 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 = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
const toolbox = gDevTools.getToolbox(target);
await toolbox.destroy();
info("Closed memory panel successfully.");

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

@ -101,7 +101,7 @@ exports.menuitems = [
l10nKey: "eyedropper",
async oncommand(event) {
const window = event.target.ownerDocument.defaultView;
const target = TargetFactory.forTab(window.gBrowser.selectedTab);
const target = await TargetFactory.forTab(window.gBrowser.selectedTab);
await target.makeRemote();
const inspectorFront = await target.getFront("inspector");
inspectorFront.pickColorFromPage({copyOnSelect: true, fromMenu: true});

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

@ -289,7 +289,7 @@ function initNetMonitor(url, enableCache) {
const tab = await addTab(url);
info("Net tab added successfully: " + url);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
info("Target remoted.");

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

@ -23,7 +23,7 @@ exports.initPanelInNewTab = async function({ tool, url, win }, options = {}) {
exports.initPanelInTab = async function({ tool, tab }) {
dump(`Initializing a ${tool} panel.\n`);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
// Open a toolbox and wait for the connection to the performance actors

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

@ -57,7 +57,7 @@ add_task(async function() {
ok(!snapshot.parent, "No events have been logged for the main process");
const tab = await addTab(URL);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await openCloseRDM(tab);
await gDevTools.showToolbox(target, "inspector");

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

@ -25,7 +25,7 @@ const checkServerConnectionCount = async function(browser, expected, msg) {
};
const checkToolbox = async function(tab, location) {
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
ok(!!gDevTools.getToolbox(target), `Toolbox exists ${location}`);
};

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

@ -8,7 +8,7 @@
const TEST_URL = "http://example.com/";
const checkToolbox = async function(tab, location) {
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
ok(!!gDevTools.getToolbox(target), `Toolbox exists ${location}`);
};

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

@ -586,7 +586,7 @@ var Scratchpad = {
* @return Promise
* The promise for the script evaluation result.
*/
reloadAndRun: function SP_reloadAndRun() {
reloadAndRun: async function SP_reloadAndRun() {
const deferred = defer();
if (this.executionContext !== SCRATCHPAD_CONTEXT_CONTENT) {
@ -595,7 +595,7 @@ var Scratchpad = {
return;
}
const target = TargetFactory.forTab(this.gBrowser.selectedTab);
const target = await TargetFactory.forTab(this.gBrowser.selectedTab);
target.once("navigate", () => {
this.run().then(results => deferred.resolve(results));
});
@ -1543,8 +1543,8 @@ var Scratchpad = {
/**
* Open the Web Console.
*/
openWebConsole: function SP_openWebConsole() {
const target = TargetFactory.forTab(this.gBrowser.selectedTab);
openWebConsole: async function SP_openWebConsole() {
const target = await TargetFactory.forTab(this.gBrowser.selectedTab);
gDevTools.showToolbox(target, "webconsole");
this.browserWindow.focus();
},
@ -2092,8 +2092,8 @@ ScratchpadTab.prototype = {
* @return Promise
* The promise for the TabTarget for this tab.
*/
_attach: function ST__attach(aSubject) {
const target = TargetFactory.forTab(this._tab);
_attach: async function ST__attach(aSubject) {
const target = await TargetFactory.forTab(this._tab);
target.once("close", () => {
if (scratchpadTargets) {
scratchpadTargets.delete(aSubject);

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

@ -23,7 +23,7 @@ async function runTests([win, sp]) {
is(result, 7, "Display produced the expected output.");
// Now open the toolbox and close it again.
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "webconsole");
ok(toolbox, "Toolbox was opened.");
const closed = await gDevTools.closeToolbox(target);

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

@ -28,7 +28,7 @@ add_task(async function() {
});
info("Open devtools on the Scratchpad.");
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "scratchpad");
const menuToolbar = toolbox.doc.getElementById("sp-menu-toolbar");

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

@ -25,8 +25,8 @@ function test() {
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const {TargetFactory} = require("devtools/client/framework/target");
openScratchpad(function() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
openScratchpad(async function() {
const target = await TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, "webconsole").then((toolbox) => {
const hud = toolbox.getCurrentPanel().hud;
hud.ui.clearOutput(true);

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

@ -152,7 +152,7 @@ function initBackend(aUrl) {
return (async function() {
const tab = await addTab(aUrl);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
@ -166,7 +166,7 @@ function initShaderEditor(aUrl) {
return (async function() {
const tab = await addTab(aUrl);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();

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

@ -62,7 +62,7 @@ exports.openContentLink = async function(url, options = {}) {
if (!options.triggeringPrincipal && top.gBrowser) {
const tab = top.gBrowser.selectedTab;
if (TargetFactory.isKnownTab(tab)) {
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
options.triggeringPrincipal = target.contentPrincipal;
}
}

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

@ -10,7 +10,7 @@ add_task(async function() {
await addTab(TEST_URI);
startTelemetry();
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "inspector");
info("testing the eyedropper button");

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

@ -17,7 +17,7 @@ add_task(async function() {
await pushPref("devtools.command-button-paintflashing.enabled", true);
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "inspector");
info("inspector opened");

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

@ -36,7 +36,7 @@ add_task(async function() {
await addTab(TEST_URI);
startTelemetry();
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "inspector");
info("inspector opened");

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

@ -17,7 +17,7 @@ add_task(async function() {
await pushPref("devtools.command-button-scratchpad.enabled", true);
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "inspector");
info("inspector opened");

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

@ -113,7 +113,7 @@ add_task(async function() {
await addTab(TEST_URI);
startTelemetry();
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "inspector");
info("inspector opened");

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

@ -5,7 +5,7 @@
"use strict";
add_task(async function() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target);
const doc = toolbox.doc;
const root = doc.documentElement;

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

@ -129,7 +129,7 @@ async function(type = "bottom", src = CHROME_URL_ROOT + "dummy.html") {
async function openAndCloseToolbox(nbOfTimes, usageTime, toolId) {
for (let i = 0; i < nbOfTimes; i++) {
info("Opening toolbox " + (i + 1));
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await gDevTools.showToolbox(target, toolId);
// We use a timeout to check the toolbox's active time

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

@ -408,7 +408,7 @@ var openToolboxForTab = async function(tab, toolId, hostType) {
info("Opening the toolbox");
let toolbox;
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
// Check if the toolbox is already loaded.
@ -451,7 +451,7 @@ var openNewTabAndToolbox = async function(url, toolId, hostType) {
* closed.
*/
var closeTabAndToolbox = async function(tab = gBrowser.selectedTab) {
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
if (target) {
await gDevTools.closeToolbox(target);
}
@ -618,7 +618,7 @@ function lookupPath(obj, path) {
}
var closeToolbox = async function() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await gDevTools.closeToolbox(target);
};

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

@ -84,7 +84,7 @@ add_task(async function test() {
});
async function runTests() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await target.makeRemote();
inspector = InspectorFront(target.client, target.form);
const walker = await inspector.getWalker();

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

@ -14,7 +14,7 @@ add_task(async function() {
});
async function runTests() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await target.makeRemote();
const inspector = InspectorFront(target.client, target.form);
const walker = await inspector.getWalker();

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

@ -15,7 +15,7 @@ add_task(async function() {
await runTests();
info("Close Toolbox");
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await gDevTools.closeToolbox(target);
await finishTests();

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

@ -15,7 +15,7 @@ add_task(async function() {
await runTests();
info("Close Toolbox");
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await gDevTools.closeToolbox(target);
info("Set a toolbox height of 1000px");

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

@ -135,7 +135,7 @@ async function openTabAndSetupStorage(url, options = {}) {
*/
var openStoragePanel = async function(cb) {
info("Opening the storage inspector");
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
let storage, toolbox;

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

@ -11,7 +11,7 @@ const TEST_URL = TEST_BASE_HTTP + "doc_fetch_from_netmonitor.html";
add_task(async function() {
info("Opening netmonitor");
const tab = await addTab("about:blank");
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "netmonitor");
const monitor = toolbox.getPanel("netmonitor");
const { store, windowRequire } = monitor.panelWin;

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

@ -13,7 +13,7 @@ add_task(async function() {
// opened *while* the page is still loading. The Style Editor should not
// signal that it is loaded until the accompanying content page is loaded.
const tabAdded = addTab(TESTCASE_URI);
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const styleEditorLoaded = gDevTools.showToolbox(target, "styleeditor");
await Promise.all([tabAdded, styleEditorLoaded]);

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

@ -20,7 +20,7 @@ const expectedText = `
`;
async function closeAndReopenToolbox() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await gDevTools.closeToolbox(target);
const { ui: newui } = await openStyleEditor();
return newui;

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

@ -12,7 +12,7 @@ const TEST_URL = TEST_BASE + "doc_xulpage.xul";
add_task(async function() {
const tab = await addTab(TEST_URL);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "styleeditor");
const panel = toolbox.getCurrentPanel();

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

@ -72,7 +72,7 @@ var openStyleEditor = async function(tab) {
if (!tab) {
tab = gBrowser.selectedTab;
}
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "styleeditor");
const panel = toolbox.getPanel("styleeditor");
const ui = panel.UI;

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

@ -64,7 +64,7 @@ function initBackend(aUrl) {
return (async function() {
const tab = await addTab(aUrl);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();
@ -83,7 +83,7 @@ function initWebAudioEditor(aUrl) {
return (async function() {
const tab = await addTab(aUrl);
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
await target.makeRemote();

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше