2011-10-21 10:26:59 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2009-06-12 10:03:25 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2016-12-14 07:20:13 +00:00
|
|
|
// Flags: --noanalyze-environment-liveness
|
2009-06-12 10:03:25 +00:00
|
|
|
// The functions used for testing backtraces. They are at the top to make the
|
|
|
|
// testing of source line/column easier.
|
|
|
|
|
2011-11-24 15:17:04 +00:00
|
|
|
var Debug = debug.Debug;
|
2009-06-12 10:03:25 +00:00
|
|
|
|
2011-04-15 11:35:36 +00:00
|
|
|
var test_name;
|
2009-06-12 10:03:25 +00:00
|
|
|
var listener_delegate;
|
|
|
|
var listener_called;
|
|
|
|
var exception;
|
|
|
|
var begin_test_count = 0;
|
|
|
|
var end_test_count = 0;
|
|
|
|
var break_count = 0;
|
2016-12-14 07:20:13 +00:00
|
|
|
var global_marker = 7;
|
2009-06-12 10:03:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Debug event listener which delegates.
|
|
|
|
function listener(event, exec_state, event_data, data) {
|
|
|
|
try {
|
|
|
|
if (event == Debug.DebugEvent.Break) {
|
|
|
|
break_count++;
|
|
|
|
listener_called = true;
|
2011-04-15 11:35:36 +00:00
|
|
|
listener_delegate(exec_state);
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
exception = e;
|
2016-12-14 07:20:13 +00:00
|
|
|
print(e, e.stack);
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the debug event listener.
|
|
|
|
Debug.setListener(listener);
|
|
|
|
|
|
|
|
|
2011-04-15 11:35:36 +00:00
|
|
|
// Initialize for a new test.
|
2009-06-12 10:03:25 +00:00
|
|
|
function BeginTest(name) {
|
|
|
|
test_name = name;
|
|
|
|
listener_delegate = null;
|
|
|
|
listener_called = false;
|
|
|
|
exception = null;
|
|
|
|
begin_test_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check result of a test.
|
|
|
|
function EndTest() {
|
2016-12-14 07:20:13 +00:00
|
|
|
assertTrue(listener_called, "listener not called for " + test_name);
|
2014-03-21 12:30:58 +00:00
|
|
|
assertNull(exception, test_name + " / " + exception);
|
2009-06-12 10:03:25 +00:00
|
|
|
end_test_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-07 11:03:35 +00:00
|
|
|
// Check that two scope are the same.
|
2014-03-21 12:30:58 +00:00
|
|
|
function assertScopeMirrorEquals(scope1, scope2) {
|
2014-03-07 11:03:35 +00:00
|
|
|
assertEquals(scope1.scopeType(), scope2.scopeType());
|
|
|
|
assertEquals(scope1.frameIndex(), scope2.frameIndex());
|
|
|
|
assertEquals(scope1.scopeIndex(), scope2.scopeIndex());
|
2014-03-21 12:30:58 +00:00
|
|
|
assertPropertiesEqual(scope1.scopeObject().value(), scope2.scopeObject().value());
|
|
|
|
}
|
|
|
|
|
|
|
|
function CheckFastAllScopes(scopes, exec_state)
|
|
|
|
{
|
|
|
|
var fast_all_scopes = exec_state.frame().allScopes(true);
|
|
|
|
var length = fast_all_scopes.length;
|
|
|
|
assertTrue(scopes.length >= length);
|
|
|
|
for (var i = 0; i < scopes.length && i < length; i++) {
|
|
|
|
var scope = fast_all_scopes[length - i - 1];
|
|
|
|
assertEquals(scopes[scopes.length - i - 1], scope.scopeType());
|
|
|
|
}
|
2014-03-07 11:03:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-12 10:03:25 +00:00
|
|
|
// Check that the scope chain contains the expected types of scopes.
|
|
|
|
function CheckScopeChain(scopes, exec_state) {
|
2014-03-07 11:03:35 +00:00
|
|
|
var all_scopes = exec_state.frame().allScopes();
|
2009-06-12 10:03:25 +00:00
|
|
|
assertEquals(scopes.length, exec_state.frame().scopeCount());
|
2014-03-07 11:03:35 +00:00
|
|
|
assertEquals(scopes.length, all_scopes.length, "FrameMirror.allScopes length");
|
2009-06-12 10:03:25 +00:00
|
|
|
for (var i = 0; i < scopes.length; i++) {
|
|
|
|
var scope = exec_state.frame().scope(i);
|
|
|
|
assertEquals(scopes[i], scope.scopeType());
|
2014-03-21 12:30:58 +00:00
|
|
|
assertScopeMirrorEquals(all_scopes[i], scope);
|
2010-03-05 07:05:26 +00:00
|
|
|
|
2009-06-12 10:03:25 +00:00
|
|
|
// Check the global object when hitting the global scope.
|
|
|
|
if (scopes[i] == debug.ScopeType.Global) {
|
2016-12-14 07:20:13 +00:00
|
|
|
// Just check the marker of the global object.
|
|
|
|
assertEquals(scope.scopeObject().value().global_marker, global_marker);
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
}
|
2014-03-21 12:30:58 +00:00
|
|
|
CheckFastAllScopes(scopes, exec_state);
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-09-30 17:24:25 +00:00
|
|
|
// Check that the scope chain contains the expected names of scopes.
|
|
|
|
function CheckScopeChainNames(names, exec_state) {
|
|
|
|
var all_scopes = exec_state.frame().allScopes();
|
|
|
|
assertEquals(names.length, all_scopes.length, "FrameMirror.allScopes length");
|
|
|
|
for (var i = 0; i < names.length; i++) {
|
|
|
|
var scope = exec_state.frame().scope(i);
|
2018-05-02 13:57:26 +00:00
|
|
|
// assertEquals(names[i], scope.details().name())
|
2015-09-30 17:24:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-27 09:48:17 +00:00
|
|
|
// Check that the scope contains at least minimum_content. For functions just
|
|
|
|
// check that there is a function.
|
|
|
|
function CheckScopeContent(minimum_content, number, exec_state) {
|
2011-04-15 11:35:36 +00:00
|
|
|
var scope = exec_state.frame().scope(number);
|
2016-09-27 09:48:17 +00:00
|
|
|
var minimum_count = 0;
|
|
|
|
for (var p in minimum_content) {
|
2009-06-12 10:03:25 +00:00
|
|
|
var property_mirror = scope.scopeObject().property(p);
|
2016-11-28 12:01:17 +00:00
|
|
|
assertFalse(property_mirror.isUndefined(),
|
|
|
|
'property ' + p + ' not found in scope');
|
2016-12-14 07:20:13 +00:00
|
|
|
assertEquals(minimum_content[p], property_mirror.value().value(),
|
|
|
|
'property ' + p + ' has unexpected value');
|
2016-09-27 09:48:17 +00:00
|
|
|
minimum_count++;
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
2010-03-05 07:05:26 +00:00
|
|
|
|
2009-06-12 10:03:25 +00:00
|
|
|
// 'arguments' and might be exposed in the local and closure scope. Just
|
|
|
|
// ignore this.
|
|
|
|
var scope_size = scope.scopeObject().properties().length;
|
|
|
|
if (!scope.scopeObject().property('arguments').isUndefined()) {
|
|
|
|
scope_size--;
|
|
|
|
}
|
2015-05-19 14:51:10 +00:00
|
|
|
// Ditto for 'this'.
|
|
|
|
if (!scope.scopeObject().property('this').isUndefined()) {
|
|
|
|
scope_size--;
|
|
|
|
}
|
2016-04-27 04:47:52 +00:00
|
|
|
// Temporary variables introduced by the parser have not been materialized.
|
|
|
|
assertTrue(scope.scopeObject().property('').isUndefined());
|
2009-09-08 10:20:28 +00:00
|
|
|
|
2016-09-27 09:48:17 +00:00
|
|
|
if (scope_size < minimum_count) {
|
2009-06-12 10:03:25 +00:00
|
|
|
print('Names found in scope:');
|
|
|
|
var names = scope.scopeObject().propertyNames();
|
|
|
|
for (var i = 0; i < names.length; i++) {
|
|
|
|
print(names[i]);
|
|
|
|
}
|
|
|
|
}
|
2016-09-27 09:48:17 +00:00
|
|
|
assertTrue(scope_size >= minimum_count);
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
|
2016-03-02 02:18:52 +00:00
|
|
|
// Check that the scopes have positions as expected.
|
|
|
|
function CheckScopeChainPositions(positions, exec_state) {
|
|
|
|
var all_scopes = exec_state.frame().allScopes();
|
|
|
|
assertEquals(positions.length, all_scopes.length, "FrameMirror.allScopes length");
|
|
|
|
for (var i = 0; i < positions.length; i++) {
|
|
|
|
var scope = exec_state.frame().scope(i);
|
|
|
|
var position = positions[i];
|
|
|
|
if (!position)
|
|
|
|
continue;
|
|
|
|
|
2018-05-02 13:57:26 +00:00
|
|
|
// assertEquals(position.start, scope.details().startPosition())
|
|
|
|
// assertEquals(position.end, scope.details().endPosition())
|
2016-03-02 02:18:52 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-12 10:03:25 +00:00
|
|
|
|
|
|
|
// Simple empty local scope.
|
|
|
|
BeginTest("Local 1");
|
|
|
|
|
|
|
|
function local_1() {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
local_1();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Local scope with a parameter.
|
|
|
|
BeginTest("Local 2");
|
|
|
|
|
|
|
|
function local_2(a) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
local_2(1);
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Local scope with a parameter and a local variable.
|
|
|
|
BeginTest("Local 3");
|
|
|
|
|
|
|
|
function local_3(a) {
|
|
|
|
var x = 3;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,x:3}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
local_3(1);
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Local scope with parameters and local variables.
|
|
|
|
BeginTest("Local 4");
|
|
|
|
|
|
|
|
function local_4(a, b) {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
local_4(1, 2);
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Empty local scope with use of eval.
|
|
|
|
BeginTest("Local 5");
|
|
|
|
|
|
|
|
function local_5() {
|
|
|
|
eval('');
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
local_5();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Local introducing local variable using eval.
|
|
|
|
BeginTest("Local 6");
|
|
|
|
|
|
|
|
function local_6() {
|
|
|
|
eval('var i = 5');
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({i:5}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
local_6();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Local scope with parameters, local variables and local variable introduced
|
|
|
|
// using eval.
|
|
|
|
BeginTest("Local 7");
|
|
|
|
|
|
|
|
function local_7(a, b) {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
eval('var i = 5');
|
|
|
|
eval('var j = 6');
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
local_7(1, 2);
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Single empty with block.
|
|
|
|
BeginTest("With 1");
|
|
|
|
|
|
|
|
function with_1() {
|
|
|
|
with({}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
with_1();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Nested empty with blocks.
|
|
|
|
BeginTest("With 2");
|
|
|
|
|
|
|
|
function with_2() {
|
|
|
|
with({}) {
|
|
|
|
with({}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
|
|
|
CheckScopeContent({}, 1, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
with_2();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// With block using an in-place object literal.
|
|
|
|
BeginTest("With 3");
|
|
|
|
|
|
|
|
function with_3() {
|
|
|
|
with({a:1,b:2}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2}, 0, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
with_3();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Nested with blocks using in-place object literals.
|
|
|
|
BeginTest("With 4");
|
|
|
|
|
|
|
|
function with_4() {
|
|
|
|
with({a:1,b:2}) {
|
|
|
|
with({a:2,b:1}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:2,b:1}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2}, 1, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
with_4();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Nested with blocks using existing object.
|
|
|
|
BeginTest("With 5");
|
|
|
|
|
|
|
|
var with_object = {c:3,d:4};
|
|
|
|
function with_5() {
|
|
|
|
with(with_object) {
|
|
|
|
with(with_object) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent(with_object, 0, exec_state);
|
|
|
|
CheckScopeContent(with_object, 1, exec_state);
|
2016-12-14 07:20:13 +00:00
|
|
|
assertEquals(exec_state.frame().scope(0).scopeObject().value(),
|
|
|
|
exec_state.frame().scope(1).scopeObject().value());
|
2009-06-12 10:03:25 +00:00
|
|
|
assertEquals(with_object, exec_state.frame().scope(1).scopeObject().value());
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
with_5();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-09-14 11:20:31 +00:00
|
|
|
// Nested with blocks using existing object in global code.
|
|
|
|
BeginTest("With 6");
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.With,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-09-14 11:20:31 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent(with_object, 0, exec_state);
|
|
|
|
CheckScopeContent(with_object, 1, exec_state);
|
2016-12-14 07:20:13 +00:00
|
|
|
assertEquals(exec_state.frame().scope(0).scopeObject().value(),
|
|
|
|
exec_state.frame().scope(1).scopeObject().value());
|
2011-09-14 11:20:31 +00:00
|
|
|
assertEquals(with_object, exec_state.frame().scope(1).scopeObject().value());
|
|
|
|
};
|
|
|
|
|
|
|
|
var with_object = {c:3,d:4};
|
|
|
|
with(with_object) {
|
|
|
|
with(with_object) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-10-21 10:26:59 +00:00
|
|
|
// With block in function that is marked for optimization while being executed.
|
|
|
|
BeginTest("With 7");
|
|
|
|
|
|
|
|
function with_7() {
|
|
|
|
with({}) {
|
|
|
|
%OptimizeFunctionOnNextCall(with_7);
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-10-21 10:26:59 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
|
|
|
};
|
|
|
|
with_7();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2009-06-12 10:03:25 +00:00
|
|
|
// Simple closure formed by returning an inner function referering the outer
|
|
|
|
// functions arguments.
|
|
|
|
BeginTest("Closure 1");
|
|
|
|
|
|
|
|
function closure_1(a) {
|
|
|
|
function f() {
|
|
|
|
debugger;
|
|
|
|
return a;
|
|
|
|
};
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["f", "closure_1", undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
closure_1(1)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Simple closure formed by returning an inner function referering the outer
|
|
|
|
// functions arguments. Due to VM optimizations parts of the actual closure is
|
|
|
|
// missing from the debugger information.
|
|
|
|
BeginTest("Closure 2");
|
|
|
|
|
|
|
|
function closure_2(a, b) {
|
|
|
|
var x = a + 2;
|
|
|
|
var y = b + 2;
|
|
|
|
function f() {
|
|
|
|
debugger;
|
|
|
|
return a + x;
|
|
|
|
};
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,x:3}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["f", "closure_2", undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
closure_2(1, 2)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Simple closure formed by returning an inner function referering the outer
|
|
|
|
// functions arguments. Using all arguments and locals from the outer function
|
|
|
|
// in the inner function makes these part of the debugger information on the
|
|
|
|
// closure.
|
|
|
|
BeginTest("Closure 3");
|
|
|
|
|
|
|
|
function closure_3(a, b) {
|
|
|
|
var x = a + 2;
|
|
|
|
var y = b + 2;
|
|
|
|
function f() {
|
|
|
|
debugger;
|
|
|
|
return a + b + x + y;
|
|
|
|
};
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["f", "closure_3", undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
closure_3(1, 2)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Simple closure formed by returning an inner function referering the outer
|
|
|
|
// functions arguments. Using all arguments and locals from the outer function
|
|
|
|
// in the inner function makes these part of the debugger information on the
|
|
|
|
// closure. Use the inner function as well...
|
|
|
|
BeginTest("Closure 4");
|
|
|
|
|
|
|
|
function closure_4(a, b) {
|
|
|
|
var x = a + 2;
|
|
|
|
var y = b + 2;
|
|
|
|
function f() {
|
|
|
|
debugger;
|
|
|
|
if (f) {
|
|
|
|
return a + b + x + y;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-12-14 07:20:13 +00:00
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4,f:undefined}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["f", "closure_4", undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
closure_4(1, 2)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Simple closure formed by returning an inner function referering the outer
|
|
|
|
// functions arguments. In the presence of eval all arguments and locals
|
|
|
|
// (including the inner function itself) from the outer function becomes part of
|
|
|
|
// the debugger infformation on the closure.
|
|
|
|
BeginTest("Closure 5");
|
|
|
|
|
|
|
|
function closure_5(a, b) {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
function f() {
|
|
|
|
eval('');
|
|
|
|
debugger;
|
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-12-14 07:20:13 +00:00
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4,f:undefined}, 1, exec_state);
|
2015-09-30 17:24:25 +00:00
|
|
|
CheckScopeChainNames(["f", "closure_5", undefined, undefined], exec_state)
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
closure_5(1, 2)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Two closures. Due to optimizations only the parts actually used are provided
|
|
|
|
// through the debugger information.
|
|
|
|
BeginTest("Closure 6");
|
|
|
|
function closure_6(a, b) {
|
|
|
|
function f(a, b) {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
return function() {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
debugger;
|
|
|
|
some_global = a;
|
|
|
|
return f;
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
return f(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1}, 1, exec_state);
|
2016-12-14 07:20:13 +00:00
|
|
|
CheckScopeContent({f:undefined}, 2, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames([undefined, "f", "closure_6", undefined, undefined],
|
|
|
|
exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
closure_6(1, 2)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Two closures. In the presence of eval all information is provided as the
|
|
|
|
// compiler cannot determine which parts are used.
|
|
|
|
BeginTest("Closure 7");
|
|
|
|
function closure_7(a, b) {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
eval('var i = 5');
|
|
|
|
eval('var j = 6');
|
|
|
|
function f(a, b) {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
eval('var i = 5');
|
|
|
|
eval('var j = 6');
|
|
|
|
return function() {
|
|
|
|
debugger;
|
|
|
|
some_global = a;
|
|
|
|
return f;
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
return f(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6}, 1, exec_state);
|
2016-12-14 07:20:13 +00:00
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:undefined}, 2, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames([undefined, "f", "closure_7", undefined, undefined],
|
|
|
|
exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
closure_7(1, 2)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-04-06 17:54:39 +00:00
|
|
|
// Closure that may be optimized out.
|
|
|
|
BeginTest("Closure 8");
|
|
|
|
function closure_8() {
|
|
|
|
(function inner(x) {
|
|
|
|
debugger;
|
|
|
|
})(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-04-06 17:54:39 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x: 2}, 0, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["inner", undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2011-04-06 17:54:39 +00:00
|
|
|
closure_8();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
BeginTest("Closure 9");
|
|
|
|
function closure_9() {
|
|
|
|
eval("var y = 1;");
|
|
|
|
eval("var z = 1;");
|
|
|
|
(function inner(x) {
|
2011-04-15 11:35:36 +00:00
|
|
|
y++;
|
2011-04-06 17:54:39 +00:00
|
|
|
z++;
|
|
|
|
debugger;
|
|
|
|
})(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-04-06 17:54:39 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["inner", "closure_9", undefined, undefined],
|
|
|
|
exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2011-04-06 17:54:39 +00:00
|
|
|
closure_9();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2018-04-25 09:52:59 +00:00
|
|
|
// Closure with inferred name.
|
|
|
|
BeginTest("Closure with Inferred Name 1");
|
|
|
|
|
|
|
|
function closure_1_inferred_name(a) {
|
|
|
|
let foo = {};
|
|
|
|
foo.bar = function() {
|
|
|
|
debugger;
|
|
|
|
return a;
|
|
|
|
};
|
|
|
|
return foo.bar;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1}, 1, exec_state);
|
|
|
|
CheckScopeChainNames(["foo.bar", "closure_1_inferred_name", undefined,
|
|
|
|
undefined], exec_state);
|
|
|
|
};
|
|
|
|
closure_1_inferred_name(1)();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
// Closure with nested inferred name.
|
|
|
|
BeginTest("Closure with Inferred Name 2");
|
|
|
|
|
|
|
|
function closure_2_inferred_name(a) {
|
|
|
|
let foo = {};
|
|
|
|
function FooBar(b) {
|
|
|
|
foo.baz = function() {
|
|
|
|
debugger;
|
|
|
|
return a+b;
|
|
|
|
}
|
|
|
|
return foo.baz;
|
|
|
|
};
|
|
|
|
return FooBar;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({b:0x1235}, 1, exec_state);
|
|
|
|
CheckScopeContent({a:0x1234}, 2, exec_state);
|
|
|
|
CheckScopeChainNames(["FooBar.foo.baz", "FooBar", "closure_2_inferred_name",
|
|
|
|
undefined, undefined], exec_state);
|
|
|
|
};
|
|
|
|
closure_2_inferred_name(0x1234)(0x1235)();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Closure with nested inferred name.
|
|
|
|
BeginTest("Closure with Inferred Name 3");
|
|
|
|
|
|
|
|
function closure_3_inferred_name(a) {
|
|
|
|
let foo = {};
|
|
|
|
foo.bar = function(b) {
|
|
|
|
foo.baz = function() {
|
|
|
|
debugger;
|
|
|
|
return a+b;
|
|
|
|
}
|
|
|
|
return foo.baz;
|
|
|
|
};
|
|
|
|
return foo.bar;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({b:0x1235}, 1, exec_state);
|
|
|
|
CheckScopeContent({a:0x1234}, 2, exec_state);
|
|
|
|
CheckScopeChainNames(["foo.baz", "foo.bar", "closure_3_inferred_name",
|
|
|
|
undefined, undefined], exec_state);
|
|
|
|
};
|
|
|
|
closure_3_inferred_name(0x1234)(0x1235)();
|
|
|
|
EndTest();
|
|
|
|
|
2017-06-27 10:31:05 +00:00
|
|
|
BeginTest("Closure passed to optimized Array.prototype.forEach");
|
|
|
|
function closure_10(a) {
|
|
|
|
var x = a + 2;
|
|
|
|
function closure_11(b) {
|
|
|
|
debugger;
|
|
|
|
return a + b + x;
|
|
|
|
}
|
|
|
|
[42].forEach(closure_11);
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({b:42}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:5, x:7}, 1, exec_state);
|
|
|
|
CheckScopeChainNames(
|
|
|
|
["closure_11", "closure_10", undefined, undefined], exec_state);
|
|
|
|
};
|
|
|
|
begin_test_count++; closure_10(5); end_test_count++;
|
|
|
|
begin_test_count++; closure_10(5); end_test_count++;
|
|
|
|
%OptimizeFunctionOnNextCall(closure_10);
|
|
|
|
closure_10(5);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2009-06-12 10:03:25 +00:00
|
|
|
// Test a mixture of scopes.
|
|
|
|
BeginTest("The full monty");
|
|
|
|
function the_full_monty(a, b) {
|
|
|
|
var x = 3;
|
|
|
|
var y = 4;
|
|
|
|
eval('var i = 5');
|
|
|
|
eval('var j = 6');
|
|
|
|
function f(a, b) {
|
|
|
|
var x = 9;
|
|
|
|
var y = 10;
|
|
|
|
eval('var i = 11');
|
|
|
|
eval('var j = 12');
|
|
|
|
with ({j:13}){
|
|
|
|
return function() {
|
|
|
|
var x = 14;
|
2010-03-05 07:05:26 +00:00
|
|
|
with ({a:15}) {
|
2009-06-12 10:03:25 +00:00
|
|
|
with ({b:16}) {
|
|
|
|
debugger;
|
|
|
|
some_global = a;
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
}
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2009-06-12 10:03:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return f(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-06-12 10:03:25 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({b:16}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:15}, 1, exec_state);
|
|
|
|
CheckScopeContent({x:14}, 2, exec_state);
|
|
|
|
CheckScopeContent({j:13}, 3, exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2,x:9,y:10,i:11,j:12}, 4, exec_state);
|
2016-12-14 07:20:13 +00:00
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:undefined}, 5, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames([undefined, undefined, undefined, "f", "f",
|
|
|
|
"the_full_monty", undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
the_full_monty(1, 2)();
|
2009-06-12 10:03:25 +00:00
|
|
|
EndTest();
|
|
|
|
|
2011-04-06 17:54:39 +00:00
|
|
|
|
|
|
|
BeginTest("Closure inside With 1");
|
|
|
|
function closure_in_with_1() {
|
|
|
|
with({x:1}) {
|
|
|
|
(function inner(x) {
|
|
|
|
debugger;
|
|
|
|
})(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.With,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-04-06 17:54:39 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x: 2}, 0, exec_state);
|
2016-03-15 22:41:13 +00:00
|
|
|
CheckScopeContent({x: 1}, 1, exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2011-04-06 17:54:39 +00:00
|
|
|
closure_in_with_1();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
BeginTest("Closure inside With 2");
|
|
|
|
function closure_in_with_2() {
|
|
|
|
with({x:1}) {
|
|
|
|
(function inner(x) {
|
|
|
|
with({x:3}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
})(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.With,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-04-06 17:54:39 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x: 3}, 0, exec_state);
|
|
|
|
CheckScopeContent({x: 2}, 1, exec_state);
|
|
|
|
CheckScopeContent({x: 1}, 2, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["inner", "inner", "closure_in_with_2",
|
|
|
|
undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2011-04-06 17:54:39 +00:00
|
|
|
closure_in_with_2();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
BeginTest("Closure inside With 3");
|
|
|
|
function createClosure(a) {
|
|
|
|
var b = a + 1;
|
|
|
|
return function closure() {
|
|
|
|
var c = b;
|
|
|
|
(function inner(x) {
|
|
|
|
with({x:c}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
})(2);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2011-04-06 17:54:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function closure_in_with_3() {
|
|
|
|
var f = createClosure(0);
|
|
|
|
f();
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Closure,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-04-06 17:54:39 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["inner", "inner", "closure", "createClosure",
|
|
|
|
undefined, undefined], exec_state);
|
2011-04-06 17:54:39 +00:00
|
|
|
}
|
|
|
|
closure_in_with_3();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-09-14 11:20:31 +00:00
|
|
|
BeginTest("Closure inside With 4");
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.With,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-09-14 11:20:31 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x: 2}, 0, exec_state);
|
|
|
|
CheckScopeContent({x: 1}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames([undefined, undefined, undefined, undefined],
|
|
|
|
exec_state);
|
2011-09-14 11:20:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
with({x:1}) {
|
|
|
|
(function(x) {
|
|
|
|
debugger;
|
|
|
|
})(2);
|
|
|
|
}
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2009-06-12 10:03:25 +00:00
|
|
|
// Test global scope.
|
|
|
|
BeginTest("Global");
|
|
|
|
listener_delegate = function(exec_state) {
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChain([debug.ScopeType.Script, debug.ScopeType.Global],
|
|
|
|
exec_state);
|
|
|
|
CheckScopeChainNames([undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
2009-06-12 10:03:25 +00:00
|
|
|
debugger;
|
|
|
|
EndTest();
|
|
|
|
|
2009-09-08 10:20:28 +00:00
|
|
|
|
|
|
|
BeginTest("Catch block 1");
|
|
|
|
function catch_block_1() {
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Catch,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-09-08 10:20:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({e:'Exception'}, 0, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["catch_block_1", "catch_block_1",
|
|
|
|
undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
catch_block_1();
|
2009-09-08 10:20:28 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
BeginTest("Catch block 2");
|
|
|
|
function catch_block_2() {
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
with({n:10}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Catch,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-09-08 10:20:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({n:10}, 0, exec_state);
|
|
|
|
CheckScopeContent({e:'Exception'}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["catch_block_2", "catch_block_2", "catch_block_2",
|
|
|
|
undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
catch_block_2();
|
2009-09-08 10:20:28 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
BeginTest("Catch block 3");
|
2010-03-05 07:05:26 +00:00
|
|
|
function catch_block_3() {
|
2009-09-08 10:20:28 +00:00
|
|
|
// Do eval to dynamically declare a local variable so that the context's
|
|
|
|
// extension slot is initialized with JSContextExtensionObject.
|
|
|
|
eval("var y = 78;");
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Catch,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-09-08 10:20:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({e:'Exception'}, 0, exec_state);
|
|
|
|
CheckScopeContent({y:78}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["catch_block_3", "catch_block_3",
|
|
|
|
undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
catch_block_3();
|
2009-09-08 10:20:28 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
BeginTest("Catch block 4");
|
2010-03-05 07:05:26 +00:00
|
|
|
function catch_block_4() {
|
2009-09-08 10:20:28 +00:00
|
|
|
// Do eval to dynamically declare a local variable so that the context's
|
|
|
|
// extension slot is initialized with JSContextExtensionObject.
|
|
|
|
eval("var y = 98;");
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
with({n:10}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.With,
|
|
|
|
debug.ScopeType.Catch,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2009-09-08 10:20:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({n:10}, 0, exec_state);
|
|
|
|
CheckScopeContent({e:'Exception'}, 1, exec_state);
|
|
|
|
CheckScopeContent({y:98}, 2, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["catch_block_4", "catch_block_4", "catch_block_4",
|
|
|
|
undefined, undefined], exec_state);
|
2011-04-15 11:35:36 +00:00
|
|
|
};
|
|
|
|
catch_block_4();
|
2009-09-08 10:20:28 +00:00
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-09-14 11:20:31 +00:00
|
|
|
// Test catch in global scope.
|
|
|
|
BeginTest("Catch block 5");
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Catch,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-09-14 11:20:31 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({e:'Exception'}, 0, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames([undefined, undefined, undefined], exec_state);
|
2011-09-14 11:20:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Closure inside catch in global code.
|
|
|
|
BeginTest("Catch block 6");
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Catch,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-09-14 11:20:31 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x: 2}, 0, exec_state);
|
|
|
|
CheckScopeContent({e:'Exception'}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames([undefined, undefined, undefined, undefined],
|
|
|
|
exec_state);
|
2011-09-14 11:20:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
(function(x) {
|
|
|
|
debugger;
|
|
|
|
})(2);
|
|
|
|
}
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-10-21 10:26:59 +00:00
|
|
|
// Catch block in function that is marked for optimization while being executed.
|
|
|
|
BeginTest("Catch block 7");
|
|
|
|
function catch_block_7() {
|
|
|
|
%OptimizeFunctionOnNextCall(catch_block_7);
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Catch,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-10-21 10:26:59 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({e:'Exception'}, 0, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["catch_block_7", "catch_block_7",
|
|
|
|
undefined, undefined], exec_state);
|
2011-10-21 10:26:59 +00:00
|
|
|
};
|
|
|
|
catch_block_7();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2015-03-09 14:49:46 +00:00
|
|
|
BeginTest("Classes and methods 1");
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
"use strict"
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
2015-04-22 13:22:37 +00:00
|
|
|
CheckScopeContent({}, 1, exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainNames(["m", undefined, undefined], exec_state);
|
2015-03-09 14:49:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
"use strict";
|
|
|
|
class C1 {
|
|
|
|
m() {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
new C1().m();
|
|
|
|
})();
|
|
|
|
|
|
|
|
EndTest();
|
|
|
|
|
2016-03-02 02:18:52 +00:00
|
|
|
BeginTest("Scope positions");
|
|
|
|
var code1 = "function f() { \n" +
|
|
|
|
" var a = 1; \n" +
|
|
|
|
" function b() { \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" return a + 1; \n" +
|
|
|
|
" } \n" +
|
|
|
|
" b(); \n" +
|
|
|
|
"} \n" +
|
|
|
|
"f(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainPositions(
|
|
|
|
[{start: 58, end: 118}, {start: 10, end: 162}, {}, {}], exec_state);
|
2016-03-02 02:18:52 +00:00
|
|
|
}
|
|
|
|
eval(code1);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
function catch_block_2() {
|
|
|
|
try {
|
|
|
|
throw 'Exception';
|
|
|
|
} catch (e) {
|
|
|
|
with({n:10}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
BeginTest("Scope positions in catch and 'with' statement");
|
|
|
|
var code2 = "function catch_block() { \n" +
|
|
|
|
" try { \n" +
|
|
|
|
" throw 'Exception'; \n" +
|
|
|
|
" } catch (e) { \n" +
|
|
|
|
" with({n : 10}) { \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" } \n" +
|
|
|
|
" } \n" +
|
|
|
|
"} \n" +
|
|
|
|
"catch_block(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainPositions([{start: 131, end: 173},
|
|
|
|
{start: 94, end: 199},
|
|
|
|
{start: 20, end: 225},
|
|
|
|
{}, {}], exec_state);
|
2016-03-02 02:18:52 +00:00
|
|
|
}
|
|
|
|
eval(code2);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
BeginTest("Scope positions in for statement");
|
|
|
|
var code3 = "function for_statement() { \n" +
|
|
|
|
" for (let i = 0; i < 1; i++) { \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" } \n" +
|
|
|
|
"} \n" +
|
|
|
|
"for_statement(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainPositions(
|
2017-04-18 14:56:06 +00:00
|
|
|
[{start: 42, end: 111}, {start: 22, end: 145}, {}, {}], exec_state);
|
2016-03-02 02:18:52 +00:00
|
|
|
}
|
|
|
|
eval(code3);
|
|
|
|
EndTest();
|
2015-03-09 14:49:46 +00:00
|
|
|
|
2016-09-16 08:39:35 +00:00
|
|
|
BeginTest("Scope positions in for statement with lexical block");
|
|
|
|
var code4 = "function for_statement() { \n" +
|
|
|
|
" for (let i = 0; i < 1; i++) { \n" +
|
|
|
|
" let j; \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" } \n" +
|
|
|
|
"} \n" +
|
|
|
|
"for_statement(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainPositions([{start: 66, end: 147},
|
2017-04-18 14:56:06 +00:00
|
|
|
{start: 42, end: 147},
|
2016-11-28 12:01:17 +00:00
|
|
|
{start: 22, end: 181},
|
|
|
|
{}, {}], exec_state);
|
2016-09-16 08:39:35 +00:00
|
|
|
}
|
|
|
|
eval(code4);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
BeginTest("Scope positions in lexical for each statement");
|
|
|
|
var code5 = "function for_each_statement() { \n" +
|
|
|
|
" for (let i of [0]) { \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" } \n" +
|
|
|
|
"} \n" +
|
|
|
|
"for_each_statement(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainPositions(
|
|
|
|
[{start: 55, end: 111}, {start: 27, end: 145}, {}, {}], exec_state);
|
2016-09-16 08:39:35 +00:00
|
|
|
}
|
|
|
|
eval(code5);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
BeginTest("Scope positions in lexical for each statement with lexical block");
|
|
|
|
var code6 = "function for_each_statement() { \n" +
|
|
|
|
" for (let i of [0]) { \n" +
|
|
|
|
" let j; \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" } \n" +
|
|
|
|
"} \n" +
|
|
|
|
"for_each_statement(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainPositions([{start: 57, end: 147},
|
|
|
|
{start: 55, end: 147},
|
|
|
|
{start: 27, end: 181},
|
|
|
|
{}, {}], exec_state);
|
2016-09-16 08:39:35 +00:00
|
|
|
}
|
|
|
|
eval(code6);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
BeginTest("Scope positions in non-lexical for each statement");
|
|
|
|
var code7 = "function for_each_statement() { \n" +
|
|
|
|
" var i; \n" +
|
|
|
|
" for (i of [0]) { \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" } \n" +
|
|
|
|
"} \n" +
|
|
|
|
"for_each_statement(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeChainPositions([{start: 27, end: 181}, {}, {}], exec_state);
|
|
|
|
}
|
|
|
|
eval(code7);
|
|
|
|
EndTest();
|
|
|
|
|
2016-11-28 12:01:17 +00:00
|
|
|
BeginTest(
|
|
|
|
"Scope positions in non-lexical for each statement with lexical block");
|
2016-09-16 08:39:35 +00:00
|
|
|
var code8 = "function for_each_statement() { \n" +
|
|
|
|
" var i; \n" +
|
|
|
|
" for (i of [0]) { \n" +
|
|
|
|
" let j; \n" +
|
|
|
|
" debugger; \n" +
|
|
|
|
" } \n" +
|
|
|
|
"} \n" +
|
|
|
|
"for_each_statement(); \n";
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Script,
|
|
|
|
debug.ScopeType.Global], exec_state);
|
2016-11-28 12:01:17 +00:00
|
|
|
CheckScopeChainPositions(
|
|
|
|
[{start: 89, end: 183}, {start: 27, end: 217}, {}, {}], exec_state);
|
2016-09-16 08:39:35 +00:00
|
|
|
}
|
|
|
|
eval(code8);
|
|
|
|
EndTest();
|
|
|
|
|
2011-04-15 11:35:36 +00:00
|
|
|
assertEquals(begin_test_count, break_count,
|
|
|
|
'one or more tests did not enter the debugger');
|
|
|
|
assertEquals(begin_test_count, end_test_count,
|
|
|
|
'one or more tests did not have its result checked');
|