Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: test/inspector/debugger/object-preview-internal-properties.js

Issue 2399003003: [inspector] filter useless in preview internal properties (Closed)
Patch Set: addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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("Check internal properties reported in object preview.");
6
7 Protocol.Debugger.enable();
8 Protocol.Runtime.enable();
9 Protocol.Runtime.onConsoleAPICalled(dumpInternalPropertiesAndEntries);
10
11 InspectorTest.runTestSuite([
12 function boxedObjects(next)
13 {
14 checkExpression("new Number(239)")
15 .then(() => checkExpression("new Boolean(false)"))
16 .then(() => checkExpression("new String(\"abc\")"))
17 .then(() => checkExpression("Object(Symbol(42))"))
18 .then(next);
19 },
20
21 function promise(next)
22 {
23 checkExpression("Promise.resolve(42)")
24 .then(() => checkExpression("new Promise(() => undefined)"))
25 .then(next);
26 },
27
28 function generatorObject(next)
29 {
30 checkExpression("(function* foo() { yield 1 })()")
31 .then(next);
32 },
33
34 function entriesInMapAndSet(next)
35 {
36 checkExpression("new Map([[1,2]])")
37 .then(() => checkExpression("new Set([1])"))
38 .then(() => checkExpression("new WeakMap([[{}, 42]])"))
39 .then(() => checkExpression("new WeakSet([{}])"))
40 .then(next);
41 },
42
43 function iteratorObject(next)
44 {
45 checkExpression("(new Map([[1,2]])).entries()")
46 .then(() => checkExpression("(new Set([[1,2]])).entries()"))
47 .then(next);
48 },
49
50 function noPreviewForFunctionObject(next)
51 {
52 var expression = "(function foo(){})";
53 InspectorTest.log(expression);
54 Protocol.Runtime.evaluate({ expression: expression, generatePreview: true})
55 .then(message => InspectorTest.logMessage(message))
56 .then(next);
57 },
58
59 function otherObjects(next)
60 {
61 checkExpression("[1,2,3]")
62 .then(() => checkExpression("/123/"))
63 .then(() => checkExpression("({})"))
64 .then(next);
65 },
66
67 function overridenArrayGetter(next)
68 {
69 Protocol.Runtime.evaluate({ expression: "Array.prototype.__defineGetter__(\" 0\",() => { throw new Error() }) "})
70 .then(() => checkExpression("Promise.resolve(42)"))
71 .then(next);
72 }
73 ]);
74
75 function checkExpression(expression)
76 {
77 InspectorTest.log(`expression: ${expression}`);
78 // console.table has higher limits for internal properties amount in preview.
79 return Protocol.Runtime.evaluate({ expression: `console.table(${expression})`, generatePreview: true });
80 }
81
82 function dumpInternalPropertiesAndEntries(message)
83 {
84 var properties;
85 var entries;
86 try {
87 var preview = message.params.args[0].preview;
88 properties = preview.properties;
89 entries = preview.entries;
90 } catch (e) {
91 InspectorTest.logMessage(message);
92 return;
93 }
94 if (!properties) {
95 InspectorTest.logMessage(message);
96 return;
97 }
98 for (var property of properties) {
99 if (property.name.startsWith("[["))
100 InspectorTest.logMessage(property);
101 }
102 if (entries) {
103 InspectorTest.log("[[Entries]]:");
104 InspectorTest.logMessage(entries);
105 }
106 InspectorTest.log("");
107 }
OLDNEW
« no previous file with comments | « src/inspector/v8-injected-script-host.cc ('k') | test/inspector/debugger/object-preview-internal-properties-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698