mirror of https://github.com/lukechilds/node.git
Ryan Dahl
15 years ago
71 changed files with 3528 additions and 2463 deletions
File diff suppressed because it is too large
@ -1,117 +1,117 @@ |
|||||
// Copyright 2008 the V8 project authors. All rights reserved.
|
// Copyright 2008 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
var Debug = debug.Debug |
var Debug = debug.Debug |
||||
|
|
||||
// Simple function which stores the last debug event.
|
// Simple function which stores the last debug event.
|
||||
var listenerComplete = false; |
var listenerComplete = false; |
||||
var exception = false; |
var exception = false; |
||||
|
|
||||
var base_request = '"seq":0,"type":"request","command":"clearbreakpointgroup"'; |
var base_request = '"seq":0,"type":"request","command":"clearbreakpointgroup"'; |
||||
var scriptId = null; |
var scriptId = null; |
||||
|
|
||||
function safeEval(code) { |
function safeEval(code) { |
||||
try { |
try { |
||||
return eval('(' + code + ')'); |
return eval('(' + code + ')'); |
||||
} catch (e) { |
} catch (e) { |
||||
assertEquals(void 0, e); |
assertEquals(void 0, e); |
||||
return undefined; |
return undefined; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
function testArguments(dcp, arguments, success) { |
function testArguments(dcp, arguments, success) { |
||||
var request = '{' + base_request + ',"arguments":' + arguments + '}' |
var request = '{' + base_request + ',"arguments":' + arguments + '}' |
||||
var json_response = dcp.processDebugJSONRequest(request); |
var json_response = dcp.processDebugJSONRequest(request); |
||||
var response = safeEval(json_response); |
var response = safeEval(json_response); |
||||
if (success) { |
if (success) { |
||||
assertTrue(response.success, json_response); |
assertTrue(response.success, json_response); |
||||
} else { |
} else { |
||||
assertFalse(response.success, json_response); |
assertFalse(response.success, json_response); |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
// Get the debug command processor.
|
// Get the debug command processor.
|
||||
var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); |
var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); |
||||
|
|
||||
// Clear breakpoint group 1.
|
// Clear breakpoint group 1.
|
||||
testArguments(dcp, '{"groupId":1}', true); |
testArguments(dcp, '{"groupId":1}', true); |
||||
|
|
||||
// Indicate that all was processed.
|
// Indicate that all was processed.
|
||||
listenerComplete = true; |
listenerComplete = true; |
||||
} else if (event == Debug.DebugEvent.AfterCompile) { |
} else if (event == Debug.DebugEvent.AfterCompile) { |
||||
scriptId = event_data.script().id(); |
scriptId = event_data.script().id(); |
||||
assertEquals(source, event_data.script().source()); |
assertEquals(source, event_data.script().source()); |
||||
} |
} |
||||
} catch (e) { |
} catch (e) { |
||||
exception = e |
exception = e |
||||
}; |
}; |
||||
}; |
}; |
||||
|
|
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
var source = 'function f(n) {\nreturn n+1;\n}\nfunction g() {return f(10);}' + |
var source = 'function f(n) {\nreturn n+1;\n}\nfunction g() {return f(10);}' + |
||||
'\nvar r = g(); g;'; |
'\nvar r = g(); g;'; |
||||
eval(source); |
eval(source); |
||||
|
|
||||
assertNotNull(scriptId); |
assertNotNull(scriptId); |
||||
|
|
||||
var groupId1 = 1; |
var groupId1 = 1; |
||||
var groupId2 = 2; |
var groupId2 = 2; |
||||
// Set a break point and call to invoke the debug event listener.
|
// Set a break point and call to invoke the debug event listener.
|
||||
var bp1 = Debug.setScriptBreakPointById(scriptId, 1, null, null, groupId1); |
var bp1 = Debug.setScriptBreakPointById(scriptId, 1, null, null, groupId1); |
||||
var bp2 = Debug.setScriptBreakPointById(scriptId, 1, null, null, groupId2); |
var bp2 = Debug.setScriptBreakPointById(scriptId, 1, null, null, groupId2); |
||||
var bp3 = Debug.setScriptBreakPointById(scriptId, 1, null, null, null); |
var bp3 = Debug.setScriptBreakPointById(scriptId, 1, null, null, null); |
||||
var bp4 = Debug.setScriptBreakPointById(scriptId, 3, null, null, groupId1); |
var bp4 = Debug.setScriptBreakPointById(scriptId, 3, null, null, groupId1); |
||||
var bp5 = Debug.setScriptBreakPointById(scriptId, 4, null, null, groupId2); |
var bp5 = Debug.setScriptBreakPointById(scriptId, 4, null, null, groupId2); |
||||
|
|
||||
assertEquals(5, Debug.scriptBreakPoints().length); |
assertEquals(5, Debug.scriptBreakPoints().length); |
||||
|
|
||||
// Call function 'g' from the compiled script to trigger breakpoint.
|
// Call function 'g' from the compiled script to trigger breakpoint.
|
||||
g(); |
g(); |
||||
|
|
||||
// Make sure that the debug event listener vas invoked.
|
// Make sure that the debug event listener vas invoked.
|
||||
assertTrue(listenerComplete, |
assertTrue(listenerComplete, |
||||
"listener did not run to completion: " + exception); |
"listener did not run to completion: " + exception); |
||||
|
|
||||
var breakpoints = Debug.scriptBreakPoints(); |
var breakpoints = Debug.scriptBreakPoints(); |
||||
assertEquals(3, breakpoints.length); |
assertEquals(3, breakpoints.length); |
||||
var breakpointNumbers = breakpoints.map( |
var breakpointNumbers = breakpoints.map( |
||||
function(scriptBreakpoint) { return scriptBreakpoint.number(); }, |
function(scriptBreakpoint) { return scriptBreakpoint.number(); }, |
||||
breakpointNumbers); |
breakpointNumbers); |
||||
|
|
||||
// Check that all breakpoints from group 1 were deleted and all the
|
// Check that all breakpoints from group 1 were deleted and all the
|
||||
// rest are preserved.
|
// rest are preserved.
|
||||
assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); |
assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); |
||||
|
|
||||
assertFalse(exception, "exception in listener"); |
assertFalse(exception, "exception in listener"); |
||||
|
@ -1,80 +1,80 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var listenerComplete = false; |
var listenerComplete = false; |
||||
var exception = false; |
var exception = false; |
||||
|
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
// Get the debug command processor.
|
// Get the debug command processor.
|
||||
var dcp = exec_state.debugCommandProcessor(); |
var dcp = exec_state.debugCommandProcessor(); |
||||
|
|
||||
var request = { |
var request = { |
||||
seq: 0, |
seq: 0, |
||||
type: 'request', |
type: 'request', |
||||
command: 'evaluate', |
command: 'evaluate', |
||||
arguments: { |
arguments: { |
||||
expression: 'a', |
expression: 'a', |
||||
frame: 0 |
frame: 0 |
||||
} |
} |
||||
}; |
}; |
||||
request = JSON.stringify(request); |
request = JSON.stringify(request); |
||||
|
|
||||
var resp = dcp.processDebugJSONRequest(request); |
var resp = dcp.processDebugJSONRequest(request); |
||||
var response = JSON.parse(resp); |
var response = JSON.parse(resp); |
||||
assertTrue(response.success, 'Command failed: ' + resp); |
assertTrue(response.success, 'Command failed: ' + resp); |
||||
assertEquals('object', response.body.type); |
assertEquals('object', response.body.type); |
||||
assertEquals('Object', response.body.className); |
assertEquals('Object', response.body.className); |
||||
|
|
||||
// Indicate that all was processed.
|
// Indicate that all was processed.
|
||||
listenerComplete = true; |
listenerComplete = true; |
||||
} |
} |
||||
} catch (e) { |
} catch (e) { |
||||
exception = e |
exception = e |
||||
}; |
}; |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
function callDebugger() { |
function callDebugger() { |
||||
// Add set constructor field to a non-function value.
|
// Add set constructor field to a non-function value.
|
||||
var a = {constructor:true}; |
var a = {constructor:true}; |
||||
debugger; |
debugger; |
||||
} |
} |
||||
|
|
||||
callDebugger(); |
callDebugger(); |
||||
|
|
||||
|
|
||||
// Make sure that the debug event listener vas invoked.
|
// Make sure that the debug event listener vas invoked.
|
||||
assertFalse(exception, "exception in listener") |
assertFalse(exception, "exception in listener") |
||||
assertTrue(listenerComplete, "listener did not run to completion"); |
assertTrue(listenerComplete, "listener did not run to completion"); |
||||
|
@ -1,118 +1,118 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
listenerComplete = false; |
listenerComplete = false; |
||||
exception = false; |
exception = false; |
||||
|
|
||||
// The base part of all evaluate requests.
|
// The base part of all evaluate requests.
|
||||
var base_request = '"seq":0,"type":"request","command":"references"' |
var base_request = '"seq":0,"type":"request","command":"references"' |
||||
|
|
||||
function safeEval(code) { |
function safeEval(code) { |
||||
try { |
try { |
||||
return eval('(' + code + ')'); |
return eval('(' + code + ')'); |
||||
} catch (e) { |
} catch (e) { |
||||
assertEquals(void 0, e); |
assertEquals(void 0, e); |
||||
return undefined; |
return undefined; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
function testRequest(dcp, arguments, success, count) { |
function testRequest(dcp, arguments, success, count) { |
||||
// Generate request with the supplied arguments.
|
// Generate request with the supplied arguments.
|
||||
var request; |
var request; |
||||
if (arguments) { |
if (arguments) { |
||||
request = '{' + base_request + ',"arguments":' + arguments + '}'; |
request = '{' + base_request + ',"arguments":' + arguments + '}'; |
||||
} else { |
} else { |
||||
request = '{' + base_request + '}' |
request = '{' + base_request + '}' |
||||
} |
} |
||||
|
|
||||
// Process the request and check expectation.
|
// Process the request and check expectation.
|
||||
var response = safeEval(dcp.processDebugJSONRequest(request)); |
var response = safeEval(dcp.processDebugJSONRequest(request)); |
||||
if (success) { |
if (success) { |
||||
assertTrue(response.success, request + ' -> ' + response.message); |
assertTrue(response.success, request + ' -> ' + response.message); |
||||
assertTrue(response.body instanceof Array); |
assertTrue(response.body instanceof Array); |
||||
if (count) { |
if (count) { |
||||
assertEquals(count, response.body.length); |
assertEquals(count, response.body.length); |
||||
} else { |
} else { |
||||
assertTrue(response.body.length > 0); |
assertTrue(response.body.length > 0); |
||||
} |
} |
||||
} else { |
} else { |
||||
assertFalse(response.success, request + ' -> ' + response.message); |
assertFalse(response.success, request + ' -> ' + response.message); |
||||
} |
} |
||||
assertEquals(response.running, dcp.isRunning(), request + ' -> expected not running'); |
assertEquals(response.running, dcp.isRunning(), request + ' -> expected not running'); |
||||
} |
} |
||||
|
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
// Get the debug command processor.
|
// Get the debug command processor.
|
||||
var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); |
var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); |
||||
|
|
||||
// Test some illegal references requests.
|
// Test some illegal references requests.
|
||||
testRequest(dcp, void 0, false); |
testRequest(dcp, void 0, false); |
||||
testRequest(dcp, '{"handle":"a"}', false); |
testRequest(dcp, '{"handle":"a"}', false); |
||||
testRequest(dcp, '{"handle":1}', false); |
testRequest(dcp, '{"handle":1}', false); |
||||
testRequest(dcp, '{"type":"referencedBy"}', false); |
testRequest(dcp, '{"type":"referencedBy"}', false); |
||||
testRequest(dcp, '{"type":"constructedBy"}', false); |
testRequest(dcp, '{"type":"constructedBy"}', false); |
||||
|
|
||||
// Evaluate Point.
|
// Evaluate Point.
|
||||
var evaluate_point = '{"seq":0,"type":"request","command":"evaluate",' + |
var evaluate_point = '{"seq":0,"type":"request","command":"evaluate",' + |
||||
'"arguments":{"expression":"Point"}}'; |
'"arguments":{"expression":"Point"}}'; |
||||
var response = safeEval(dcp.processDebugJSONRequest(evaluate_point)); |
var response = safeEval(dcp.processDebugJSONRequest(evaluate_point)); |
||||
assertTrue(response.success, "Evaluation of Point failed"); |
assertTrue(response.success, "Evaluation of Point failed"); |
||||
var handle = response.body.handle; |
var handle = response.body.handle; |
||||
|
|
||||
// Test some legal references requests.
|
// Test some legal references requests.
|
||||
testRequest(dcp, '{"handle":' + handle + ',"type":"referencedBy"}', true); |
testRequest(dcp, '{"handle":' + handle + ',"type":"referencedBy"}', true); |
||||
testRequest(dcp, '{"handle":' + handle + ',"type":"constructedBy"}', |
testRequest(dcp, '{"handle":' + handle + ',"type":"constructedBy"}', |
||||
true, 2); |
true, 2); |
||||
|
|
||||
// Indicate that all was processed.
|
// Indicate that all was processed.
|
||||
listenerComplete = true; |
listenerComplete = true; |
||||
} |
} |
||||
} catch (e) { |
} catch (e) { |
||||
exception = e |
exception = e |
||||
}; |
}; |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
// Test constructor and objects.
|
// Test constructor and objects.
|
||||
function Point(x, y) { this.x_ = x; this.y_ = y;} |
function Point(x, y) { this.x_ = x; this.y_ = y;} |
||||
p = new Point(0,0); |
p = new Point(0,0); |
||||
q = new Point(1,2); |
q = new Point(1,2); |
||||
|
|
||||
// Enter debugger causing the event listener to be called.
|
// Enter debugger causing the event listener to be called.
|
||||
debugger; |
debugger; |
||||
|
|
||||
// Make sure that the debug event listener was invoked.
|
// Make sure that the debug event listener was invoked.
|
||||
assertFalse(exception, "exception in listener") |
assertFalse(exception, "exception in listener") |
||||
assertTrue(listenerComplete, "listener did not run to completion"); |
assertTrue(listenerComplete, "listener did not run to completion"); |
||||
|
@ -1,248 +1,248 @@ |
|||||
// Copyright 2008 the V8 project authors. All rights reserved.
|
// Copyright 2008 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
|
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var exception = null; |
var exception = null; |
||||
var state = 1; |
var state = 1; |
||||
var expected_source_line_text = null; |
var expected_source_line_text = null; |
||||
var expected_function_name = null; |
var expected_function_name = null; |
||||
|
|
||||
// Simple debug event handler which first time will cause 'step in' action
|
// Simple debug event handler which first time will cause 'step in' action
|
||||
// to get into g.call and than check that execution is stopped inside
|
// to get into g.call and than check that execution is stopped inside
|
||||
// function 'g'.
|
// function 'g'.
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
if (state == 1) { |
if (state == 1) { |
||||
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
||||
state = 2; |
state = 2; |
||||
} else if (state == 2) { |
} else if (state == 2) { |
||||
assertEquals(expected_source_line_text, |
assertEquals(expected_source_line_text, |
||||
event_data.sourceLineText()); |
event_data.sourceLineText()); |
||||
assertEquals(expected_function_name, event_data.func().name()); |
assertEquals(expected_function_name, event_data.func().name()); |
||||
state = 3; |
state = 3; |
||||
} |
} |
||||
} |
} |
||||
} catch(e) { |
} catch(e) { |
||||
exception = e; |
exception = e; |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
|
|
||||
var c = { |
var c = { |
||||
name: 'name ', |
name: 'name ', |
||||
get getter1() { |
get getter1() { |
||||
return this.name; // getter 1
|
return this.name; // getter 1
|
||||
}, |
}, |
||||
get getter2() { |
get getter2() { |
||||
return { // getter 2
|
return { // getter 2
|
||||
'a': c.name |
'a': c.name |
||||
}; |
}; |
||||
}, |
}, |
||||
set setter1(n) { |
set setter1(n) { |
||||
this.name = n; // setter 1
|
this.name = n; // setter 1
|
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
c.__defineGetter__('y', function getterY() { |
c.__defineGetter__('y', function getterY() { |
||||
return this.name; // getter y
|
return this.name; // getter y
|
||||
}); |
}); |
||||
|
|
||||
c.__defineGetter__(3, function getter3() { |
c.__defineGetter__(3, function getter3() { |
||||
return this.name; // getter 3
|
return this.name; // getter 3
|
||||
}); |
}); |
||||
|
|
||||
c.__defineSetter__('y', function setterY(n) { |
c.__defineSetter__('y', function setterY(n) { |
||||
this.name = n; // setter y
|
this.name = n; // setter y
|
||||
}); |
}); |
||||
|
|
||||
c.__defineSetter__(3, function setter3(n) { |
c.__defineSetter__(3, function setter3(n) { |
||||
this.name = n; // setter 3
|
this.name = n; // setter 3
|
||||
}); |
}); |
||||
|
|
||||
var d = { |
var d = { |
||||
'c': c, |
'c': c, |
||||
}; |
}; |
||||
|
|
||||
function testGetter1_1() { |
function testGetter1_1() { |
||||
expected_function_name = 'getter1'; |
expected_function_name = 'getter1'; |
||||
expected_source_line_text = ' return this.name; // getter 1'; |
expected_source_line_text = ' return this.name; // getter 1'; |
||||
debugger; |
debugger; |
||||
var x = c.getter1; |
var x = c.getter1; |
||||
} |
} |
||||
|
|
||||
function testGetter1_2() { |
function testGetter1_2() { |
||||
expected_function_name = 'getter1'; |
expected_function_name = 'getter1'; |
||||
expected_source_line_text = ' return this.name; // getter 1'; |
expected_source_line_text = ' return this.name; // getter 1'; |
||||
debugger; |
debugger; |
||||
var x = c['getter1']; |
var x = c['getter1']; |
||||
} |
} |
||||
|
|
||||
function testGetter1_3() { |
function testGetter1_3() { |
||||
expected_function_name = 'getter1'; |
expected_function_name = 'getter1'; |
||||
expected_source_line_text = ' return this.name; // getter 1'; |
expected_source_line_text = ' return this.name; // getter 1'; |
||||
debugger; |
debugger; |
||||
for (var i = 1; i < 2; i++) { |
for (var i = 1; i < 2; i++) { |
||||
var x = c['getter' + i]; |
var x = c['getter' + i]; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
function testGetter1_4() { |
function testGetter1_4() { |
||||
expected_function_name = 'getter1'; |
expected_function_name = 'getter1'; |
||||
expected_source_line_text = ' return this.name; // getter 1'; |
expected_source_line_text = ' return this.name; // getter 1'; |
||||
debugger; |
debugger; |
||||
var x = d.c.getter1; |
var x = d.c.getter1; |
||||
} |
} |
||||
|
|
||||
function testGetter1_5() { |
function testGetter1_5() { |
||||
expected_function_name = 'getter1'; |
expected_function_name = 'getter1'; |
||||
expected_source_line_text = ' return this.name; // getter 1'; |
expected_source_line_text = ' return this.name; // getter 1'; |
||||
for (var i = 2; i != 1; i--); |
for (var i = 2; i != 1; i--); |
||||
debugger; |
debugger; |
||||
var x = d.c['getter' + i]; |
var x = d.c['getter' + i]; |
||||
} |
} |
||||
|
|
||||
function testGetter2_1() { |
function testGetter2_1() { |
||||
expected_function_name = 'getter2'; |
expected_function_name = 'getter2'; |
||||
expected_source_line_text = ' return { // getter 2'; |
expected_source_line_text = ' return { // getter 2'; |
||||
for (var i = 2; i != 1; i--); |
for (var i = 2; i != 1; i--); |
||||
debugger; |
debugger; |
||||
var t = d.c.getter2.name; |
var t = d.c.getter2.name; |
||||
} |
} |
||||
|
|
||||
|
|
||||
function testGetterY_1() { |
function testGetterY_1() { |
||||
expected_function_name = 'getterY'; |
expected_function_name = 'getterY'; |
||||
expected_source_line_text = ' return this.name; // getter y'; |
expected_source_line_text = ' return this.name; // getter y'; |
||||
debugger; |
debugger; |
||||
var t = d.c.y; |
var t = d.c.y; |
||||
} |
} |
||||
|
|
||||
function testIndexedGetter3_1() { |
function testIndexedGetter3_1() { |
||||
expected_function_name = 'getter3'; |
expected_function_name = 'getter3'; |
||||
expected_source_line_text = ' return this.name; // getter 3'; |
expected_source_line_text = ' return this.name; // getter 3'; |
||||
debugger; |
debugger; |
||||
var r = d.c[3]; |
var r = d.c[3]; |
||||
} |
} |
||||
|
|
||||
function testSetterY_1() { |
function testSetterY_1() { |
||||
expected_function_name = 'setterY'; |
expected_function_name = 'setterY'; |
||||
expected_source_line_text = ' this.name = n; // setter y'; |
expected_source_line_text = ' this.name = n; // setter y'; |
||||
debugger; |
debugger; |
||||
d.c.y = 'www'; |
d.c.y = 'www'; |
||||
} |
} |
||||
|
|
||||
function testIndexedSetter3_1() { |
function testIndexedSetter3_1() { |
||||
expected_function_name = 'setter3'; |
expected_function_name = 'setter3'; |
||||
expected_source_line_text = ' this.name = n; // setter 3'; |
expected_source_line_text = ' this.name = n; // setter 3'; |
||||
var i = 3 |
var i = 3 |
||||
debugger; |
debugger; |
||||
d.c[3] = 'www'; |
d.c[3] = 'www'; |
||||
} |
} |
||||
|
|
||||
function testSetter1_1() { |
function testSetter1_1() { |
||||
expected_function_name = 'setter1'; |
expected_function_name = 'setter1'; |
||||
expected_source_line_text = ' this.name = n; // setter 1'; |
expected_source_line_text = ' this.name = n; // setter 1'; |
||||
debugger; |
debugger; |
||||
d.c.setter1 = 'aa'; |
d.c.setter1 = 'aa'; |
||||
} |
} |
||||
|
|
||||
function testSetter1_2() { |
function testSetter1_2() { |
||||
expected_function_name = 'setter1'; |
expected_function_name = 'setter1'; |
||||
expected_source_line_text = ' this.name = n; // setter 1'; |
expected_source_line_text = ' this.name = n; // setter 1'; |
||||
debugger; |
debugger; |
||||
d.c['setter1'] = 'bb'; |
d.c['setter1'] = 'bb'; |
||||
} |
} |
||||
|
|
||||
function testSetter1_3() { |
function testSetter1_3() { |
||||
expected_function_name = 'setter1'; |
expected_function_name = 'setter1'; |
||||
expected_source_line_text = ' this.name = n; // setter 1'; |
expected_source_line_text = ' this.name = n; // setter 1'; |
||||
for (var i = 2; i != 1; i--); |
for (var i = 2; i != 1; i--); |
||||
debugger; |
debugger; |
||||
d.c['setter' + i] = i; |
d.c['setter' + i] = i; |
||||
} |
} |
||||
|
|
||||
var e = { |
var e = { |
||||
name: 'e' |
name: 'e' |
||||
}; |
}; |
||||
e.__proto__ = c; |
e.__proto__ = c; |
||||
|
|
||||
function testProtoGetter1_1() { |
function testProtoGetter1_1() { |
||||
expected_function_name = 'getter1'; |
expected_function_name = 'getter1'; |
||||
expected_source_line_text = ' return this.name; // getter 1'; |
expected_source_line_text = ' return this.name; // getter 1'; |
||||
debugger; |
debugger; |
||||
var x = e.getter1; |
var x = e.getter1; |
||||
} |
} |
||||
|
|
||||
function testProtoSetter1_1() { |
function testProtoSetter1_1() { |
||||
expected_function_name = 'setter1'; |
expected_function_name = 'setter1'; |
||||
expected_source_line_text = ' this.name = n; // setter 1'; |
expected_source_line_text = ' this.name = n; // setter 1'; |
||||
debugger; |
debugger; |
||||
e.setter1 = 'aa'; |
e.setter1 = 'aa'; |
||||
} |
} |
||||
|
|
||||
function testProtoIndexedGetter3_1() { |
function testProtoIndexedGetter3_1() { |
||||
expected_function_name = 'getter3'; |
expected_function_name = 'getter3'; |
||||
expected_source_line_text = ' return this.name; // getter 3'; |
expected_source_line_text = ' return this.name; // getter 3'; |
||||
debugger; |
debugger; |
||||
var x = e[3]; |
var x = e[3]; |
||||
} |
} |
||||
|
|
||||
function testProtoIndexedSetter3_1() { |
function testProtoIndexedSetter3_1() { |
||||
expected_function_name = 'setter3'; |
expected_function_name = 'setter3'; |
||||
expected_source_line_text = ' this.name = n; // setter 3'; |
expected_source_line_text = ' this.name = n; // setter 3'; |
||||
debugger; |
debugger; |
||||
e[3] = 'new val'; |
e[3] = 'new val'; |
||||
} |
} |
||||
|
|
||||
function testProtoSetter1_2() { |
function testProtoSetter1_2() { |
||||
expected_function_name = 'setter1'; |
expected_function_name = 'setter1'; |
||||
expected_source_line_text = ' this.name = n; // setter 1'; |
expected_source_line_text = ' this.name = n; // setter 1'; |
||||
for (var i = 2; i != 1; i--); |
for (var i = 2; i != 1; i--); |
||||
debugger; |
debugger; |
||||
e['setter' + i] = 'aa'; |
e['setter' + i] = 'aa'; |
||||
} |
} |
||||
|
|
||||
for (var n in this) { |
for (var n in this) { |
||||
if (n.substr(0, 4) != 'test') { |
if (n.substr(0, 4) != 'test') { |
||||
continue; |
continue; |
||||
} |
} |
||||
state = 1; |
state = 1; |
||||
this[n](); |
this[n](); |
||||
assertNull(exception); |
assertNull(exception); |
||||
assertEquals(3, state); |
assertEquals(3, state); |
||||
} |
} |
||||
|
|
||||
// Get rid of the debug event listener.
|
// Get rid of the debug event listener.
|
||||
Debug.setListener(null); |
Debug.setListener(null); |
||||
|
@ -1,78 +1,78 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
|
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var exception = null; |
var exception = null; |
||||
var state = 1; |
var state = 1; |
||||
var expected_source_line_text = null; |
var expected_source_line_text = null; |
||||
var expected_function_name = null; |
var expected_function_name = null; |
||||
|
|
||||
// Simple debug event handler which first time will cause 'step in' action
|
// Simple debug event handler which first time will cause 'step in' action
|
||||
// and than check that execution is paused inside function
|
// and than check that execution is paused inside function
|
||||
// expected_function_name.
|
// expected_function_name.
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
if (state == 1) { |
if (state == 1) { |
||||
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
||||
state = 2; |
state = 2; |
||||
} else if (state == 2) { |
} else if (state == 2) { |
||||
assertEquals(expected_function_name, event_data.func().name()); |
assertEquals(expected_function_name, event_data.func().name()); |
||||
assertEquals(expected_source_line_text, |
assertEquals(expected_source_line_text, |
||||
event_data.sourceLineText()); |
event_data.sourceLineText()); |
||||
state = 3; |
state = 3; |
||||
} |
} |
||||
} |
} |
||||
} catch(e) { |
} catch(e) { |
||||
exception = e; |
exception = e; |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
var a = [1,2,3,4,5]; |
var a = [1,2,3,4,5]; |
||||
|
|
||||
// Test step into function call from a function without local variables.
|
// Test step into function call from a function without local variables.
|
||||
function testStepInArraySlice() { |
function testStepInArraySlice() { |
||||
expected_function_name = 'testStepInArraySlice'; |
expected_function_name = 'testStepInArraySlice'; |
||||
expected_source_line_text = '} // expected line'; |
expected_source_line_text = '} // expected line'; |
||||
debugger; |
debugger; |
||||
var s = Array.prototype.slice.call(a, 2,3); |
var s = Array.prototype.slice.call(a, 2,3); |
||||
} // expected line
|
} // expected line
|
||||
|
|
||||
state = 1; |
state = 1; |
||||
testStepInArraySlice(); |
testStepInArraySlice(); |
||||
assertNull(exception); |
assertNull(exception); |
||||
assertEquals(3, state); |
assertEquals(3, state); |
||||
|
|
||||
// Get rid of the debug event listener.
|
// Get rid of the debug event listener.
|
||||
Debug.setListener(null); |
Debug.setListener(null); |
||||
|
@ -1,115 +1,115 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var exception = null; |
var exception = null; |
||||
var state = 0; |
var state = 0; |
||||
var expected_function_name = null; |
var expected_function_name = null; |
||||
var expected_source_line_text = null; |
var expected_source_line_text = null; |
||||
var expected_caller_source_line = null; |
var expected_caller_source_line = null; |
||||
var step_in_count = 2; |
var step_in_count = 2; |
||||
|
|
||||
// Simple debug event handler which first time will cause 'step in' action
|
// Simple debug event handler which first time will cause 'step in' action
|
||||
// to get into g.call and than check that execution is pauesed inside
|
// to get into g.call and than check that execution is pauesed inside
|
||||
// function 'g'.
|
// function 'g'.
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
if (state == 0) { |
if (state == 0) { |
||||
// Step into f().
|
// Step into f().
|
||||
exec_state.prepareStep(Debug.StepAction.StepIn, step_in_count); |
exec_state.prepareStep(Debug.StepAction.StepIn, step_in_count); |
||||
state = 2; |
state = 2; |
||||
} else if (state == 2) { |
} else if (state == 2) { |
||||
assertEquals(expected_source_line_text, |
assertEquals(expected_source_line_text, |
||||
event_data.sourceLineText()); |
event_data.sourceLineText()); |
||||
assertEquals(expected_function_name, event_data.func().name()); |
assertEquals(expected_function_name, event_data.func().name()); |
||||
state = 3; |
state = 3; |
||||
} |
} |
||||
} |
} |
||||
} catch(e) { |
} catch(e) { |
||||
exception = e; |
exception = e; |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
|
|
||||
function g() { |
function g() { |
||||
return "s"; // expected line
|
return "s"; // expected line
|
||||
} |
} |
||||
|
|
||||
function testFunction() { |
function testFunction() { |
||||
var f = g; |
var f = g; |
||||
var s = 1 +f(10); |
var s = 1 +f(10); |
||||
} |
} |
||||
|
|
||||
function g2() { |
function g2() { |
||||
return "s2"; // expected line
|
return "s2"; // expected line
|
||||
} |
} |
||||
|
|
||||
function testFunction2() { |
function testFunction2() { |
||||
var f = g2; |
var f = g2; |
||||
var s = 1 +f(10, 20); |
var s = 1 +f(10, 20); |
||||
} |
} |
||||
|
|
||||
// Run three times. First time the function will be compiled lazily,
|
// Run three times. First time the function will be compiled lazily,
|
||||
// second time cached version will be used.
|
// second time cached version will be used.
|
||||
for (var i = 0; i < 3; i++) { |
for (var i = 0; i < 3; i++) { |
||||
state = 0; |
state = 0; |
||||
expected_function_name = 'g'; |
expected_function_name = 'g'; |
||||
expected_source_line_text = ' return "s"; // expected line'; |
expected_source_line_text = ' return "s"; // expected line'; |
||||
step_in_count = 2; |
step_in_count = 2; |
||||
// Set a break point and call to invoke the debug event listener.
|
// Set a break point and call to invoke the debug event listener.
|
||||
Debug.setBreakPoint(testFunction, 1, 0); |
Debug.setBreakPoint(testFunction, 1, 0); |
||||
testFunction(); |
testFunction(); |
||||
assertNull(exception); |
assertNull(exception); |
||||
assertEquals(3, state); |
assertEquals(3, state); |
||||
} |
} |
||||
|
|
||||
// Test stepping into function call when a breakpoint is set at the place
|
// Test stepping into function call when a breakpoint is set at the place
|
||||
// of call. Use different pair of functions so that g2 is compiled lazily.
|
// of call. Use different pair of functions so that g2 is compiled lazily.
|
||||
// Run twice: first time function will be compiled lazily, second time
|
// Run twice: first time function will be compiled lazily, second time
|
||||
// cached version will be used.
|
// cached version will be used.
|
||||
for (var i = 0; i < 3; i++) { |
for (var i = 0; i < 3; i++) { |
||||
state = 0; |
state = 0; |
||||
expected_function_name = 'g2'; |
expected_function_name = 'g2'; |
||||
expected_source_line_text = ' return "s2"; // expected line'; |
expected_source_line_text = ' return "s2"; // expected line'; |
||||
step_in_count = 1; |
step_in_count = 1; |
||||
// Set a break point and call to invoke the debug event listener.
|
// Set a break point and call to invoke the debug event listener.
|
||||
Debug.setBreakPoint(testFunction2, 2, 0); |
Debug.setBreakPoint(testFunction2, 2, 0); |
||||
testFunction2(); |
testFunction2(); |
||||
assertNull(exception); |
assertNull(exception); |
||||
assertEquals(3, state); |
assertEquals(3, state); |
||||
} |
} |
||||
|
|
||||
|
|
||||
// Get rid of the debug event listener.
|
// Get rid of the debug event listener.
|
||||
Debug.setListener(null); |
Debug.setListener(null); |
||||
|
@ -1,149 +1,149 @@ |
|||||
// Copyright 2008 the V8 project authors. All rights reserved.
|
// Copyright 2008 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var exception = null; |
var exception = null; |
||||
var state = 0; |
var state = 0; |
||||
|
|
||||
// Simple debug event handler which first time will cause 'step in' action
|
// Simple debug event handler which first time will cause 'step in' action
|
||||
// to get into g.call and than check that execution is pauesed inside
|
// to get into g.call and than check that execution is pauesed inside
|
||||
// function 'g'.
|
// function 'g'.
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
if (state == 0) { |
if (state == 0) { |
||||
// Step into f2.call:
|
// Step into f2.call:
|
||||
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
||||
state = 2; |
state = 2; |
||||
} else if (state == 2) { |
} else if (state == 2) { |
||||
assertEquals('g', event_data.func().name()); |
assertEquals('g', event_data.func().name()); |
||||
assertEquals(' return t + 1; // expected line', |
assertEquals(' return t + 1; // expected line', |
||||
event_data.sourceLineText()); |
event_data.sourceLineText()); |
||||
state = 3; |
state = 3; |
||||
} |
} |
||||
} |
} |
||||
} catch(e) { |
} catch(e) { |
||||
exception = e; |
exception = e; |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
|
|
||||
// Sample functions.
|
// Sample functions.
|
||||
function g(t) { |
function g(t) { |
||||
return t + 1; // expected line
|
return t + 1; // expected line
|
||||
} |
} |
||||
|
|
||||
// Test step into function call from a function without local variables.
|
// Test step into function call from a function without local variables.
|
||||
function call1() { |
function call1() { |
||||
debugger; |
debugger; |
||||
g.call(null, 3); |
g.call(null, 3); |
||||
} |
} |
||||
|
|
||||
|
|
||||
// Test step into function call from a function with some local variables.
|
// Test step into function call from a function with some local variables.
|
||||
function call2() { |
function call2() { |
||||
var aLocalVar = 'test'; |
var aLocalVar = 'test'; |
||||
var anotherLocalVar = g(aLocalVar) + 's'; |
var anotherLocalVar = g(aLocalVar) + 's'; |
||||
var yetAnotherLocal = 10; |
var yetAnotherLocal = 10; |
||||
debugger; |
debugger; |
||||
g.call(null, 3); |
g.call(null, 3); |
||||
} |
} |
||||
|
|
||||
// Test step into function call which is a part of an expression.
|
// Test step into function call which is a part of an expression.
|
||||
function call3() { |
function call3() { |
||||
var alias = g; |
var alias = g; |
||||
debugger; |
debugger; |
||||
var r = 10 + alias.call(null, 3); |
var r = 10 + alias.call(null, 3); |
||||
var aLocalVar = 'test'; |
var aLocalVar = 'test'; |
||||
var anotherLocalVar = g(aLocalVar) + 's'; |
var anotherLocalVar = g(aLocalVar) + 's'; |
||||
var yetAnotherLocal = 10; |
var yetAnotherLocal = 10; |
||||
} |
} |
||||
|
|
||||
// Test step into function call from a function with some local variables.
|
// Test step into function call from a function with some local variables.
|
||||
function call4() { |
function call4() { |
||||
var alias = g; |
var alias = g; |
||||
debugger; |
debugger; |
||||
alias.call(null, 3); |
alias.call(null, 3); |
||||
var aLocalVar = 'test'; |
var aLocalVar = 'test'; |
||||
var anotherLocalVar = g(aLocalVar) + 's'; |
var anotherLocalVar = g(aLocalVar) + 's'; |
||||
var yetAnotherLocal = 10; |
var yetAnotherLocal = 10; |
||||
} |
} |
||||
|
|
||||
// Test step into function apply from a function without local variables.
|
// Test step into function apply from a function without local variables.
|
||||
function apply1() { |
function apply1() { |
||||
debugger; |
debugger; |
||||
g.apply(null, [3]); |
g.apply(null, [3]); |
||||
} |
} |
||||
|
|
||||
|
|
||||
// Test step into function apply from a function with some local variables.
|
// Test step into function apply from a function with some local variables.
|
||||
function apply2() { |
function apply2() { |
||||
var aLocalVar = 'test'; |
var aLocalVar = 'test'; |
||||
var anotherLocalVar = g(aLocalVar) + 's'; |
var anotherLocalVar = g(aLocalVar) + 's'; |
||||
var yetAnotherLocal = 10; |
var yetAnotherLocal = 10; |
||||
debugger; |
debugger; |
||||
g.apply(null, [3, 4]); |
g.apply(null, [3, 4]); |
||||
} |
} |
||||
|
|
||||
// Test step into function apply which is a part of an expression.
|
// Test step into function apply which is a part of an expression.
|
||||
function apply3() { |
function apply3() { |
||||
var alias = g; |
var alias = g; |
||||
debugger; |
debugger; |
||||
var r = 10 + alias.apply(null, [3, 'unused arg']); |
var r = 10 + alias.apply(null, [3, 'unused arg']); |
||||
var aLocalVar = 'test'; |
var aLocalVar = 'test'; |
||||
var anotherLocalVar = g(aLocalVar) + 's'; |
var anotherLocalVar = g(aLocalVar) + 's'; |
||||
var yetAnotherLocal = 10; |
var yetAnotherLocal = 10; |
||||
} |
} |
||||
|
|
||||
// Test step into function apply from a function with some local variables.
|
// Test step into function apply from a function with some local variables.
|
||||
function apply4() { |
function apply4() { |
||||
var alias = g; |
var alias = g; |
||||
debugger; |
debugger; |
||||
alias.apply(null, [3]); |
alias.apply(null, [3]); |
||||
var aLocalVar = 'test'; |
var aLocalVar = 'test'; |
||||
var anotherLocalVar = g(aLocalVar) + 's'; |
var anotherLocalVar = g(aLocalVar) + 's'; |
||||
var yetAnotherLocal = 10; |
var yetAnotherLocal = 10; |
||||
} |
} |
||||
|
|
||||
var testFunctions = |
var testFunctions = |
||||
[call1, call2, call3, call4, apply1, apply2, apply3, apply4]; |
[call1, call2, call3, call4, apply1, apply2, apply3, apply4]; |
||||
|
|
||||
for (var i = 0; i < testFunctions.length; i++) { |
for (var i = 0; i < testFunctions.length; i++) { |
||||
state = 0; |
state = 0; |
||||
testFunctions[i](); |
testFunctions[i](); |
||||
assertNull(exception); |
assertNull(exception); |
||||
assertEquals(3, state); |
assertEquals(3, state); |
||||
} |
} |
||||
|
|
||||
// Get rid of the debug event listener.
|
// Get rid of the debug event listener.
|
||||
Debug.setListener(null); |
Debug.setListener(null); |
@ -1,79 +1,79 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var exception = null; |
var exception = null; |
||||
var break_break_point_hit_count = 0; |
var break_break_point_hit_count = 0; |
||||
|
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
if (break_break_point_hit_count == 0) { |
if (break_break_point_hit_count == 0) { |
||||
assertEquals(' debugger;', |
assertEquals(' debugger;', |
||||
event_data.sourceLineText()); |
event_data.sourceLineText()); |
||||
assertEquals('runDoWhile', event_data.func().name()); |
assertEquals('runDoWhile', event_data.func().name()); |
||||
} else if (break_break_point_hit_count == 1) { |
} else if (break_break_point_hit_count == 1) { |
||||
assertEquals(' } while(condition());', |
assertEquals(' } while(condition());', |
||||
event_data.sourceLineText()); |
event_data.sourceLineText()); |
||||
assertEquals('runDoWhile', event_data.func().name()); |
assertEquals('runDoWhile', event_data.func().name()); |
||||
} |
} |
||||
|
|
||||
break_break_point_hit_count++; |
break_break_point_hit_count++; |
||||
// Continue stepping until returned to bottom frame.
|
// Continue stepping until returned to bottom frame.
|
||||
if (exec_state.frameCount() > 1) { |
if (exec_state.frameCount() > 1) { |
||||
exec_state.prepareStep(Debug.StepAction.StepNext); |
exec_state.prepareStep(Debug.StepAction.StepNext); |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
} catch(e) { |
} catch(e) { |
||||
exception = e; |
exception = e; |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
function condition() { |
function condition() { |
||||
return false; |
return false; |
||||
} |
} |
||||
|
|
||||
function runDoWhile() { |
function runDoWhile() { |
||||
do { |
do { |
||||
debugger; |
debugger; |
||||
} while(condition()); |
} while(condition()); |
||||
}; |
}; |
||||
|
|
||||
break_break_point_hit_count = 0; |
break_break_point_hit_count = 0; |
||||
runDoWhile(); |
runDoWhile(); |
||||
assertNull(exception); |
assertNull(exception); |
||||
assertEquals(4, break_break_point_hit_count); |
assertEquals(4, break_break_point_hit_count); |
||||
|
|
||||
// Get rid of the debug event listener.
|
// Get rid of the debug event listener.
|
||||
Debug.setListener(null); |
Debug.setListener(null); |
||||
|
@ -1,106 +1,106 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var exception = null; |
var exception = null; |
||||
var step_out_count = 1; |
var step_out_count = 1; |
||||
|
|
||||
// Simple debug event handler which counts the number of breaks hit and steps.
|
// Simple debug event handler which counts the number of breaks hit and steps.
|
||||
var break_point_hit_count = 0; |
var break_point_hit_count = 0; |
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
break_point_hit_count++; |
break_point_hit_count++; |
||||
// Continue stepping until returned to bottom frame.
|
// Continue stepping until returned to bottom frame.
|
||||
if (exec_state.frameCount() > 1) { |
if (exec_state.frameCount() > 1) { |
||||
exec_state.prepareStep(Debug.StepAction.StepOut, step_out_count); |
exec_state.prepareStep(Debug.StepAction.StepOut, step_out_count); |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
} catch(e) { |
} catch(e) { |
||||
exception = e; |
exception = e; |
||||
} |
} |
||||
|
|
||||
}; |
}; |
||||
|
|
||||
function BeginTest(name) { |
function BeginTest(name) { |
||||
test_name = name; |
test_name = name; |
||||
break_point_hit_count = 0; |
break_point_hit_count = 0; |
||||
exception = null; |
exception = null; |
||||
} |
} |
||||
|
|
||||
function EndTest(expected_break_point_hit_count) { |
function EndTest(expected_break_point_hit_count) { |
||||
assertEquals(expected_break_point_hit_count, break_point_hit_count, test_name); |
assertEquals(expected_break_point_hit_count, break_point_hit_count, test_name); |
||||
assertNull(exception, test_name); |
assertNull(exception, test_name); |
||||
test_name = null; |
test_name = null; |
||||
} |
} |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
|
|
||||
var shouldBreak = null; |
var shouldBreak = null; |
||||
function fact(x) { |
function fact(x) { |
||||
if (shouldBreak(x)) { |
if (shouldBreak(x)) { |
||||
debugger; |
debugger; |
||||
} |
} |
||||
if (x < 2) { |
if (x < 2) { |
||||
return 1; |
return 1; |
||||
} else { |
} else { |
||||
return x*fact(x-1); |
return x*fact(x-1); |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
BeginTest('Test 1'); |
BeginTest('Test 1'); |
||||
shouldBreak = function(x) { return x == 3; }; |
shouldBreak = function(x) { return x == 3; }; |
||||
step_out_count = 1; |
step_out_count = 1; |
||||
fact(3); |
fact(3); |
||||
EndTest(2); |
EndTest(2); |
||||
|
|
||||
BeginTest('Test 2'); |
BeginTest('Test 2'); |
||||
shouldBreak = function(x) { return x == 2; }; |
shouldBreak = function(x) { return x == 2; }; |
||||
step_out_count = 1; |
step_out_count = 1; |
||||
fact(3); |
fact(3); |
||||
EndTest(3); |
EndTest(3); |
||||
|
|
||||
BeginTest('Test 3'); |
BeginTest('Test 3'); |
||||
shouldBreak = function(x) { return x == 1; }; |
shouldBreak = function(x) { return x == 1; }; |
||||
step_out_count = 2; |
step_out_count = 2; |
||||
fact(3); |
fact(3); |
||||
EndTest(2); |
EndTest(2); |
||||
|
|
||||
BeginTest('Test 4'); |
BeginTest('Test 4'); |
||||
shouldBreak = function(x) { print(x); return x == 1 || x == 3; }; |
shouldBreak = function(x) { print(x); return x == 1 || x == 3; }; |
||||
step_out_count = 2; |
step_out_count = 2; |
||||
fact(3); |
fact(3); |
||||
EndTest(3); |
EndTest(3); |
||||
|
|
||||
// Get rid of the debug event listener.
|
// Get rid of the debug event listener.
|
||||
Debug.setListener(null); |
Debug.setListener(null); |
||||
|
@ -1,84 +1,84 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Flags: --expose-debug-as debug
|
// Flags: --expose-debug-as debug
|
||||
|
|
||||
// Get the Debug object exposed from the debug context global object.
|
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug |
Debug = debug.Debug |
||||
|
|
||||
var exception = null; |
var exception = null; |
||||
var state = 1; |
var state = 1; |
||||
var expected_source_line_text = null; |
var expected_source_line_text = null; |
||||
var expected_function_name = null; |
var expected_function_name = null; |
||||
|
|
||||
// Simple debug event handler which first time will cause 'step out' action
|
// Simple debug event handler which first time will cause 'step out' action
|
||||
// and than check that execution is paused inside function
|
// and than check that execution is paused inside function
|
||||
// expected_function_name.
|
// expected_function_name.
|
||||
function listener(event, exec_state, event_data, data) { |
function listener(event, exec_state, event_data, data) { |
||||
try { |
try { |
||||
if (event == Debug.DebugEvent.Break) { |
if (event == Debug.DebugEvent.Break) { |
||||
if (state == 1) { |
if (state == 1) { |
||||
exec_state.prepareStep(Debug.StepAction.StepOut, 2); |
exec_state.prepareStep(Debug.StepAction.StepOut, 2); |
||||
state = 2; |
state = 2; |
||||
} else if (state == 2) { |
} else if (state == 2) { |
||||
assertEquals(expected_function_name, event_data.func().name()); |
assertEquals(expected_function_name, event_data.func().name()); |
||||
assertEquals(expected_source_line_text, |
assertEquals(expected_source_line_text, |
||||
event_data.sourceLineText()); |
event_data.sourceLineText()); |
||||
state = 3; |
state = 3; |
||||
} |
} |
||||
} |
} |
||||
} catch(e) { |
} catch(e) { |
||||
exception = e; |
exception = e; |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
// Add the debug event listener.
|
// Add the debug event listener.
|
||||
Debug.setListener(listener); |
Debug.setListener(listener); |
||||
|
|
||||
var obj = {key:10}; |
var obj = {key:10}; |
||||
|
|
||||
function replacer(key, value) { |
function replacer(key, value) { |
||||
if (key == 'key') { |
if (key == 'key') { |
||||
debugger; |
debugger; |
||||
} |
} |
||||
return value; |
return value; |
||||
} |
} |
||||
|
|
||||
// Test step into function call from a function without local variables.
|
// Test step into function call from a function without local variables.
|
||||
function testStepOutToBuiltIn() { |
function testStepOutToBuiltIn() { |
||||
expected_function_name = 'testStepOutToBuiltIn'; |
expected_function_name = 'testStepOutToBuiltIn'; |
||||
expected_source_line_text = '} // expected line'; |
expected_source_line_text = '} // expected line'; |
||||
JSON.stringify(obj, replacer); |
JSON.stringify(obj, replacer); |
||||
} // expected line
|
} // expected line
|
||||
|
|
||||
state = 1; |
state = 1; |
||||
testStepOutToBuiltIn(); |
testStepOutToBuiltIn(); |
||||
assertNull(exception); |
assertNull(exception); |
||||
assertEquals(3, state); |
assertEquals(3, state); |
||||
|
|
||||
// Get rid of the debug event listener.
|
// Get rid of the debug event listener.
|
||||
Debug.setListener(null); |
Debug.setListener(null); |
||||
|
@ -1,38 +1,38 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
|
|
||||
// Flags: --expose-natives_as natives
|
// Flags: --expose-natives_as natives
|
||||
// Test keyed access to deleted property in a global object without access checks.
|
// Test keyed access to deleted property in a global object without access checks.
|
||||
// Regression test that exposed the_hole value from Runtime_KeyedGetPoperty.
|
// Regression test that exposed the_hole value from Runtime_KeyedGetPoperty.
|
||||
|
|
||||
var name = "fisk"; |
var name = "fisk"; |
||||
natives[name] = name; |
natives[name] = name; |
||||
function foo() { natives[name] + 12; } |
function foo() { natives[name] + 12; } |
||||
for(var i = 0; i < 3; i++) foo(); |
for(var i = 0; i < 3; i++) foo(); |
||||
delete natives[name]; |
delete natives[name]; |
||||
for(var i = 0; i < 3; i++) foo(); |
for(var i = 0; i < 3; i++) foo(); |
||||
|
@ -1,57 +1,57 @@ |
|||||
// Copyright 2009 the V8 project authors. All rights reserved.
|
// Copyright 2009 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// Tests from http://blog.stevenlevithan.com/archives/npcg-javascript
|
// Tests from http://blog.stevenlevithan.com/archives/npcg-javascript
|
||||
|
|
||||
assertEquals(true, /(x)?\1y/.test("y")); |
assertEquals(true, /(x)?\1y/.test("y")); |
||||
assertEquals(["y", undefined], /(x)?\1y/.exec("y")); |
assertEquals(["y", undefined], /(x)?\1y/.exec("y")); |
||||
assertEquals(["y", undefined], /(x)?y/.exec("y")); |
assertEquals(["y", undefined], /(x)?y/.exec("y")); |
||||
assertEquals(["y", undefined], "y".match(/(x)?\1y/)); |
assertEquals(["y", undefined], "y".match(/(x)?\1y/)); |
||||
assertEquals(["y", undefined], "y".match(/(x)?y/)); |
assertEquals(["y", undefined], "y".match(/(x)?y/)); |
||||
assertEquals(["y"], "y".match(/(x)?\1y/g)); |
assertEquals(["y"], "y".match(/(x)?\1y/g)); |
||||
assertEquals(["", undefined, ""], "y".split(/(x)?\1y/)); |
assertEquals(["", undefined, ""], "y".split(/(x)?\1y/)); |
||||
assertEquals(["", undefined, ""], "y".split(/(x)?y/)); |
assertEquals(["", undefined, ""], "y".split(/(x)?y/)); |
||||
assertEquals(0, "y".search(/(x)?\1y/)); |
assertEquals(0, "y".search(/(x)?\1y/)); |
||||
assertEquals("z", "y".replace(/(x)?\1y/, "z")); |
assertEquals("z", "y".replace(/(x)?\1y/, "z")); |
||||
assertEquals("", "y".replace(/(x)?y/, "$1")); |
assertEquals("", "y".replace(/(x)?y/, "$1")); |
||||
assertEquals("undefined", "y".replace(/(x)?\1y/, |
assertEquals("undefined", "y".replace(/(x)?\1y/, |
||||
function($0, $1){ |
function($0, $1){ |
||||
return String($1); |
return String($1); |
||||
})); |
})); |
||||
assertEquals("undefined", "y".replace(/(x)?y/, |
assertEquals("undefined", "y".replace(/(x)?y/, |
||||
function($0, $1){ |
function($0, $1){ |
||||
return String($1); |
return String($1); |
||||
})); |
})); |
||||
assertEquals("undefined", "y".replace(/(x)?y/, |
assertEquals("undefined", "y".replace(/(x)?y/, |
||||
function($0, $1){ |
function($0, $1){ |
||||
return $1; |
return $1; |
||||
})); |
})); |
||||
|
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=476146
|
// See https://bugzilla.mozilla.org/show_bug.cgi?id=476146
|
||||
assertEquals("bbc,b", /^(b+|a){1,2}?bc/.exec("bbc")); |
assertEquals("bbc,b", /^(b+|a){1,2}?bc/.exec("bbc")); |
||||
assertEquals("bbaa,a,,a", /((\3|b)\2(a)){2,}/.exec("bbaababbabaaaaabbaaaabba")); |
assertEquals("bbaa,a,,a", /((\3|b)\2(a)){2,}/.exec("bbaababbabaaaaabbaaaabba")); |
||||
|
|
||||
|
@ -0,0 +1,31 @@ |
|||||
|
// Copyright 2010 the V8 project authors. All rights reserved.
|
||||
|
// 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.
|
||||
|
|
||||
|
// Test that the code generator can cope with left and right being in
|
||||
|
// the same register for bitops.
|
||||
|
function f() { for (var i = 10; i < 100; i++) { return i | i; } } |
||||
|
assertEquals(10, f()); |
@ -1,31 +1,31 @@ |
|||||
// Copyright 2008 the V8 project authors. All rights reserved.
|
// Copyright 2008 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
// met:
|
||||
//
|
//
|
||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||
//
|
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
// See: http://code.google.com/p/v8/issues/detail?id=246
|
// See: http://code.google.com/p/v8/issues/detail?id=246
|
||||
|
|
||||
assertTrue(/(?:text)/.test("text")); |
assertTrue(/(?:text)/.test("text")); |
||||
assertEquals(["text"], /(?:text)/.exec("text")); |
assertEquals(["text"], /(?:text)/.exec("text")); |
Loading…
Reference in new issue