OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 InspectorTest.log("Test that Runtime.getProperties doesn't truncate set and map
entries in internalProperties.") | 5 let {session, contextGroup, Protocol} = InspectorTest.start("Test that Runtime.g
etProperties doesn't truncate set and map entries in internalProperties.") |
6 | 6 |
7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
8 function createSet(size) { | 8 function createSet(size) { |
9 var s = new Set(); | 9 var s = new Set(); |
10 var a = {}; | 10 var a = {}; |
11 a.a = a; | 11 a.a = a; |
12 for (var i = 0; i < size; ++i) s.add({ wrapper: a}); | 12 for (var i = 0; i < size; ++i) s.add({ wrapper: a}); |
13 return s; | 13 return s; |
14 } | 14 } |
15 | 15 |
16 function createMap(size) { | 16 function createMap(size) { |
17 var m = new Map(); | 17 var m = new Map(); |
18 var a = {}; | 18 var a = {}; |
19 a.a = a; | 19 a.a = a; |
20 for (var i = 0; i < size; ++i) m.set(i, { wrapper: a}); | 20 for (var i = 0; i < size; ++i) m.set(i, { wrapper: a}); |
21 return m; | 21 return m; |
22 } | 22 } |
23 `); | 23 `); |
24 | 24 |
25 InspectorTest.setupInjectedScriptEnvironment(); | 25 contextGroup.setupInjectedScriptEnvironment(); |
26 | 26 |
27 Protocol.Debugger.enable(); | 27 Protocol.Debugger.enable(); |
28 Protocol.Runtime.enable(); | 28 Protocol.Runtime.enable(); |
29 | 29 |
30 testExpression("createSet(10)") | 30 testExpression("createSet(10)") |
31 .then(() => testExpression("createSet(1000)")) | 31 .then(() => testExpression("createSet(1000)")) |
32 .then(() => testExpression("createMap(10)")) | 32 .then(() => testExpression("createMap(10)")) |
33 .then(() => testExpression("createMap(1000)")) | 33 .then(() => testExpression("createMap(1000)")) |
34 .then(() => InspectorTest.completeTest()); | 34 .then(() => InspectorTest.completeTest()); |
35 | 35 |
36 function testExpression(expression) | 36 function testExpression(expression) |
37 { | 37 { |
38 return Protocol.Runtime.evaluate({ "expression": expression}) | 38 return Protocol.Runtime.evaluate({ "expression": expression}) |
39 .then(result => Protocol.Runtime.getProperties({ ownProperties: true,
objectId: result.result.result.objectId })) | 39 .then(result => Protocol.Runtime.getProperties({ ownProperties: true,
objectId: result.result.result.objectId })) |
40 .then(message => dumpEntriesDescription(expression, message)); | 40 .then(message => dumpEntriesDescription(expression, message)); |
41 } | 41 } |
42 | 42 |
43 function dumpEntriesDescription(expression, message) | 43 function dumpEntriesDescription(expression, message) |
44 { | 44 { |
45 InspectorTest.log(`Entries for "${expression}"`); | 45 InspectorTest.log(`Entries for "${expression}"`); |
46 var properties = message.result.internalProperties; | 46 var properties = message.result.internalProperties; |
47 var property; | 47 var property; |
48 if (properties) | 48 if (properties) |
49 property = properties.find(property => property.name === "[[Entries]]"); | 49 property = properties.find(property => property.name === "[[Entries]]"); |
50 if (!property) | 50 if (!property) |
51 InspectorTest.log("[[Entries]] not found"); | 51 InspectorTest.log("[[Entries]] not found"); |
52 else | 52 else |
53 InspectorTest.log(property.value.description); | 53 InspectorTest.log(property.value.description); |
54 } | 54 } |
OLD | NEW |