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

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

Issue 2720013003: [debug] add more tests for side-effect free debug-evaluate. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug/debug-evaluate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/debugger/debug/debug-evaluate-no-side-effect.js
diff --git a/test/debugger/debug/debug-evaluate-no-side-effect.js b/test/debugger/debug/debug-evaluate-no-side-effect.js
index 26afa9b6e9c5eab61e645d878c6b09f79af43288..5796a747ca5b5a045df818ac457761fe0973affe 100644
--- a/test/debugger/debug/debug-evaluate-no-side-effect.js
+++ b/test/debugger/debug/debug-evaluate-no-side-effect.js
@@ -17,8 +17,10 @@ var array = [4, 5];
var error = new Error();
function set_a() { a = 2; }
-
function get_a() { return a; }
+var bound = get_a.bind(0);
+
+var global_eval = eval;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
@@ -47,6 +49,8 @@ function listener(event, exec_state, event_data, data) {
success(5, "array[1]");
// Call to read-only function.
success(1, "get_a()");
+ success(1, "bound()");
+ success({}, "new get_a()");
// Call to read-only function within try-catch.
success(1, "try { get_a() } catch (e) {}");
// Call to C++ built-in.
@@ -54,10 +58,16 @@ function listener(event, exec_state, event_data, data) {
// Call to whitelisted get accessors.
success(3, "'abc'.length");
success(2, "array.length");
+ success(1, "'x'.length");
+ success(0, "set_a.length");
+ success("set_a", "set_a.name");
+ success(0, "bound.length");
+ success("bound get_a", "bound.name");
// Test that non-read-only code fails.
fail("exception = 1");
// Test that calling a non-read-only function fails.
fail("set_a()");
+ fail("new set_a()");
// Test that implicit call to a non-read-only function fails.
fail("string2 + 'y'");
// Test that try-catch does not catch the EvalError.
@@ -66,6 +76,10 @@ function listener(event, exec_state, event_data, data) {
fail("array.length = 4");
// Test that call to non-whitelisted get accessor fails.
fail("error.stack");
+ // Eval is not allowed.
+ fail("eval('Math.sin(1)')");
+ fail("eval('exception = 1')");
+ fail("global_eval('1')");
} catch (e) {
exception = e;
print(e, e.stack);
« no previous file with comments | « src/debug/debug-evaluate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698