Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: test/mjsunit/debug-event-listener.js

Issue 19753: Changed the debugger API to allow only one debug event listener to be registe... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/debug-evaluate-with.js ('k') | test/mjsunit/debug-handle.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 24 matching lines...) Expand all
35 if (event == Debug.DebugEvent.Break || 35 if (event == Debug.DebugEvent.Break ||
36 event == Debug.DebugEvent.Exception) 36 event == Debug.DebugEvent.Exception)
37 { 37 {
38 lastDebugEvent.event = event; 38 lastDebugEvent.event = event;
39 lastDebugEvent.frameFuncName = exec_state.frame().func().name(); 39 lastDebugEvent.frameFuncName = exec_state.frame().func().name();
40 lastDebugEvent.event_data = event_data; 40 lastDebugEvent.event_data = event_data;
41 } 41 }
42 }; 42 };
43 43
44 // Add the debug event listener. 44 // Add the debug event listener.
45 Debug.addListener(listener); 45 Debug.setListener(listener);
46 // Get events from handled exceptions. 46 // Get events from handled exceptions.
47 Debug.setBreakOnException(); 47 Debug.setBreakOnException();
48 48
49 // Test debug event for handled exception. 49 // Test debug event for handled exception.
50 (function f(){ 50 (function f(){
51 try { 51 try {
52 x(); 52 x();
53 } catch(e) { 53 } catch(e) {
54 // Do nothing. Ignore exception. 54 // Do nothing. Ignore exception.
55 } 55 }
56 })(); 56 })();
57 assertTrue(lastDebugEvent.event == Debug.DebugEvent.Exception); 57 assertTrue(lastDebugEvent.event == Debug.DebugEvent.Exception);
58 assertEquals(lastDebugEvent.frameFuncName, "f"); 58 assertEquals(lastDebugEvent.frameFuncName, "f");
59 assertFalse(lastDebugEvent.event_data.uncaught()); 59 assertFalse(lastDebugEvent.event_data.uncaught());
60 Debug.clearBreakOnException(); 60 Debug.clearBreakOnException();
61 61
62 // Test debug event for break point. 62 // Test debug event for break point.
63 function a() { 63 function a() {
64 x = 1; 64 x = 1;
65 y = 2; 65 y = 2;
66 z = 3; 66 z = 3;
67 }; 67 };
68 Debug.setBreakPoint(a, 1); 68 Debug.setBreakPoint(a, 1);
69 a(); 69 a();
70 assertTrue(lastDebugEvent.event == Debug.DebugEvent.Break); 70 assertTrue(lastDebugEvent.event == Debug.DebugEvent.Break);
71 assertEquals(lastDebugEvent.frameFuncName, "a"); 71 assertEquals(lastDebugEvent.frameFuncName, "a");
72 72
73 Debug.removeListener(listener); 73 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-evaluate-with.js ('k') | test/mjsunit/debug-handle.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698