| Index: test/mjsunit/debug-stepout-scope-part5.js
|
| diff --git a/test/mjsunit/harmony/debug-evaluate-blockscopes.js b/test/mjsunit/debug-stepout-scope-part5.js
|
| similarity index 56%
|
| copy from test/mjsunit/harmony/debug-evaluate-blockscopes.js
|
| copy to test/mjsunit/debug-stepout-scope-part5.js
|
| index d6ce8b2b6a8c8050e1769297f865d06cf007bc6b..f060ec38892de4b850ad349cd1f703b2c356853b 100644
|
| --- a/test/mjsunit/harmony/debug-evaluate-blockscopes.js
|
| +++ b/test/mjsunit/debug-stepout-scope-part5.js
|
| @@ -25,46 +25,53 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --expose-debug-as debug --harmony-scoping
|
| +// Flags: --expose-debug-as debug --expose-natives-as=builtins
|
|
|
| -// Test debug evaluation for functions without local context, but with
|
| -// nested catch contexts.
|
| +// Check that the ScopeIterator can properly recreate the scope at
|
| +// every point when stepping through functions.
|
|
|
| -// TODO(ES6): properly activate extended mode
|
| -"use strict";
|
| +var Debug = debug.Debug;
|
|
|
| -var x;
|
| -var result;
|
| +function listener(event, exec_state, event_data, data) {
|
| + if (event == Debug.DebugEvent.Break) {
|
| + // Access scope details.
|
| + var scope_count = exec_state.frame().scopeCount();
|
| + for (var i = 0; i < scope_count; i++) {
|
| + var scope = exec_state.frame().scope(i);
|
| + // assertTrue(scope.isScope());
|
| + scope.scopeType();
|
| + scope.scopeObject();
|
| + }
|
|
|
| -function f() {
|
| - { // Line 1.
|
| - let i = 1; // Line 2.
|
| - try { // Line 3.
|
| - throw 'stuff'; // Line 4.
|
| - } catch (e) { // Line 5.
|
| - x = 2; // Line 6.
|
| + // Do steps until we reach the global scope again.
|
| + if (true) {
|
| + exec_state.prepareStep(Debug.StepAction.StepInMin, 1);
|
| }
|
| }
|
| -};
|
| +}
|
|
|
| -// Get the Debug object exposed from the debug context global object.
|
| -var Debug = debug.Debug
|
| -// Set breakpoint on line 6.
|
| -var bp = Debug.setBreakPoint(f, 6);
|
| +Debug.setListener(listener);
|
|
|
| -function listener(event, exec_state, event_data, data) {
|
| - if (event == Debug.DebugEvent.Break) {
|
| - result = exec_state.frame().evaluate("i").value();
|
| - }
|
| -};
|
| +var q = 42;
|
| +var prefixes = [ "debugger; ",
|
| + "if (false) { try { throw 0; } catch(x) { return x; } }; debugger; " ];
|
| +var with_bodies = [ "with ({}) {}",
|
| + "with ({x:1}) x",
|
| + "with ({x:1}) x = 1",
|
| + "with ({x:1}) x ",
|
| + "with ({x:1}) x = 1 ",
|
| + "with ({x:1}) x;",
|
| + "with ({x:1}) x = 1;",
|
| + "with ({x:1}) x; ",
|
| + "with ({x:1}) x = 1; " ];
|
|
|
| -// Add the debug event listener.
|
| -Debug.setListener(listener);
|
| -result = -1;
|
| -f();
|
| -assertEquals(1, result);
|
|
|
| -// Clear breakpoint.
|
| -Debug.clearBreakPoint(bp);
|
| -// Get rid of the debug event listener.
|
| -Debug.setListener(null);
|
| +// Test global eval and function constructor.
|
| +for (var i = 0; i < prefixes.length; ++i) {
|
| + var pre = prefixes[i];
|
| + for (var j = 0; j < with_bodies.length; ++j) {
|
| + var body = with_bodies[j];
|
| + eval(pre + body);
|
| + Function(pre + body)();
|
| + }
|
| +}
|
|
|