Bug 1205305 - Fix a race condition in browser_dbg_server-conditional-bp-02.js;r=jlong

This commit is contained in:
Eddy Bruel 2015-10-08 16:33:37 +02:00
Родитель f585881d65
Коммит f39b849fea
4 изменённых файлов: 22 добавлений и 11 удалений

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

@ -42,6 +42,7 @@ const EVENTS = {
// When a breakpoint has been added or removed on the debugger server.
BREAKPOINT_ADDED: "Debugger:BreakpointAdded",
BREAKPOINT_REMOVED: "Debugger:BreakpointRemoved",
BREAKPOINT_CLICKED: "Debugger:BreakpointClicked",
// When a breakpoint has been shown or hidden in the source editor
// or the pane.

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

@ -195,8 +195,10 @@ function test() {
}
function clickOnBreakpoint(aIndex) {
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_CLICKED);
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.querySelectorAll(".dbg-breakpoint")[aIndex],
gDebugger);
return finished;
}
}

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

@ -184,8 +184,10 @@ function test() {
}
function clickOnBreakpoint(aIndex) {
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_CLICKED);
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.querySelectorAll(".dbg-breakpoint")[aIndex],
gDebugger);
return finished;
}
}

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

@ -466,9 +466,9 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
// If the breakpoint requires a new conditional expression, display
// the panel to input the corresponding expression.
if (aOptions.openPopup) {
this._openConditionalPopup();
return this._openConditionalPopup();
} else {
this._hideConditionalPopup();
return this._hideConditionalPopup();
}
},
@ -717,13 +717,13 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
// retrieve the current conditional epression.
let breakpointPromise = this.Breakpoints._getAdded(attachment);
if (breakpointPromise) {
breakpointPromise.then(aBreakpointClient => {
return breakpointPromise.then(aBreakpointClient => {
let isConditionalBreakpoint = aBreakpointClient.hasCondition();
let condition = aBreakpointClient.getCondition();
doOpen.call(this, isConditionalBreakpoint ? condition : "")
return doOpen.call(this, isConditionalBreakpoint ? condition : "")
});
} else {
doOpen.call(this, "")
return doOpen.call(this, "")
}
function doOpen(aConditionalExpression) {
@ -1040,18 +1040,24 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
let attachment = breakpointItem.attachment;
// Check if this is an enabled conditional breakpoint.
let breakpointPromise = this.Breakpoints._getAdded(attachment);
if (breakpointPromise) {
breakpointPromise.then(aBreakpointClient => {
doHighlight.call(this, aBreakpointClient.hasCondition());
let promise = this.Breakpoints._getAdded(attachment);
if (promise) {
promise = promise.then(aBreakpointClient => {
return doHighlight.call(this, aBreakpointClient.hasCondition());
});
} else {
doHighlight.call(this, false);
promise = Promise.resolve().then(() => {
return doHighlight.call(this, false)
});
}
promise.then(() => {
window.emit(EVENTS.BREAKPOINT_CLICKED);
});
function doHighlight(aConditionalBreakpointFlag) {
// Highlight the breakpoint in this pane and in the editor.
this.highlightBreakpoint(attachment, {
return this.highlightBreakpoint(attachment, {
// Don't show the conditional expression popup if this is not a
// conditional breakpoint, or the right mouse button was pressed (to
// avoid clashing the popup with the context menu).