Bug 958169 - Switch to the inspector panel on click of the pick button; r=bgrins

This commit is contained in:
Patrick Brosset 2014-01-15 14:03:18 +01:00
parent 090725ef55
commit cb2a0bbc9d
3 changed files with 62 additions and 1 deletions

View File

@ -1115,7 +1115,10 @@ Toolbox.prototype = {
deferred.resolve();
};
this.initInspector().then(() => {
promise.all([
this.initInspector(),
this.selectTool("inspector")
]).then(() => {
this._isPicking = true;
this._pickerButton.setAttribute("checked", "true");

View File

@ -45,3 +45,4 @@ support-files =
[browser_inspector_bug_848731_reset_selection_on_delete.js]
[browser_inspector_bug_922125_destroy_on_navigate.js]
[browser_inspector_bug_952294_tooltips_dimensions.js]
[browser_inspector_bug_958169_switch_to_inspector_on_pick.js]

View File

@ -0,0 +1,57 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let doc;
let toolbox;
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload(evt) {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
doc = content.document;
waitForFocus(startTests, content);
}, true);
content.location = "data:text/html,<p>Switch to inspector on pick</p>";
}
function startTests() {
Task.spawn(function() {
yield openToolbox();
yield startPickerAndAssertSwitchToInspector();
yield toolbox.stopPicker();
finishTests();
}).then(null, Cu.reportError);
}
function openToolbox() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.showToolbox(target, "webconsole").then(aToolbox => {
toolbox = aToolbox;
});
}
function startPickerAndAssertSwitchToInspector() {
let deferred = promise.defer();
let pickButton = toolbox.doc.querySelector("#command-button-pick");
pickButton.click();
toolbox.once("inspector-selected", () => {
is(toolbox.currentToolId, "inspector", "Switched to the inspector");
toolbox.getCurrentPanel().once("inspector-updated", deferred.resolve);
});
return deferred.promise;
}
function finishTests() {
doc = toolbox = null;
gBrowser.removeCurrentTab();
finish();
}