Bug 932880: Developer tools leak many windows until shutdown in browser-chrome tests. r=anton CLOSED TREE

This commit is contained in:
Brian Grinstead 2013-10-30 20:29:06 -05:00
Родитель d38b80587b
Коммит d0fd168866
5 изменённых файлов: 27 добавлений и 2 удалений

Просмотреть файл

@ -908,6 +908,7 @@ Toolbox.prototype = {
// Free _host after the call to destroyed in order to let a chance
// to destroyed listeners to still query toolbox attributes
this._host = null;
});
this._toolPanels.clear();
}).then(null, console.error);
}
};

Просмотреть файл

@ -496,6 +496,8 @@ InspectorPanel.prototype = {
this.highlighter.destroy();
}
delete this.onLockStateChanged;
if (this.walker) {
this.walker.off("new-root", this.onNewRoot);
this._destroyPromise = this.walker.release().then(null, console.error);
@ -529,6 +531,7 @@ InspectorPanel.prototype = {
this.nodemenu.removeEventListener("popuphiding", this._resetNodeMenu, true);
this.breadcrumbs.destroy();
this.searchSuggestions.destroy();
delete this.searchBox;
this.selection.off("new-node-front", this.onNewSelection);
this.selection.off("before-new-node", this.onBeforeNewSelection);
this.selection.off("before-new-node-front", this.onBeforeNewSelection);

Просмотреть файл

@ -188,3 +188,8 @@ function getComputedPropertyValue(aName)
}
}
}
SimpleTest.registerCleanupFunction(function () {
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.closeToolbox(target);
});

Просмотреть файл

@ -2367,6 +2367,11 @@ var InspectorFront = exports.InspectorFront = protocol.FrontClass(InspectorActor
this.manage(this);
},
destroy: function() {
delete this.walker;
protocol.Front.prototype.destroy.call(this);
},
getWalker: protocol.custom(function() {
return this._getWalker().then(walker => {
this.walker = walker;

Просмотреть файл

@ -915,7 +915,12 @@ let actorProto = function(actorProto) {
response.from = this.actorID;
// If spec.release has been specified, destroy the object.
if (spec.release) {
this.destroy();
try {
this.destroy();
} catch(e) {
this.writeError(e);
return;
}
}
conn.send(response);
@ -988,6 +993,12 @@ let Front = Class({
},
destroy: function() {
// Reject all outstanding requests, they won't make sense after
// the front is destroyed.
while (this._requests && this._requests.length > 0) {
let deferred = this._requests.shift();
deferred.reject(new Error("Connection closed"));
}
Pool.prototype.destroy.call(this);
this.actorID = null;
},