зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 041986a971af because I forgot to add the "r=..." to the commit message
This commit is contained in:
Родитель
6d28a4bf0b
Коммит
2f124f7556
|
@ -106,7 +106,7 @@ BreakpointStore.prototype = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a breakpoint from the breakpoint store. Will throw an error if the
|
* Get a breakpoint from the breakpoint store. Will throw an error if the
|
||||||
* breakpoint is not found.
|
* breakpoint is not found unless you explicitly silence it.
|
||||||
*
|
*
|
||||||
* @param Object aLocation
|
* @param Object aLocation
|
||||||
* The location of the breakpoint you are retrieving. It is an object
|
* The location of the breakpoint you are retrieving. It is an object
|
||||||
|
@ -114,35 +114,11 @@ BreakpointStore.prototype = {
|
||||||
* - url
|
* - url
|
||||||
* - line
|
* - line
|
||||||
* - column (optional)
|
* - column (optional)
|
||||||
|
* @param bool aShouldThrow
|
||||||
|
* Optional; defaults to true. Whether an error should be thrown when
|
||||||
|
* there is no breakpoint at the specified locaiton.
|
||||||
*/
|
*/
|
||||||
getBreakpoint: function BS_getBreakpoint(aLocation) {
|
getBreakpoint: function BS_getBreakpoint(aLocation, aShouldThrow=true) {
|
||||||
let { url, line, column } = aLocation;
|
|
||||||
dbg_assert(url != null);
|
|
||||||
dbg_assert(line != null);
|
|
||||||
|
|
||||||
var foundBreakpoint = this.hasBreakpoint(aLocation);
|
|
||||||
if (foundBreakpoint == null) {
|
|
||||||
throw new Error("No breakpoint at url = " + url
|
|
||||||
+ ", line = " + line
|
|
||||||
+ ", column = " + column);
|
|
||||||
}
|
|
||||||
|
|
||||||
return foundBreakpoint;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the breakpoint store has a requested breakpoint
|
|
||||||
* Returns the stored breakpoint if it exists
|
|
||||||
* null otherwise
|
|
||||||
*
|
|
||||||
* @param Object aLocation
|
|
||||||
* The location of the breakpoint you are retrieving. It is an object
|
|
||||||
* with the following properties:
|
|
||||||
* - url
|
|
||||||
* - line
|
|
||||||
* - column (optional)
|
|
||||||
*/
|
|
||||||
hasBreakpoint: function BS_hasBreakpoint(aLocation) {
|
|
||||||
let { url, line, column } = aLocation;
|
let { url, line, column } = aLocation;
|
||||||
dbg_assert(url != null);
|
dbg_assert(url != null);
|
||||||
dbg_assert(line != null);
|
dbg_assert(line != null);
|
||||||
|
@ -153,7 +129,11 @@ BreakpointStore.prototype = {
|
||||||
// one.
|
// one.
|
||||||
return bp;
|
return bp;
|
||||||
}
|
}
|
||||||
|
if (aShouldThrow) {
|
||||||
|
throw new Error("No breakpoint at url = " + url
|
||||||
|
+ ", line = " + line
|
||||||
|
+ ", column = " + column);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1098,8 +1078,7 @@ ThreadActor.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
let existingBp = this.breakpointStore.hasBreakpoint(actualLocation);
|
let existingBp = this.breakpointStore.getBreakpoint(actualLocation, false);
|
||||||
|
|
||||||
if (existingBp && existingBp.actor) {
|
if (existingBp && existingBp.actor) {
|
||||||
/**
|
/**
|
||||||
* We already have a breakpoint actor for the actual location, so
|
* We already have a breakpoint actor for the actual location, so
|
||||||
|
|
|
@ -12,52 +12,14 @@ function run_test()
|
||||||
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
||||||
loader.loadSubScript("resource://gre/modules/devtools/server/actors/script.js");
|
loader.loadSubScript("resource://gre/modules/devtools/server/actors/script.js");
|
||||||
|
|
||||||
test_has_breakpoint();
|
|
||||||
test_bug_754251();
|
test_bug_754251();
|
||||||
test_add_breakpoint();
|
test_add_breakpoint();
|
||||||
test_remove_breakpoint();
|
test_remove_breakpoint();
|
||||||
test_find_breakpoints();
|
test_find_breakpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_has_breakpoint() {
|
|
||||||
let bpStore = new BreakpointStore();
|
|
||||||
let location = {
|
|
||||||
url: "http://example.com/foo.js",
|
|
||||||
line: 3
|
|
||||||
};
|
|
||||||
let columnLocation = {
|
|
||||||
url: "http://example.com/bar.js",
|
|
||||||
line: 5,
|
|
||||||
column: 15
|
|
||||||
};
|
|
||||||
|
|
||||||
// Shouldn't have breakpoint
|
|
||||||
do_check_eq(null, bpStore.hasBreakpoint(location),
|
|
||||||
"Breakpoint not added and shouldn't exist.");
|
|
||||||
|
|
||||||
bpStore.addBreakpoint(location);
|
|
||||||
do_check_true(!!bpStore.hasBreakpoint(location),
|
|
||||||
"Breakpoint added but not found in Breakpoint Store.");
|
|
||||||
|
|
||||||
bpStore.removeBreakpoint(location);
|
|
||||||
do_check_eq(null, bpStore.hasBreakpoint(location),
|
|
||||||
"Breakpoint removed but still exists.");
|
|
||||||
|
|
||||||
// Same checks for breakpoint with a column
|
|
||||||
do_check_eq(null, bpStore.hasBreakpoint(columnLocation),
|
|
||||||
"Breakpoint with column not added and shouldn't exist.");
|
|
||||||
|
|
||||||
bpStore.addBreakpoint(columnLocation);
|
|
||||||
do_check_true(!!bpStore.hasBreakpoint(columnLocation),
|
|
||||||
"Breakpoint with column added but not found in Breakpoint Store.");
|
|
||||||
|
|
||||||
bpStore.removeBreakpoint(columnLocation);
|
|
||||||
do_check_eq(null, bpStore.hasBreakpoint(columnLocation),
|
|
||||||
"Breakpoint with column removed but still exists in Breakpoint Store.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: Removing this test will regress bug 754251. See comment above
|
// Note: Removing this test will regress bug 754251. See comment above
|
||||||
// ThreadActor.breakpointStore.
|
// ThreadActor._breakpointStore.
|
||||||
function test_bug_754251() {
|
function test_bug_754251() {
|
||||||
let instance1 = new ThreadActor();
|
let instance1 = new ThreadActor();
|
||||||
let instance2 = new ThreadActor();
|
let instance2 = new ThreadActor();
|
||||||
|
@ -75,7 +37,7 @@ function test_add_breakpoint() {
|
||||||
column: 9
|
column: 9
|
||||||
};
|
};
|
||||||
bpStore.addBreakpoint(location);
|
bpStore.addBreakpoint(location);
|
||||||
do_check_true(!!bpStore.hasBreakpoint(location),
|
do_check_true(!!bpStore.getBreakpoint(location, false),
|
||||||
"We should have the column breakpoint we just added");
|
"We should have the column breakpoint we just added");
|
||||||
|
|
||||||
// Breakpoint without column (whole line breakpoint)
|
// Breakpoint without column (whole line breakpoint)
|
||||||
|
@ -84,7 +46,7 @@ function test_add_breakpoint() {
|
||||||
line: 103
|
line: 103
|
||||||
};
|
};
|
||||||
bpStore.addBreakpoint(location);
|
bpStore.addBreakpoint(location);
|
||||||
do_check_true(!!bpStore.hasBreakpoint(location),
|
do_check_true(!!bpStore.getBreakpoint(location, false),
|
||||||
"We should have the whole line breakpoint we just added");
|
"We should have the whole line breakpoint we just added");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +60,7 @@ function test_remove_breakpoint() {
|
||||||
};
|
};
|
||||||
bpStore.addBreakpoint(location);
|
bpStore.addBreakpoint(location);
|
||||||
bpStore.removeBreakpoint(location);
|
bpStore.removeBreakpoint(location);
|
||||||
do_check_eq(bpStore.hasBreakpoint(location), null,
|
do_check_eq(bpStore.getBreakpoint(location, false), null,
|
||||||
"We should not have the column breakpoint anymore");
|
"We should not have the column breakpoint anymore");
|
||||||
|
|
||||||
// Breakpoint without column (whole line breakpoint)
|
// Breakpoint without column (whole line breakpoint)
|
||||||
|
@ -108,7 +70,7 @@ function test_remove_breakpoint() {
|
||||||
};
|
};
|
||||||
bpStore.addBreakpoint(location);
|
bpStore.addBreakpoint(location);
|
||||||
bpStore.removeBreakpoint(location);
|
bpStore.removeBreakpoint(location);
|
||||||
do_check_eq(bpStore.hasBreakpoint(location), null,
|
do_check_eq(bpStore.getBreakpoint(location, false), null,
|
||||||
"We should not have the whole line breakpoint anymore");
|
"We should not have the whole line breakpoint anymore");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче