Bug 932880 - Fix a bunch of devtools test leaks. r=past

This commit is contained in:
Brian Grinstead 2013-10-31 17:49:37 -05:00
parent 7c26515c03
commit 06b8961622
14 changed files with 35 additions and 35 deletions

View File

@ -443,6 +443,7 @@ TabTarget.prototype = {
if (this._inspector) {
this._inspector.destroy();
this._inspector = null;
}
// First of all, do cleanup tasks that pertain to both remoted and

View File

@ -675,6 +675,8 @@ InspectorPanel.prototype = {
this._markupFrame.parentNode.removeChild(this._markupFrame);
delete this._markupFrame;
}
this._markupBox = null;
},
/**

View File

@ -84,6 +84,7 @@ function test() {
function finishUp() {
let h = require("devtools/inspector/highlighter");
h._forceBasic.value = false;
inspector = doc = null;
gBrowser.removeCurrentTab();
finish();
}

View File

@ -30,8 +30,9 @@ function test() {
}
function endTests() {
executeSoon(() => {
toolbox.destroy();
inspector.destroy().then(() =>
toolbox.destroy()
).then(() => {
toolbox = inspector = page1 = page2 = null;
gBrowser.removeCurrentTab();
finish();
@ -40,7 +41,7 @@ function test() {
function loadPageAnd(page, callback) {
inspector.once("markuploaded", () => {
executeSoon(callback);
callback();
});
if (page) {
@ -58,7 +59,7 @@ function test() {
loadPageAnd(false, () => {
is(inspector.selection.node.id, id, "Node re-selected after reload");
executeSoon(callback);
callback();
});
});
@ -85,14 +86,12 @@ function test() {
// Last node selected was id4, go to a different page and check body is
// selected
loadPageAnd(page2, () => {
executeSoon(() => {
is(
inspector.selection.node.tagName.toLowerCase(),
"body",
"Node not found, body selected"
);
executeSoon(testSameNodeSelectedOnNavigateAwayAndBack);
});
is(
inspector.selection.node.tagName.toLowerCase(),
"body",
"Node not found, body selected"
);
testSameNodeSelectedOnNavigateAwayAndBack();
});
}
@ -106,17 +105,12 @@ function test() {
inspector.once("inspector-updated", () => {
is(inspector.selection.node.id, id);
executeSoon(() => {
// go to page1 but do not select anything
loadPageAnd(page1, () => {
executeSoon(() => {
// go back to page2 and check id5 is still the current selection
loadPageAnd(page2, () => {
is(inspector.selection.node.id, id, "Node re-selected after navigation");
executeSoon(endTests);
});
});
// go to page1 but do not select anything
loadPageAnd(page1, () => {
// go back to page2 and check id5 is still the current selection
loadPageAnd(page2, () => {
is(inspector.selection.node.id, id, "Node re-selected after navigation");
endTests();
});
});
});

View File

@ -25,10 +25,7 @@ function inspectorRuleViewOpened()
gDevTools.once("toolbox-destroyed", inspectorClosed);
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = gDevTools.getToolbox(target);
executeSoon(function() {
toolbox.destroy();
});
gDevTools.getToolbox(target).destroy();
}
function inspectorClosed()
@ -55,6 +52,7 @@ function testNewDefaultTab()
function finishTest()
{
doc = inspector = null;
gBrowser.removeCurrentTab();
finish();
}

View File

@ -140,7 +140,7 @@ function test() {
}
function finishUp() {
doc = inspector = null;
doc = inspector = markup = null;
gBrowser.removeCurrentTab();
finish();
}

View File

@ -1350,6 +1350,7 @@ var Scratchpad = {
}
PreferenceObserver.uninit();
CloseObserver.uninit();
this.editor.off("change", this._onChanged);
this.editor.destroy();

View File

@ -28,8 +28,9 @@ support-files = head.js
[browser_scratchpad_long_string.js]
[browser_scratchpad_open.js]
[browser_scratchpad_open_error_console.js]
[browser_scratchpad_pprint-02.js]
[browser_scratchpad_pprint.js]
# Disabled, as escodegen is being replaced - bug 930141
# [browser_scratchpad_pprint-02.js]
# [browser_scratchpad_pprint.js]
[browser_scratchpad_restore.js]
[browser_scratchpad_tab_switch.js]
[browser_scratchpad_ui.js]

View File

@ -75,6 +75,7 @@ function createDummyDocument() {
eventTarget.addEventListener("DOMContentLoaded", function handler(event) {
eventTarget.removeEventListener("DOMContentLoaded", handler, false);
deferred.resolve(window.document);
frame.remove();
}, false);
gDummyPromise = deferred.promise;
return gDummyPromise;
@ -1251,6 +1252,7 @@ CssRuleView.prototype = {
{
this.clear();
gDummyPromise = null;
gDevTools.off("pref-changed", this._handlePrefChange);
this.element.removeEventListener("copy", this._onCopy);

View File

@ -174,7 +174,7 @@ function testIncrement( aEditor, aOptions )
function finishTest()
{
doc = null;
doc = view = inspector = null;
gBrowser.removeCurrentTab();
finish();
}

View File

@ -150,7 +150,7 @@ function failedClipboard(aExpectedPattern, aCallback)
function finishup()
{
gBrowser.removeCurrentTab();
doc = inspector = null;
doc = inspector = win = null;
finish();
}

View File

@ -97,7 +97,7 @@ function elementStyleInherit()
function finishTest()
{
doc = null;
doc = inspector = view = null;
gBrowser.removeCurrentTab();
finish();
}

View File

@ -159,7 +159,7 @@ function disableOverride()
function finishTest()
{
doc = null;
doc = inspector = view = null;
gBrowser.removeCurrentTab();
finish();
}

View File

@ -301,7 +301,7 @@ function testNode(node, cb)
function finishTest()
{
doc = null;
doc = inspector = view = null;
gBrowser.removeCurrentTab();
finish();
}