Backed out changeset b413c3707a12 (bug 983469) for browser_dbg_server-conditional-bp-01.js timeouts.

This commit is contained in:
Ryan VanderMeulen 2015-02-22 16:02:40 -05:00
parent f473a2fd67
commit c8f49b8748
7 changed files with 16 additions and 347 deletions

View File

@ -711,7 +711,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
lineTextNode.setAttribute("crop", "end");
lineTextNode.setAttribute("flex", "1");
let tooltip = text ? text.substr(0, BREAKPOINT_LINE_TOOLTIP_MAX_LENGTH) : "";
let tooltip = text.substr(0, BREAKPOINT_LINE_TOOLTIP_MAX_LENGTH);
lineTextNode.setAttribute("tooltiptext", tooltip);
let container = document.createElement("hbox");
@ -992,7 +992,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
let attachment = breakpointItem.attachment;
// Check if this is an enabled conditional breakpoint, and if so,
// save the current conditional expression.
// save the current conditional epression.
let breakpointPromise = DebuggerController.Breakpoints._getAdded(attachment);
if (breakpointPromise) {
let { location } = yield breakpointPromise;

View File

@ -208,8 +208,6 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_conditional-breakpoints-04.js]
skip-if = e10s && debug
[browser_dbg_conditional-breakpoints-05.js]
skip-if = e10s && debug
[browser_dbg_server-conditional-bp-01.js]
skip-if = e10s && debug
[browser_dbg_server-conditional-bp-02.js]
@ -218,8 +216,6 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_server-conditional-bp-04.js]
skip-if = e10s && debug
[browser_dbg_server-conditional-bp-05.js]
skip-if = e10s && debug
[browser_dbg_controller-evaluate-01.js]
skip-if = e10s && debug
[browser_dbg_controller-evaluate-02.js]

View File

@ -1,141 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure that conditional breakpoints with an exception-throwing expression
* could pause on hit
*/
const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html";
function test() {
let gTab, gPanel, gDebugger, gEditor;
let gSources, gBreakpoints, gLocation;
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
gSources = gDebugger.DebuggerView.Sources;
gBreakpoints = gDebugger.DebuggerController.Breakpoints;
// This test forces conditional breakpoints to be evaluated on the
// client-side
var client = gPanel.target.client;
client.mainRoot.traits.conditionalBreakpoints = false;
waitForSourceAndCaretAndScopes(gPanel, ".html", 17)
.then(addBreakpoints)
.then(() => resumeAndTestBreakpoint(18))
.then(() => resumeAndTestBreakpoint(19))
.then(() => resumeAndTestBreakpoint(20))
.then(() => resumeAndTestBreakpoint(23))
.then(() => resumeAndTestNoBreakpoint())
.then(() => {
// Reset traits back to default value
client.mainRoot.traits.conditionalBreakpoints = true;
})
.then(() => closeDebuggerAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
callInTab(gTab, "ermahgerd");
});
function resumeAndTestBreakpoint(aLine) {
let finished = waitForCaretUpdated(gPanel, aLine).then(() => testBreakpoint(aLine));
EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.getElementById("resume"),
gDebugger);
return finished;
}
function resumeAndTestNoBreakpoint() {
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_CLEARED).then(() => {
is(gSources.itemCount, 1,
"Found the expected number of sources.");
is(gEditor.getText().indexOf("ermahgerd"), 253,
"The correct source was loaded initially.");
is(gSources.selectedValue, gSources.values[0],
"The correct source is selected.");
ok(gSources.selectedItem,
"There should be a selected source in the sources pane.");
ok(!gSources._selectedBreakpointItem,
"There should be no selected breakpoint in the sources pane.");
is(gSources._conditionalPopupVisible, false,
"The breakpoint conditional expression popup should not be shown.");
is(gDebugger.document.querySelectorAll(".dbg-stackframe").length, 0,
"There should be no visible stackframes.");
is(gDebugger.document.querySelectorAll(".dbg-breakpoint").length, 6,
"There should be thirteen visible breakpoints.");
});
gDebugger.gThreadClient.resume();
return finished;
}
function addBreakpoints() {
return promise.resolve(null)
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 18 }))
.then(aClient => aClient.conditionalExpression = " 1a")
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 19 }))
.then(aClient => aClient.conditionalExpression = "new Error()")
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 20 }))
.then(aClient => aClient.conditionalExpression = "true")
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 21 }))
.then(aClient => aClient.conditionalExpression = "false")
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 22 }))
.then(aClient => aClient.conditionalExpression = "0")
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 23 }))
.then(aClient => aClient.conditionalExpression = "randomVar");
}
function testBreakpoint(aLine, aHighlightBreakpoint) {
// Highlight the breakpoint only if required.
if (aHighlightBreakpoint) {
let finished = waitForCaretUpdated(gPanel, aLine).then(() => testBreakpoint(aLine));
gSources.highlightBreakpoint({ actor: gSources.selectedValue, line: aLine });
return finished;
}
let selectedActor = gSources.selectedValue;
let selectedBreakpoint = gSources._selectedBreakpointItem;
ok(selectedActor,
"There should be a selected item in the sources pane.");
ok(selectedBreakpoint,
"There should be a selected breakpoint in the sources pane.");
let source = gSources.selectedItem.attachment.source;
is(selectedBreakpoint.attachment.actor, source.actor,
"The breakpoint on line " + aLine + " wasn't added on the correct source.");
is(selectedBreakpoint.attachment.line, aLine,
"The breakpoint on line " + aLine + " wasn't found.");
is(!!selectedBreakpoint.attachment.disabled, false,
"The breakpoint on line " + aLine + " should be enabled.");
is(!!selectedBreakpoint.attachment.openPopup, false,
"The breakpoint on line " + aLine + " should not have opened a popup.");
is(gSources._conditionalPopupVisible, false,
"The breakpoint conditional expression popup should not have been shown.");
return gBreakpoints._getAdded(selectedBreakpoint.attachment).then(aBreakpointClient => {
is(aBreakpointClient.location.url, source.url,
"The breakpoint's client url is correct");
is(aBreakpointClient.location.line, aLine,
"The breakpoint's client line is correct");
isnot(aBreakpointClient.conditionalExpression, undefined,
"The breakpoint on line " + aLine + " should have a conditional expression.");
ok(isCaretPos(gPanel, aLine),
"The editor caret position is not properly set.");
});
}
}

View File

@ -36,7 +36,7 @@ function test() {
.then(() => resumeAndTestBreakpoint(27))
.then(() => resumeAndTestBreakpoint(28))
.then(() => resumeAndTestBreakpoint(29))
.then(() => resumeAndTestBreakpoint(30))
.then(() => resumeAndTestNoBreakpoint())
.then(() => {
return promise.all([
reloadActiveTab(gPanel, gDebugger.EVENTS.BREAKPOINT_SHOWN_IN_EDITOR, 13),

View File

@ -1,171 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test conditional breakpoints throwing exceptions
* with server support
*/
const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html";
function test() {
// Linux debug test slaves are a bit slow at this test sometimes.
requestLongerTimeout(2);
let gTab, gPanel, gDebugger;
let gEditor, gSources, gBreakpoints, gBreakpointsAdded, gBreakpointsRemoving;
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
gSources = gDebugger.DebuggerView.Sources;
gBreakpoints = gDebugger.DebuggerController.Breakpoints;
gBreakpointsAdded = gBreakpoints._added;
gBreakpointsRemoving = gBreakpoints._removing;
waitForSourceAndCaretAndScopes(gPanel, ".html", 17)
.then(() => addBreakpoints())
.then(() => initialChecks())
.then(() => resumeAndTestBreakpoint(18))
.then(() => resumeAndTestBreakpoint(19))
.then(() => resumeAndTestBreakpoint(20))
.then(() => resumeAndTestBreakpoint(23))
.then(() => resumeAndTestNoBreakpoint())
.then(() => closeDebuggerAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
callInTab(gTab, "ermahgerd");
});
function addBreakpoints() {
return promise.resolve(null)
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue,
line: 18,
condition: "1a"
}))
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue,
line: 19,
condition: "new Error()"
}))
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue,
line: 20,
condition: "true"
}))
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue,
line: 21,
condition: "false"
}))
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue,
line: 22,
condition: "undefined"
}))
.then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue,
line: 23,
condition: "randomVar"
}));
}
function initialChecks() {
is(gDebugger.gThreadClient.state, "paused",
"Should only be getting stack frames while paused.");
is(gSources.itemCount, 1,
"Found the expected number of sources.");
is(gEditor.getText().indexOf("ermahgerd"), 253,
"The correct source was loaded initially.");
is(gSources.selectedValue, gSources.values[0],
"The correct source is selected.");
is(gBreakpointsAdded.size, 6,
"6 breakpoints currently added.");
is(gBreakpointsRemoving.size, 0,
"No breakpoints currently being removed.");
is(gEditor.getBreakpoints().length, 6,
"6 breakpoints currently shown in the editor.");
ok(!gBreakpoints._getAdded({ url: "foo", line: 3 }),
"_getAdded('foo', 3) returns falsey.");
ok(!gBreakpoints._getRemoving({ url: "bar", line: 3 }),
"_getRemoving('bar', 3) returns falsey.");
}
function resumeAndTestBreakpoint(aLine) {
let finished = waitForCaretUpdated(gPanel, aLine).then(() => testBreakpoint(aLine));
EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.getElementById("resume"),
gDebugger);
return finished;
}
function resumeAndTestNoBreakpoint() {
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_CLEARED).then(() => {
is(gSources.itemCount, 1,
"Found the expected number of sources.");
is(gEditor.getText().indexOf("ermahgerd"), 253,
"The correct source was loaded initially.");
is(gSources.selectedValue, gSources.values[0],
"The correct source is selected.");
ok(gSources.selectedItem,
"There should be a selected source in the sources pane.")
ok(!gSources._selectedBreakpointItem,
"There should be no selected breakpoint in the sources pane.")
is(gSources._conditionalPopupVisible, false,
"The breakpoint conditional expression popup should not be shown.");
is(gDebugger.document.querySelectorAll(".dbg-stackframe").length, 0,
"There should be no visible stackframes.");
is(gDebugger.document.querySelectorAll(".dbg-breakpoint").length, 6,
"There should be thirteen visible breakpoints.");
});
gDebugger.gThreadClient.resume();
return finished;
}
function testBreakpoint(aLine, aHighlightBreakpoint) {
// Highlight the breakpoint only if required.
if (aHighlightBreakpoint) {
let finished = waitForCaretUpdated(gPanel, aLine).then(() => testBreakpoint(aLine));
gSources.highlightBreakpoint({ actor: gSources.selectedValue, line: aLine });
return finished;
}
let selectedActor = gSources.selectedValue;
let selectedBreakpoint = gSources._selectedBreakpointItem;
ok(selectedActor,
"There should be a selected item in the sources pane.");
ok(selectedBreakpoint,
"There should be a selected brekapoint in the sources pane.");
is(selectedBreakpoint.attachment.actor, selectedActor,
"The breakpoint on line " + aLine + " wasn't added on the correct source.");
is(selectedBreakpoint.attachment.line, aLine,
"The breakpoint on line " + aLine + " wasn't found.");
is(!!selectedBreakpoint.attachment.disabled, false,
"The breakpoint on line " + aLine + " should be enabled.");
is(!!selectedBreakpoint.attachment.openPopup, false,
"The breakpoint on line " + aLine + " should not have opened a popup.");
is(gSources._conditionalPopupVisible, false,
"The breakpoint conditional expression popup should not have been shown.");
return gBreakpoints._getAdded(selectedBreakpoint.attachment).then(aBreakpointClient => {
is(aBreakpointClient.location.actor, selectedActor,
"The breakpoint's client url is correct");
is(aBreakpointClient.location.line, aLine,
"The breakpoint's client line is correct");
isnot(aBreakpointClient.condition, undefined,
"The breakpoint on line " + aLine + " should have a conditional expression.");
ok(isCaretPos(gPanel, aLine),
"The editor caret position is not properly set.");
});
}
}

View File

@ -4696,27 +4696,13 @@ BreakpointActor.prototype = {
*
* @param aFrame Debugger.Frame
* The frame to evaluate the condition in
* @returns Boolean
* Indicates whether to pause or not, returns undefined when
* evaluation was killed
*/
checkCondition: function(aFrame) {
let completion = aFrame.eval(this.condition);
if (completion) {
if (completion.throw) {
// The evaluation failed and threw an error, currently
// we will only return true to break on the error
return true;
} else if (completion.yield) {
dbg_assert(false,
"Shouldn't ever get yield completions from an eval");
} else {
return completion.return ? true : false;
}
} else {
// The evaluation was killed (possibly by the slow script dialog)
return undefined;
isValidCondition: function(aFrame) {
if (!this.condition) {
return true;
}
var res = aFrame.eval(this.condition);
return res.return;
},
/**
@ -4734,20 +4720,18 @@ BreakpointActor.prototype = {
let url = sourceActor.url;
if (this.threadActor.sources.isBlackBoxed(url)
|| aFrame.onStep) {
|| aFrame.onStep
|| !this.isValidCondition(aFrame)) {
return undefined;
}
let reason = {};
if (this.threadActor._hiddenBreakpoints.has(this.actorID)) {
reason.type = "pauseOnDOMEvents";
} else if (!this.condition || this.checkCondition(aFrame)) {
} else {
reason.type = "breakpoint";
// TODO: add the rest of the breakpoints on that line (bug 676602).
reason.actors = [ this.actorID ];
} else {
return undefined;
}
return this.threadActor._pauseAndRespond(aFrame, reason);
},

View File

@ -2,7 +2,7 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Check conditional breakpoint when condition throws and make sure it pauses
* Check conditional breakpoint when condition throws and make sure it is ignored
*/
var gDebuggee;
@ -33,8 +33,8 @@ function test_simple_breakpoint()
}, function (aResponse, bpClient) {
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
// Check the return value.
do_check_eq(aPacket.why.type, "breakpoint");
do_check_eq(aPacket.frame.where.line, 3);
do_check_eq(aPacket.why.type, "debuggerStatement");
do_check_eq(aPacket.frame.where.line, 4);
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
@ -53,7 +53,8 @@ function test_simple_breakpoint()
Components.utils.evalInSandbox("debugger;\n" + // 1
"var a = 1;\n" + // 2
"var b = 2;\n", // 3
"var b = 2;\n" + // 3
"debugger;", // 4
gDebuggee,
"1.8",
"test.js",