2015-12-08 07:10:35 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2016-03-21 19:39:16 +00:00
|
|
|
// Flags: --expose-debug-as debug
|
2015-12-08 07:10:35 +00:00
|
|
|
|
|
|
|
Debug = debug.Debug
|
|
|
|
|
|
|
|
var exception = null;
|
|
|
|
var log = [];
|
|
|
|
|
|
|
|
function listener(event, exec_state, event_data, data) {
|
|
|
|
if (event != Debug.DebugEvent.Break) return;
|
|
|
|
try {
|
|
|
|
print(event_data.sourceLineText());
|
|
|
|
var entry = "";
|
|
|
|
for (var i = 0; i < exec_state.frameCount(); i++) {
|
|
|
|
entry += exec_state.frame(i).sourceLineText().substr(-1);
|
|
|
|
entry += exec_state.frame(i).sourceColumn();
|
|
|
|
}
|
|
|
|
log.push(entry);
|
2015-12-16 08:39:39 +00:00
|
|
|
exec_state.prepareStep(Debug.StepAction.StepIn);
|
2015-12-08 07:10:35 +00:00
|
|
|
} catch (e) {
|
|
|
|
exception = e;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var target = {};
|
|
|
|
var handler = {
|
|
|
|
has: function(target, name) {
|
|
|
|
return true; // h
|
|
|
|
}, // i
|
|
|
|
get: function(target, name) {
|
|
|
|
return 42; // j
|
|
|
|
}, // k
|
|
|
|
set: function(target, name, value) {
|
|
|
|
return false; // l
|
|
|
|
}, // m
|
|
|
|
}
|
|
|
|
|
|
|
|
var proxy = new Proxy(target, handler);
|
|
|
|
|
|
|
|
Debug.setListener(listener);
|
|
|
|
debugger; // a
|
|
|
|
var has = "step" in proxy; // b
|
|
|
|
var get = proxy.step; // c
|
|
|
|
proxy.step = 43; // d
|
|
|
|
|
|
|
|
Debug.setListener(null); // g
|
|
|
|
|
|
|
|
assertNull(exception);
|
|
|
|
assertTrue(has);
|
|
|
|
assertEquals(42, get);
|
|
|
|
|
|
|
|
assertEquals([
|
|
|
|
"a0",
|
2016-04-22 13:11:31 +00:00
|
|
|
"b17", "h4b17", "i2b17", // [[Has]]
|
2016-03-07 13:39:49 +00:00
|
|
|
"c15", "j4c15", "k2c15", // [[Get]]
|
|
|
|
"d0", "l4d11", "m2d11", // [[Set]]
|
2015-12-08 07:10:35 +00:00
|
|
|
"g0"
|
|
|
|
], log);
|