The debugger shouldn't try to connect to the tracer actor if it is not present or if tracing is disabled (bug 970536). r=fitzgen

This commit is contained in:
Panos Astithas 2014-02-13 09:18:36 +02:00
parent db81771f25
commit b6fb53ef0f
3 changed files with 45 additions and 1 deletions

View File

@ -240,7 +240,11 @@ let DebuggerController = {
} else {
this._startDebuggingTab(startedDebugging.resolve);
const startedTracing = promise.defer();
this._startTracingTab(traceActor, startedTracing.resolve);
if (Prefs.tracerEnabled && traceActor) {
this._startTracingTab(traceActor, startedTracing.resolve);
} else {
startedTracing.resolve();
}
return promise.all([startedDebugging.promise, startedTracing.promise]);
}

View File

@ -214,6 +214,7 @@ support-files =
[browser_dbg_tracing-03.js]
[browser_dbg_tracing-04.js]
[browser_dbg_tracing-05.js]
[browser_dbg_tracing-06.js]
[browser_dbg_variables-view-01.js]
[browser_dbg_variables-view-02.js]
[browser_dbg_variables-view-03.js]

View File

@ -0,0 +1,39 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that the tracer doesn't connect to the backend when tracing is disabled.
*/
const TAB_URL = EXAMPLE_URL + "doc_tracing-01.html";
const TRACER_PREF = "devtools.debugger.tracer";
let gTab, gDebuggee, gPanel, gDebugger;
let gOriginalPref = Services.prefs.getBoolPref(TRACER_PREF);
Services.prefs.setBoolPref(TRACER_PREF, false);
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
waitForSourceShown(gPanel, "code_tracing-01.js")
.then(() => {
ok(!gDebugger.DebuggerController.traceClient, "Should not have a trace client");
closeDebuggerAndFinish(gPanel);
})
.then(null, aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
});
}
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
Services.prefs.setBoolPref(TRACER_PREF, gOriginalPref);
});