mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 932880 - Make targets oblivious to inspectors. r=bgrins
This commit is contained in:
parent
edcef1c52d
commit
46c55c5c1c
@ -15,8 +15,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DebuggerClient",
|
||||
"resource://gre/modules/devtools/dbg-client.jsm");
|
||||
|
||||
loader.lazyGetter(this, "InspectorFront", () => require("devtools/server/actors/inspector").InspectorFront);
|
||||
|
||||
const targets = new WeakMap();
|
||||
const promiseTargets = new WeakMap();
|
||||
|
||||
@ -253,17 +251,6 @@ TabTarget.prototype = {
|
||||
return !!this._isThreadPaused;
|
||||
},
|
||||
|
||||
get inspector() {
|
||||
if (!this.form) {
|
||||
throw new Error("Target.inspector requires an initialized remote actor.");
|
||||
}
|
||||
if (this._inspector) {
|
||||
return this._inspector;
|
||||
}
|
||||
this._inspector = InspectorFront(this.client, this.form);
|
||||
return this._inspector;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds remote protocol capabilities to the target, so that it can be used
|
||||
* for tools that support the Remote Debugging Protocol even for local
|
||||
@ -441,11 +428,6 @@ TabTarget.prototype = {
|
||||
// Before taking any action, notify listeners that destruction is imminent.
|
||||
this.emit("close");
|
||||
|
||||
if (this._inspector) {
|
||||
this._inspector.destroy();
|
||||
this._inspector = null;
|
||||
}
|
||||
|
||||
// First of all, do cleanup tasks that pertain to both remoted and
|
||||
// non-remoted targets.
|
||||
this.off("thread-resumed", this._handleThreadState);
|
||||
|
@ -18,6 +18,7 @@ loader.lazyGetter(this, "HTMLBreadcrumbs", () => require("devtools/inspector/bre
|
||||
loader.lazyGetter(this, "Highlighter", () => require("devtools/inspector/highlighter").Highlighter);
|
||||
loader.lazyGetter(this, "ToolSidebar", () => require("devtools/framework/sidebar").ToolSidebar);
|
||||
loader.lazyGetter(this, "SelectorSearch", () => require("devtools/inspector/selector-search").SelectorSearch);
|
||||
loader.lazyGetter(this, "InspectorFront", () => require("devtools/server/actors/inspector").InspectorFront);
|
||||
|
||||
const LAYOUT_CHANGE_TIMER = 250;
|
||||
|
||||
@ -60,6 +61,7 @@ function InspectorPanel(iframeWindow, toolbox) {
|
||||
this.panelDoc = iframeWindow.document;
|
||||
this.panelWin = iframeWindow;
|
||||
this.panelWin.inspector = this;
|
||||
this._inspector = null;
|
||||
|
||||
this._onBeforeNavigate = this._onBeforeNavigate.bind(this);
|
||||
this._target.on("will-navigate", this._onBeforeNavigate);
|
||||
@ -83,6 +85,16 @@ InspectorPanel.prototype = {
|
||||
}).then(null, console.error);
|
||||
},
|
||||
|
||||
get inspector() {
|
||||
if (!this._target.form) {
|
||||
throw new Error("Target.inspector requires an initialized remote actor.");
|
||||
}
|
||||
if (!this._inspector) {
|
||||
this._inspector = InspectorFront(this._target.client, this._target.form);
|
||||
}
|
||||
return this._inspector;
|
||||
},
|
||||
|
||||
_deferredOpen: function(defaultSelection) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
@ -184,10 +196,9 @@ InspectorPanel.prototype = {
|
||||
},
|
||||
|
||||
_getWalker: function() {
|
||||
let inspector = this.target.inspector;
|
||||
return inspector.getWalker().then(walker => {
|
||||
return this.inspector.getWalker().then(walker => {
|
||||
this.walker = walker;
|
||||
return inspector.getPageStyle();
|
||||
return this.inspector.getPageStyle();
|
||||
}).then(pageStyle => {
|
||||
this.pageStyle = pageStyle;
|
||||
});
|
||||
@ -500,7 +511,12 @@ InspectorPanel.prototype = {
|
||||
|
||||
if (this.walker) {
|
||||
this.walker.off("new-root", this.onNewRoot);
|
||||
this._destroyPromise = this.walker.release().then(null, console.error);
|
||||
this._destroyPromise = this.walker.release()
|
||||
.then(() => this._inspector.destroy())
|
||||
.then(() => {
|
||||
this._inspector = null;
|
||||
}, console.error);
|
||||
|
||||
delete this.walker;
|
||||
delete this.pageStyle;
|
||||
} else {
|
||||
|
@ -77,7 +77,7 @@ function test() {
|
||||
}
|
||||
|
||||
function verifyNoNodeSelected() {
|
||||
ok(doc.querySelectorAll(":-moz-devtools-highlighted").length === 0, "no node selected");
|
||||
is(doc.querySelectorAll(":-moz-devtools-highlighted").length, 0, "no node selected");
|
||||
return promise.resolve();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user