After compile event should be sent even if there is a provisional breakpoint out of its lines range.

Review URL: http://codereview.chromium.org/141041

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2234 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yurys@chromium.org 2009-06-22 11:56:36 +00:00
parent 3ce873c351
commit 46165adb9a
2 changed files with 38 additions and 1 deletions

View File

@ -388,7 +388,7 @@ ScriptBreakPoint.prototype.clear = function () {
function UpdateScriptBreakPoints(script) {
for (var i = 0; i < script_break_points.length; i++) {
if (script_break_points[i].type() == Debug.ScriptBreakPointType.ScriptName &&
script_break_points[i].script_name() == script.name) {
script_break_points[i].matchesScript(script)) {
script_break_points[i].set(script);
}
}

View File

@ -5257,3 +5257,40 @@ TEST(ExceptionMessageWhenMessageHandlerIsReset) {
CHECK_EQ(1, exception_event_count);
}
// Tests after compile event is sent when there are some provisional
// breakpoints out of the scripts lines range.
TEST(ProvisionalBreakpointOnLineOutOfRange) {
v8::HandleScope scope;
DebugLocalContext env;
env.ExposeDebug();
const char* script = "function f() {};";
const char* resource_name = "test_resource";
// Set a couple of provisional breakpoint on lines out of the script lines
// range.
int sbp1 = SetScriptBreakPointByNameFromJS(resource_name, 3,
-1 /* no column */);
int sbp2 = SetScriptBreakPointByNameFromJS(resource_name, 5, 5);
after_compile_message_count = 0;
v8::Debug::SetMessageHandler2(AfterCompileMessageHandler);
v8::ScriptOrigin origin(
v8::String::New(resource_name),
v8::Integer::New(10),
v8::Integer::New(1));
// Compile a script whose first line number is greater than the breakpoints'
// lines.
v8::Script::Compile(v8::String::New(script), &origin)->Run();
// If the script is compiled successfully there is exactly one after compile
// event. In case of an exception in debugger code after compile event is not
// sent.
CHECK_EQ(1, after_compile_message_count);
ClearBreakPointFromJS(sbp1);
ClearBreakPointFromJS(sbp2);
v8::Debug::SetMessageHandler2(NULL);
}