| 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 7374 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7385   const char* script_1 = "debugger; throw new Error();"; | 7385   const char* script_1 = "debugger; throw new Error();"; | 
| 7386   RunScriptInANewCFrame(script_1); | 7386   RunScriptInANewCFrame(script_1); | 
| 7387 | 7387 | 
| 7388   // The second script uses forEach. | 7388   // The second script uses forEach. | 
| 7389   const char* script_2 = "[0].forEach(function() { });"; | 7389   const char* script_2 = "[0].forEach(function() { });"; | 
| 7390   CompileRun(script_2); | 7390   CompileRun(script_2); | 
| 7391 | 7391 | 
| 7392   v8::Debug::SetDebugEventListener(NULL); | 7392   v8::Debug::SetDebugEventListener(NULL); | 
| 7393 } | 7393 } | 
| 7394 | 7394 | 
|  | 7395 | 
|  | 7396 // Import from test-heap.cc | 
|  | 7397 int CountGlobalContexts(); | 
|  | 7398 | 
|  | 7399 | 
|  | 7400 static void NopListener(v8::DebugEvent event, | 
|  | 7401                         v8::Handle<v8::Object> exec_state, | 
|  | 7402                         v8::Handle<v8::Object> event_data, | 
|  | 7403                         v8::Handle<v8::Value> data) { | 
|  | 7404 } | 
|  | 7405 | 
|  | 7406 | 
|  | 7407 TEST(DebuggerCreatesContextIffActive) { | 
|  | 7408   v8::HandleScope scope; | 
|  | 7409   DebugLocalContext env; | 
|  | 7410   CHECK_EQ(1, CountGlobalContexts()); | 
|  | 7411 | 
|  | 7412   v8::Debug::SetDebugEventListener(NULL); | 
|  | 7413   CompileRun("debugger;"); | 
|  | 7414   CHECK_EQ(1, CountGlobalContexts()); | 
|  | 7415 | 
|  | 7416   v8::Debug::SetDebugEventListener(NopListener); | 
|  | 7417   CompileRun("debugger;"); | 
|  | 7418   CHECK_EQ(2, CountGlobalContexts()); | 
|  | 7419 | 
|  | 7420   v8::Debug::SetDebugEventListener(NULL); | 
|  | 7421 } | 
|  | 7422 | 
| 7395 #endif  // ENABLE_DEBUGGER_SUPPORT | 7423 #endif  // ENABLE_DEBUGGER_SUPPORT | 
| OLD | NEW | 
|---|