OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 print('Checks internal properties in Runtime.getProperties output'); | 5 print('Checks internal properties in Runtime.getProperties output'); |
6 | 6 |
| 7 InspectorTest.addScript(` |
| 8 function* foo() { |
| 9 yield 1; |
| 10 } |
| 11 var gen1 = foo(); |
| 12 var gen2 = foo(); |
| 13 //# sourceURL=test.js`, 7, 26); |
| 14 |
7 Protocol.Runtime.enable(); | 15 Protocol.Runtime.enable(); |
8 Protocol.Debugger.enable(); | 16 Protocol.Debugger.enable(); |
9 | 17 |
10 InspectorTest.runTestSuite([ | 18 InspectorTest.runTestSuite([ |
11 function generatorFunction(next) { | 19 function generatorFunction(next) { |
12 checkExpression('(function* foo() { yield 1 })').then(next); | 20 checkExpression('(function* foo() { yield 1 })').then(next); |
13 }, | 21 }, |
14 | 22 |
15 function regularFunction(next) { | 23 function regularFunction(next) { |
16 checkExpression('(function foo() {})').then(next); | 24 checkExpression('(function foo() {})').then(next); |
17 }, | 25 }, |
18 | 26 |
19 function boxedObjects(next) { | 27 function boxedObjects(next) { |
20 checkExpression('new Number(239)') | 28 checkExpression('new Number(239)') |
21 .then(() => checkExpression('new Boolean(false)')) | 29 .then(() => checkExpression('new Boolean(false)')) |
22 .then(() => checkExpression('new String(\'abc\')')) | 30 .then(() => checkExpression('new String(\'abc\')')) |
23 .then(() => checkExpression('Object(Symbol(42))')) | 31 .then(() => checkExpression('Object(Symbol(42))')) |
24 .then(next); | 32 .then(next); |
25 }, | 33 }, |
26 | 34 |
27 function promise(next) { | 35 function promise(next) { |
28 checkExpression('Promise.resolve(42)') | 36 checkExpression('Promise.resolve(42)') |
29 .then(() => checkExpression('new Promise(() => undefined)')) | 37 .then(() => checkExpression('new Promise(() => undefined)')) |
30 .then(next); | 38 .then(next); |
31 }, | 39 }, |
32 | 40 |
33 function generatorObject(next) { | 41 function generatorObject(next) { |
34 checkExpression('(function* foo() { yield 1 })()') | 42 checkExpression('gen1') |
| 43 .then(() => checkExpression('gen1.next();gen1')) |
| 44 .then(() => checkExpression('gen1.next();gen1')) |
35 .then(next); | 45 .then(next); |
36 }, | 46 }, |
37 | 47 |
| 48 function generatorObjectDebuggerDisabled(next) { |
| 49 Protocol.Debugger.disable() |
| 50 .then(() => checkExpression('gen2')) |
| 51 .then(() => checkExpression('gen2.next();gen2')) |
| 52 .then(() => checkExpression('gen2.next();gen2')) |
| 53 .then(next); |
| 54 }, |
| 55 |
38 function iteratorObject(next) { | 56 function iteratorObject(next) { |
39 checkExpression('(new Map([[1,2]])).entries()') | 57 checkExpression('(new Map([[1,2]])).entries()') |
40 .then(() => checkExpression('(new Set([[1,2]])).entries()')) | 58 .then(() => checkExpression('(new Set([[1,2]])).entries()')) |
41 .then(next); | 59 .then(next); |
42 } | 60 } |
43 ]); | 61 ]); |
44 | 62 |
45 function checkExpression(expression) | 63 function checkExpression(expression) |
46 { | 64 { |
47 InspectorTest.log(`expression: ${expression}`); | 65 InspectorTest.log(`expression: ${expression}`); |
48 return Protocol.Runtime.evaluate({ expression: expression }) | 66 return Protocol.Runtime.evaluate({ expression: expression }) |
49 .then(message => Protocol.Runtime.getProperties({ objectId: message.result.r
esult.objectId })) | 67 .then(message => Protocol.Runtime.getProperties({ objectId: message.result.r
esult.objectId })) |
50 .then(message => { delete message.result.result; return message; }) | 68 .then(message => { delete message.result.result; return message; }) |
51 .then(InspectorTest.logMessage); | 69 .then(InspectorTest.logMessage); |
52 } | 70 } |
OLD | NEW |