mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 770542 - Intermittent leak in browser_dbg_bug723069_editor-breakpoints.js, browser_dbg_bug723071_editor-breakpoints-pane.js & browser_dbg_bug731394_editor-contextmenu.js of browser_dbg_script-switching.html; r=rcampbell
This commit is contained in:
parent
84ac6d69de
commit
57b131d784
@ -72,14 +72,13 @@ let DebuggerController = {
|
||||
this._isDestroyed = true;
|
||||
window.removeEventListener("unload", this._shutdownDebugger, true);
|
||||
|
||||
DebuggerView.destroyPanes();
|
||||
DebuggerView.destroyEditor();
|
||||
DebuggerView.Scripts.destroy();
|
||||
DebuggerView.StackFrames.destroy();
|
||||
DebuggerView.Breakpoints.destroy();
|
||||
DebuggerView.Properties.destroy();
|
||||
DebuggerView.destroyPanes();
|
||||
DebuggerView.destroyEditor();
|
||||
|
||||
DebuggerController.Breakpoints.destroy();
|
||||
DebuggerController.SourceScripts.disconnect();
|
||||
DebuggerController.StackFrames.disconnect();
|
||||
DebuggerController.ThreadState.disconnect();
|
||||
|
@ -57,6 +57,14 @@ let DebuggerView = {
|
||||
|
||||
let variables = document.getElementById("variables");
|
||||
Prefs.variablesWidth = variables.getAttribute("width");
|
||||
|
||||
let bkps = document.getElementById("breakpoints");
|
||||
let frames = document.getElementById("stackframes");
|
||||
bkps.parentNode.removeChild(bkps);
|
||||
frames.parentNode.removeChild(frames);
|
||||
|
||||
stackframes.parentNode.removeChild(stackframes);
|
||||
variables.parentNode.removeChild(variables);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -544,6 +552,8 @@ ScriptsView.prototype = {
|
||||
this._searchbox.removeEventListener("select", this._onScriptsSearch, false);
|
||||
this._searchbox.removeEventListener("input", this._onScriptsSearch, false);
|
||||
this._searchbox.removeEventListener("keyup", this._onScriptsKeyUp, false);
|
||||
|
||||
this.empty();
|
||||
this._scripts = null;
|
||||
this._searchbox = null;
|
||||
}
|
||||
@ -859,6 +869,7 @@ StackFramesView.prototype = {
|
||||
frames.removeEventListener("scroll", this._onFramesScroll, false);
|
||||
window.removeEventListener("resize", this._onFramesScroll, false);
|
||||
|
||||
this.empty();
|
||||
this._frames = null;
|
||||
}
|
||||
};
|
||||
@ -878,6 +889,7 @@ BreakpointsView.prototype = {
|
||||
*/
|
||||
empty: function DVB_empty() {
|
||||
let firstChild;
|
||||
|
||||
while (firstChild = this._breakpoints.firstChild) {
|
||||
this._destroyContextMenu(firstChild);
|
||||
this._breakpoints.removeChild(firstChild);
|
||||
@ -1287,8 +1299,8 @@ BreakpointsView.prototype = {
|
||||
let commandsetId = "breakpointMenuCommands-" + aBreakpoint.id;
|
||||
let menupopupId = "breakpointContextMenu-" + aBreakpoint.id;
|
||||
|
||||
let commandsset = document.createElement("commandsset");
|
||||
commandsset.setAttribute("id", commandsetId);
|
||||
let commandset = document.createElement("commandset");
|
||||
commandset.setAttribute("id", commandsetId);
|
||||
|
||||
let menupopup = document.createElement("menupopup");
|
||||
menupopup.setAttribute("id", menupopupId);
|
||||
@ -1321,7 +1333,7 @@ BreakpointsView.prototype = {
|
||||
menuitem.setAttribute("command", commandId);
|
||||
menuitem.setAttribute("hidden", aHiddenFlag);
|
||||
|
||||
commandsset.appendChild(command);
|
||||
commandset.appendChild(command);
|
||||
menupopup.appendChild(menuitem);
|
||||
|
||||
aBreakpoint[aName] = {
|
||||
@ -1354,7 +1366,10 @@ BreakpointsView.prototype = {
|
||||
|
||||
let popupset = document.getElementById("debugger-popups");
|
||||
popupset.appendChild(menupopup);
|
||||
document.documentElement.appendChild(commandsset);
|
||||
document.documentElement.appendChild(commandset);
|
||||
|
||||
aBreakpoint.commandsetId = commandsetId;
|
||||
aBreakpoint.menupopupId = menupopupId;
|
||||
|
||||
return menupopupId;
|
||||
},
|
||||
@ -1366,18 +1381,15 @@ BreakpointsView.prototype = {
|
||||
* An element representing a breakpoint.
|
||||
*/
|
||||
_destroyContextMenu: function DVB__destroyContextMenu(aBreakpoint) {
|
||||
let commandsetId = "breakpointMenuCommands-" + aBreakpoint.id;
|
||||
let menupopupId = "breakpointContextMenu-" + aBreakpoint.id;
|
||||
|
||||
let commandset = document.getElementById(commandsetId);
|
||||
let menupopup = document.getElementById(menupopupId);
|
||||
|
||||
if (commandset) {
|
||||
commandset.parentNode.removeChild(commandset);
|
||||
}
|
||||
if (menupopup) {
|
||||
menupopup.parentNode.removeChild(menupopup);
|
||||
if (!aBreakpoint.commandsetId || !aBreakpoint.menupopupId) {
|
||||
return;
|
||||
}
|
||||
|
||||
let commandset = document.getElementById(aBreakpoint.commandsetId);
|
||||
let menupopup = document.getElementById(aBreakpoint.menupopupId);
|
||||
|
||||
commandset.parentNode.removeChild(commandset);
|
||||
menupopup.parentNode.removeChild(menupopup);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1398,6 +1410,7 @@ BreakpointsView.prototype = {
|
||||
let breakpoints = this._breakpoints;
|
||||
breakpoints.removeEventListener("click", this._onBreakpointClick, false);
|
||||
|
||||
this.empty();
|
||||
this._breakpoints = null;
|
||||
}
|
||||
};
|
||||
@ -2499,6 +2512,8 @@ PropertiesView.prototype = {
|
||||
* Destruction function, called when the debugger is shut down.
|
||||
*/
|
||||
destroy: function DVP_destroy() {
|
||||
this.empty();
|
||||
|
||||
this._currHierarchy = null;
|
||||
this._prevHierarchy = null;
|
||||
this._vars = null;
|
||||
|
@ -11,6 +11,7 @@ relativesrcdir = browser/devtools/debugger/test
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_BROWSER_TESTS = \
|
||||
browser_dbg_leaktest.js \
|
||||
browser_dbg_createRemote.js \
|
||||
browser_dbg_createChrome.js \
|
||||
browser_dbg_debugger-tab-switch.js \
|
||||
|
@ -275,15 +275,21 @@ function test()
|
||||
is(gEditor.getBreakpoints().length, 0, "editor.getBreakpoints().length is correct");
|
||||
|
||||
executeSoon(function() {
|
||||
gDebugger.DebuggerController.activeThread.resume(finish);
|
||||
gDebugger.gClient.addOneTimeListener("resumed", function() {
|
||||
finalCheck();
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
gDebugger.DebuggerController.activeThread.resume();
|
||||
});
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
function finalCheck() {
|
||||
is(Object.keys(gBreakpoints).length, 0, "no breakpoint in the debugger");
|
||||
ok(!gPane.getBreakpoint(gScripts.scriptLocations[0], 5),
|
||||
"getBreakpoint(scriptLocations[0], 5) returns no breakpoint");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
is(breakpointsAdded, 2, "correct number of breakpoints have been added");
|
||||
is(breakpointsRemoved, 1, "correct number of breakpoints have been removed");
|
||||
|
@ -142,7 +142,13 @@ function test()
|
||||
gBreakpointsElement.querySelectorAll(".list-item.empty").length,
|
||||
"Found junk in the breakpoints container.");
|
||||
|
||||
finish();
|
||||
executeSoon(function() {
|
||||
gDebugger.gClient.addOneTimeListener("resumed", function() {
|
||||
finalCheck();
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
gDebugger.DebuggerController.activeThread.resume();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -261,11 +267,13 @@ function test()
|
||||
}
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
function finalCheck() {
|
||||
is(Object.keys(gBreakpoints).length, 0, "no breakpoint in the debugger");
|
||||
ok(!gPane.getBreakpoint(gScripts.scriptLocations[0], 5),
|
||||
"getBreakpoint(scriptLocations[0], 5) returns no breakpoint");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
is(breakpointsAdded, 3, "correct number of breakpoints have been added");
|
||||
is(breakpointsDisabled, 3, "correct number of breakpoints have been disabled");
|
||||
is(breakpointsRemoved, 3, "correct number of breakpoints have been removed");
|
||||
|
@ -113,7 +113,7 @@ function test()
|
||||
|
||||
executeSoon(function() {
|
||||
contextMenu.hidePopup();
|
||||
gDebugger.DebuggerController.activeThread.resume(finish);
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
}
|
||||
|
||||
|
69
browser/devtools/debugger/test/browser_dbg_leaktest.js
Normal file
69
browser/devtools/debugger/test/browser_dbg_leaktest.js
Normal file
@ -0,0 +1,69 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* This tests if the debugger leaks.
|
||||
* If leaks happen here, there's something very, very fishy going on.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
|
||||
|
||||
let gPane = null;
|
||||
let gTab = null;
|
||||
let gDebuggee = null;
|
||||
let gDebugger = null;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.contentWindow;
|
||||
resumed = true;
|
||||
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
framesAdded = true;
|
||||
executeSoon(startTest);
|
||||
});
|
||||
|
||||
executeSoon(function() {
|
||||
gDebuggee.firstCall();
|
||||
});
|
||||
});
|
||||
|
||||
function onScriptShown(aEvent)
|
||||
{
|
||||
scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
|
||||
executeSoon(startTest);
|
||||
}
|
||||
|
||||
window.addEventListener("Debugger:ScriptShown", onScriptShown);
|
||||
|
||||
function startTest()
|
||||
{
|
||||
if (scriptShown && framesAdded && resumed && !testStarted) {
|
||||
window.removeEventListener("Debugger:ScriptShown", onScriptShown);
|
||||
testStarted = true;
|
||||
Services.tm.currentThread.dispatch({ run: performTest }, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function performTest()
|
||||
{
|
||||
closeDebuggerAndFinish();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gDebugger = null;
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user