зеркало из https://github.com/mozilla/gecko-dev.git
Bug 835722 - Infobar reappears even when not needed, r=mratcliffe
This commit is contained in:
Родитель
b0a6738863
Коммит
dd138cedd9
|
@ -140,11 +140,13 @@ Highlighter.prototype = {
|
|||
if (id != "inspector") {
|
||||
this.chromeWin.clearTimeout(this.pageEventsMuter);
|
||||
this.detachMouseListeners();
|
||||
this.disabled = true;
|
||||
this.hide();
|
||||
} else {
|
||||
if (!this.locked) {
|
||||
this.attachMouseListeners();
|
||||
}
|
||||
this.disabled = false;
|
||||
this.show();
|
||||
}
|
||||
}.bind(this);
|
||||
|
@ -206,6 +208,9 @@ Highlighter.prototype = {
|
|||
this.selection.isElementNode();
|
||||
|
||||
if (canHighlightNode) {
|
||||
if (this.selection.reason != "navigateaway") {
|
||||
this.disabled = false;
|
||||
}
|
||||
this.show();
|
||||
this.updateInfobar();
|
||||
this.invalidateSize();
|
||||
|
@ -214,6 +219,7 @@ Highlighter.prototype = {
|
|||
LayoutHelpers.scrollIntoViewIfNeeded(this.selection.node);
|
||||
}
|
||||
} else {
|
||||
this.disabled = true;
|
||||
this.hide();
|
||||
}
|
||||
},
|
||||
|
@ -246,7 +252,7 @@ Highlighter.prototype = {
|
|||
* Show the highlighter if it has been hidden.
|
||||
*/
|
||||
show: function() {
|
||||
if (!this.hidden) return;
|
||||
if (!this.hidden || this.disabled) return;
|
||||
this.showOutline();
|
||||
this.showInfobar();
|
||||
this.computeZoomFactor();
|
||||
|
|
|
@ -253,7 +253,7 @@ InspectorPanel.prototype = {
|
|||
}
|
||||
|
||||
if (!self.selection.node) {
|
||||
self.selection.setNode(newWindow.document.documentElement);
|
||||
self.selection.setNode(newWindow.document.documentElement, "navigateaway");
|
||||
}
|
||||
self._initMarkup();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ _BROWSER_FILES = \
|
|||
browser_inspector_bug_817558_delete_node.js \
|
||||
browser_inspector_bug_650804_search.js \
|
||||
browser_inspector_bug_650804_search.html \
|
||||
browser_inspector_bug_835722_infobar_reappears.js \
|
||||
browser_inspector_bug_840156_destroy_after_navigation.js \
|
||||
head.js \
|
||||
helpers.js \
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
let inspector, utils;
|
||||
|
||||
function startLocationTests() {
|
||||
openInspector(runInspectorTests);
|
||||
}
|
||||
|
||||
function runInspectorTests(aInspector) {
|
||||
inspector = aInspector;
|
||||
utils = inspector.panelWin
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
ok(utils, "utils is defined");
|
||||
executeSoon(function() {
|
||||
inspector.selection.once("new-node", onNewSelection);
|
||||
info("selecting the DOCTYPE node");
|
||||
inspector.selection.setNode(content.document.doctype, "test");
|
||||
});
|
||||
}
|
||||
|
||||
function sendMouseEvent(node, type, x, y) {
|
||||
let rect = node.getBoundingClientRect();
|
||||
let left = rect.left + x;
|
||||
let top = rect.top + y;
|
||||
utils.sendMouseEventToWindow(type, left, top, 0, 1, 0, false, 0, 0);
|
||||
}
|
||||
|
||||
function onNewSelection() {
|
||||
is(inspector.highlighter.isHidden(), true,
|
||||
"The infobar should be hidden now on selecting a non element node.");
|
||||
inspector.sidebar.select("ruleview");
|
||||
let ruleView = inspector.sidebar.getTab("ruleview");
|
||||
ruleView.addEventListener("mouseover", function onMouseOver() {
|
||||
ruleView.removeEventListener("mouseover", onMouseOver, false);
|
||||
is(inspector.highlighter.isHidden(), true,
|
||||
"The infobar was hidden so mouseover on the rules view did nothing");
|
||||
executeSoon(mouseOutAndContinue);
|
||||
}, false);
|
||||
sendMouseEvent(ruleView, "mouseover", 10, 10);
|
||||
}
|
||||
|
||||
function mouseOutAndContinue() {
|
||||
let ruleView = inspector.sidebar.getTab("ruleview");
|
||||
info("adding mouseout listener");
|
||||
ruleView.addEventListener("mouseout", function onMouseOut() {
|
||||
info("mouseout happened");
|
||||
ruleView.removeEventListener("mouseout", onMouseOut, false);
|
||||
is(inspector.highlighter.isHidden(), true,
|
||||
"The infobar should not be visible after we mouseout of rules view");
|
||||
switchToWebConsole();
|
||||
}, false);
|
||||
info("Synthesizing mouseout on " + ruleView);
|
||||
sendMouseEvent(inspector._markupBox, "mousemove", 50, 50);
|
||||
info("mouseout synthesized");
|
||||
}
|
||||
|
||||
function switchToWebConsole() {
|
||||
inspector.selection.once("new-node", function() {
|
||||
is(inspector.highlighter.isHidden(), false,
|
||||
"The infobar should be visible after we select a div.");
|
||||
gDevTools.showToolbox(inspector.target, "webconsole").then(function() {
|
||||
is(inspector.highlighter.isHidden(), true,
|
||||
"The infobar should not be visible after we switched to webconsole");
|
||||
reloadAndWait();
|
||||
});
|
||||
});
|
||||
inspector.selection.setNode(content.document.querySelector("div"), "test");
|
||||
}
|
||||
|
||||
function reloadAndWait() {
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onBrowserLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onBrowserLoad, true);
|
||||
waitForFocus(testAfterReload, content);
|
||||
}, true);
|
||||
content.location.reload();
|
||||
}
|
||||
|
||||
function testAfterReload() {
|
||||
is(inspector.highlighter.isHidden(), true,
|
||||
"The infobar should not be visible after we reload with webconsole shown");
|
||||
testEnd();
|
||||
}
|
||||
|
||||
function testEnd() {
|
||||
gBrowser.removeCurrentTab();
|
||||
utils = null;
|
||||
executeSoon(finish);
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onBrowserLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onBrowserLoad, true);
|
||||
waitForFocus(startLocationTests, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,<!DOCTYPE html><div>Infobar should not " +
|
||||
"reappear</div><p>init</p>";
|
||||
}
|
Загрузка…
Ссылка в новой задаче