v8/test/debugger/regress/regress-9482.js
Simon Zünd 1b5697cc9e Add test for debug evaluating a previously non-whitelisted variable
This CL adds a test where we evaluate a variable that is context
allocated (through the use of 'eval'), but not used by the closure.
This did not work with the previous whitelist approach, but works now
with the new blacklist approach (see https://crrev.com/c/1795354)

Bug: v8:9482
Change-Id: I1e453dec0b624bf7e0312100e119d86c9c481ba9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1796543
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63671}
2019-09-11 09:45:33 +00:00

33 lines
771 B
JavaScript

// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Debug = debug.Debug
var exception = null;
function listener(event, exec_state, event_data, data) {
try {
if (event == Debug.DebugEvent.Break) {
assertEquals("n", exec_state.frame(0).evaluate("n").value());
assertEquals("m", exec_state.frame(0).evaluate("m").value());
}
} catch(e) {
exception = e;
print(e, e.stack);
}
};
Debug.setListener(listener);
(function foo () {
var n = "n";
var m = "m";
(function bar() {
assertEquals("m", eval("m")); // force context-allocation.
debugger;
})();
})();
assertNull(exception);
Debug.setListener(null);