OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 7600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7611 "var obj = {};" | 7611 "var obj = {};" |
7612 "var callbackRan = false;" | 7612 "var callbackRan = false;" |
7613 "Object.observe(obj, function() {" | 7613 "Object.observe(obj, function() {" |
7614 " callbackRan = true;" | 7614 " callbackRan = true;" |
7615 " throw Error('foo');" | 7615 " throw Error('foo');" |
7616 "});" | 7616 "});" |
7617 "obj.prop = 1"); | 7617 "obj.prop = 1"); |
7618 CHECK(CompileRun("callbackRan")->BooleanValue()); | 7618 CHECK(CompileRun("callbackRan")->BooleanValue()); |
7619 CHECK_EQ(1, exception_event_counter); | 7619 CHECK_EQ(1, exception_event_counter); |
7620 } | 7620 } |
| 7621 |
| 7622 |
| 7623 static void DebugHarmonyScopingListener( |
| 7624 const v8::Debug::EventDetails& event_details) { |
| 7625 v8::DebugEvent event = event_details.GetEvent(); |
| 7626 if (event != v8::Break) return; |
| 7627 |
| 7628 int break_id = CcTest::i_isolate()->debug()->break_id(); |
| 7629 |
| 7630 char script[128]; |
| 7631 i::Vector<char> script_vector(script, sizeof(script)); |
| 7632 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); |
| 7633 v8::Local<v8::Value> result = CompileRun(script); |
| 7634 |
| 7635 CHECK_EQ(1, result->Int32Value()); |
| 7636 } |
| 7637 |
| 7638 |
| 7639 TEST(DebugBreakInLexicalScopes) { |
| 7640 i::FLAG_harmony_scoping = true; |
| 7641 i::FLAG_allow_natives_syntax = true; |
| 7642 |
| 7643 DebugLocalContext env; |
| 7644 v8::Isolate* isolate = env->GetIsolate(); |
| 7645 v8::HandleScope scope(isolate); |
| 7646 v8::Debug::SetDebugEventListener(DebugHarmonyScopingListener); |
| 7647 |
| 7648 CompileRun( |
| 7649 "'use strict'; \n" |
| 7650 "let x = 1; \n" |
| 7651 CompileRun( |
| 7652 "'use strict'; \n" |
| 7653 "let y = 1; \n" |
| 7654 "debugger \n"); |
| 7655 } |
OLD | NEW |