зеркало из https://github.com/mozilla/gecko-dev.git
Bug 961771 - Disable highlighter when switching tools. r=pbrosset
This commit is contained in:
Родитель
49f48d86f7
Коммит
ef946f5c70
|
@ -73,6 +73,7 @@ function Toolbox(target, selectedTool, hostType, hostOptions) {
|
|||
this._refreshHostTitle = this._refreshHostTitle.bind(this);
|
||||
this._splitConsoleOnKeypress = this._splitConsoleOnKeypress.bind(this)
|
||||
this.destroy = this.destroy.bind(this);
|
||||
this.stopPicker = this.stopPicker.bind(this);
|
||||
|
||||
this._target.on("close", this.destroy);
|
||||
|
||||
|
@ -1112,6 +1113,7 @@ Toolbox.prototype = {
|
|||
|
||||
let done = () => {
|
||||
this.emit("picker-started");
|
||||
this.on("select", this.stopPicker);
|
||||
deferred.resolve();
|
||||
};
|
||||
|
||||
|
@ -1156,6 +1158,7 @@ Toolbox.prototype = {
|
|||
|
||||
let done = () => {
|
||||
this.emit("picker-stopped");
|
||||
this.off("select", this.stopPicker);
|
||||
deferred.resolve();
|
||||
};
|
||||
|
||||
|
|
|
@ -48,3 +48,4 @@ support-files =
|
|||
[browser_inspector_bug_952294_tooltips_dimensions.js]
|
||||
[browser_inspector_bug_958456_highlight_comments.js]
|
||||
[browser_inspector_bug_958169_switch_to_inspector_on_pick.js]
|
||||
[browser_inspector_bug_961771_picker_stops_on_tool_select.js]
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Test that the highlighter's picker should be stopped when a different tool is selected
|
||||
|
||||
function test() {
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let {require} = devtools;
|
||||
let promise = require("sdk/core/promise");
|
||||
let {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
let inspector, doc, toolbox;
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
|
||||
doc = content.document;
|
||||
waitForFocus(setupTest, content);
|
||||
}, true);
|
||||
content.location = "data:text/html,testing the highlighter goes away on tool selection";
|
||||
|
||||
function setupTest() {
|
||||
openInspector((aInspector, aToolbox) => {
|
||||
toolbox = aToolbox;
|
||||
inspector = aInspector;
|
||||
|
||||
toolbox.once("picker-stopped", () => {
|
||||
ok(true, "picker-stopped event fired after switch tools, so picker is closed");
|
||||
finishUp();
|
||||
});
|
||||
|
||||
Task.spawn(function() {
|
||||
yield toolbox.startPicker();
|
||||
yield toolbox.selectNextTool();
|
||||
}).then(null, Cu.reportError);
|
||||
});
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
inspector = doc = toolbox = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче