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

Side by Side Diff: test/debugger/debug/debug-evaluate-no-side-effect.js

Issue 2622863003: [debugger] infrastructure for side-effect-free debug-evaluate. (Closed)
Patch Set: fix mips one more time Created 3 years, 11 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
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --ignition --side-effect-free-debug-evaluate
6
7 Debug = debug.Debug
8
9 var exception = null;
10 let a = 1;
11 var object = { property : 2,
12 get getter() { return 3; }
13 };
14 var string1 = { toString() { return "x"; } };
15 var string2 = { toString() { print("x"); return "x"; } };
16 var array = [4, 5];
17 var error = new Error();
18
19 function set_a() { a = 2; }
20
21 function get_a() { return a; }
22
23 function listener(event, exec_state, event_data, data) {
24 if (event != Debug.DebugEvent.Break) return;
25 try {
26 function success(expectation, source) {
27 assertEquals(expectation, exec_state.frame(0).evaluate(source).value());
28 }
29 function fail(source) {
30 assertThrows(() => exec_state.frame(0).evaluate(source), EvalError);
31 }
32 // Simple test.
33 success(3, "1 + 2");
34 // Dymanic load.
35 success(array, "array");
36 // Context load.
37 success(1, "a");
38 // Global and named property load.
39 success(2, "object.property");
40 // Load via read-only getter.
41 success(3, "object.getter");
42 // Implicit call to read-only toString.
43 success("xy", "string1 + 'y'");
44 // Keyed property load.
45 success(5, "array[1]");
46 // Call to read-only function.
47 success(1, "get_a()");
48 // Call to read-only function within try-catch.
49 success(1, "try { get_a() } catch (e) {}");
50 // Call to C++ built-in.
51 success(Math.sin(2), "Math.sin(2)");
52 // Call to whitelisted get accessors.
53 success(3, "'abc'.length");
54 success(2, "array.length");
55 // Test that non-read-only code fails.
56 fail("exception = 1");
57 // Test that calling a non-read-only function fails.
58 fail("set_a()");
59 // Test that implicit call to a non-read-only function fails.
60 fail("string2 + 'y'");
61 // Test that try-catch does not catch the EvalError.
62 fail("try { set_a() } catch (e) {}");
63 // Test that call to set accessor fails.
64 fail("array.length = 4");
65 // Test that call to non-whitelisted get accessor fails.
66 fail("error.stack");
67 } catch (e) {
68 exception = e;
69 print(e, e.stack);
70 };
71 };
72
73 // Add the debug event listener.
74 Debug.setListener(listener);
75
76 function f() {
77 debugger;
78 };
79
80 f();
81
82 assertNull(exception);
83 assertEquals(1, a);
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698