Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 print("Test that Runtime.getProperties doesn't truncate set and map entries in i nternalProperties.") | |
| 6 | |
| 7 InspectorTest.evaluateInPage(` | |
| 8 function createSet(size) { | |
| 9 var s = new Set(); | |
| 10 var a = {}; | |
| 11 a.a = a; | |
| 12 for (var i = 0; i < size; ++i) s.add({ wrapper: a}); | |
| 13 return s; | |
| 14 } | |
| 15 | |
| 16 function createMap(size) { | |
| 17 var m = new Map(); | |
| 18 var a = {}; | |
| 19 a.a = a; | |
| 20 for (var i = 0; i < size; ++i) m.set(i, { wrapper: a}); | |
| 21 return m; | |
| 22 } | |
| 23 `); | |
| 24 | |
| 25 InspectorTest.sendCommand("Debugger.enable"); | |
| 26 InspectorTest.sendCommand("Runtime.enable"); | |
| 27 | |
| 28 testExpression("createSet(10)") | |
| 29 .then(() => testExpression("createSet(1000)")) | |
| 30 .then(() => testExpression("createMap(10)")) | |
| 31 .then(() => testExpression("createMap(1000)")) | |
| 32 .then(() => InspectorTest.completeTest()) | |
| 33 .catch((e) => { InspectorTest.log(e); InspectorTest.completeTest() }); | |
| 34 | |
| 35 function testExpression(expression) | |
| 36 { | |
| 37 return InspectorTest.sendCommandPromise("Runtime.evaluate", { "expression": ex pression}) | |
| 38 .then((result) => InspectorTest.sendCommandPromise("Runtime.getProper ties", { ownProperties: true, objectId: result.result.result.objectId })) | |
| 39 .then((message) => dumpEntriesDescription(expression, message)) | |
| 40 .catch((e) => { InspectorTest.log(e); InspectorTest.completeTest() }) | |
|
dgozman
2016/09/28 20:28:19
Remove catch!
kozy
2016/09/30 02:04:32
Done.
| |
| 41 } | |
| 42 | |
| 43 function dumpEntriesDescription(expression, message) | |
| 44 { | |
| 45 InspectorTest.log(`Entries for "${expression}"`); | |
| 46 var properties = message.result.internalProperties; | |
| 47 if (properties) | |
| 48 properties = properties.filter((property) => property.name === "[[Entries]]" ); | |
| 49 if (!properties || properties.length === 0) | |
| 50 InspectorTest.log("[[Entries]] not found"); | |
| 51 else | |
| 52 InspectorTest.log(properties[0].value.description); | |
| 53 } | |
| OLD | NEW |