mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 892560 - [inspector] reloading the page breaks the inspector. r=dcamp
This commit is contained in:
parent
a995710069
commit
fc941f606d
@ -744,7 +744,7 @@ Toolbox.prototype = {
|
||||
gDevTools.off("tool-registered", this._toolRegistered);
|
||||
gDevTools.off("tool-unregistered", this._toolUnregistered);
|
||||
|
||||
// Revert docShell.allowJavascript back to it's original value if it was
|
||||
// Revert docShell.allowJavascript back to its original value if it was
|
||||
// changed via the Disable JS option.
|
||||
if (typeof this._origAllowJavascript != "undefined") {
|
||||
let docShell = this._host.hostTab.linkedBrowser.docShell;
|
||||
@ -755,7 +755,12 @@ Toolbox.prototype = {
|
||||
let outstanding = [];
|
||||
|
||||
for (let [id, panel] of this._toolPanels) {
|
||||
try {
|
||||
outstanding.push(panel.destroy());
|
||||
} catch(e) {
|
||||
// We don't want to stop here if any panel fail to close.
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
let container = this.doc.getElementById("toolbox-buttons");
|
||||
|
@ -229,6 +229,13 @@ Highlighter.prototype = {
|
||||
*/
|
||||
invalidateSize: function Highlighter_invalidateSize()
|
||||
{
|
||||
let canHiglightNode = this.selection.isNode() &&
|
||||
this.selection.isConnected() &&
|
||||
this.selection.isElementNode();
|
||||
|
||||
if (!canHiglightNode)
|
||||
return;
|
||||
|
||||
// The highlighter runs locally while the selection runs remotely,
|
||||
// so we can't quite trust the selection's isConnected to protect us
|
||||
// here, do the check manually.
|
||||
@ -238,13 +245,6 @@ Highlighter.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let canHiglightNode = this.selection.isNode() &&
|
||||
this.selection.isConnected() &&
|
||||
this.selection.isElementNode();
|
||||
|
||||
if (!canHiglightNode)
|
||||
return;
|
||||
|
||||
let clientRect = this.selection.node.getBoundingClientRect();
|
||||
let rect = LayoutHelpers.getDirtyRect(this.selection.node);
|
||||
this.highlightRectangle(rect);
|
||||
|
@ -43,6 +43,7 @@ MOCHITEST_BROWSER_FILES := \
|
||||
browser_inspector_bug_831693_search_suggestions.html \
|
||||
browser_inspector_bug_835722_infobar_reappears.js \
|
||||
browser_inspector_bug_840156_destroy_after_navigation.js \
|
||||
browser_inspector_reload.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
51
browser/devtools/inspector/test/browser_inspector_reload.js
Normal file
51
browser/devtools/inspector/test/browser_inspector_reload.js
Normal file
@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
|
||||
function test() {
|
||||
let inspector, toolbox;
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
|
||||
waitForFocus(function() {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
|
||||
startInspectorTests(toolbox);
|
||||
}).then(null, console.error);
|
||||
}, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,<p>p</p>";
|
||||
|
||||
function startInspectorTests(aToolbox)
|
||||
{
|
||||
toolbox = aToolbox;
|
||||
inspector = toolbox.getCurrentPanel();
|
||||
info("Inspector started");
|
||||
let p = content.document.querySelector("p");
|
||||
inspector.selection.setNode(p);
|
||||
inspector.once("inspector-updated", () => {
|
||||
is(inspector.selection.node, p, "Node selected.");
|
||||
inspector.once("markuploaded", onReload);
|
||||
content.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function onReload() {
|
||||
info("Page reloaded");
|
||||
let p = content.document.querySelector("p");
|
||||
inspector.selection.setNode(p);
|
||||
inspector.once("inspector-updated", () => {
|
||||
is(inspector.selection.node, p, "Node re-selected.");
|
||||
toolbox.destroy();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}
|
@ -668,7 +668,11 @@ MarkupView.prototype = {
|
||||
delete this._observer;
|
||||
|
||||
if (this._rootNode) {
|
||||
try {
|
||||
this._rootNode.removeEventListener("load", this, true);
|
||||
} catch(e) {
|
||||
// this._rootNode might be a dead object.
|
||||
}
|
||||
delete this._rootNode;
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user