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 InspectorTest.addScript(` | |
6 var self = this; | |
7 | |
8 function checkPrototype() { | |
9 const prototype1 = Object.getPrototypeOf(console); | |
10 const prototype2 = Object.getPrototypeOf(prototype1); | |
11 if (Object.getOwnPropertyNames(prototype1).length !== 0) | |
12 return "false: The [[Prototype]] must have no properties"; | |
13 if (prototype2 !== Object.prototype) | |
14 return "false: The [[Prototype]]'s [[Prototype]] must be %ObjectPrototype%"; | |
15 return "true"; | |
16 } | |
17 `); | |
18 | |
19 InspectorTest.runTestSuite([ | |
20 function consoleExistsOnGlobal(next) { | |
21 Protocol.Runtime.evaluate({ expression: "self.hasOwnProperty(\"console\")",
returnByValue: true}) | |
22 .then(message => InspectorTest.log(message.result.result.value)) | |
23 .then(next); | |
24 }, | |
25 | |
26 function consoleHasRightPropertyDescriptor(next) { | |
27 Protocol.Runtime.evaluate({ expression: "Object.getOwnPropertyDescriptor(sel
f, \"console\")", returnByValue: true}) | |
28 .then(dumpDescriptor) | |
29 .then(next); | |
30 | |
31 function dumpDescriptor(message) { | |
32 var value = message.result.result.value; | |
33 value.value = "<value>"; | |
34 InspectorTest.logObject(value); | |
35 } | |
36 }, | |
37 | |
38 function ConsoleNotExistsOnGlobal(next) { | |
39 Protocol.Runtime.evaluate({ expression: "\"Console\" in self", returnByValue
: true}) | |
40 .then(message => InspectorTest.log(message.result.result.value)) | |
41 .then(next); | |
42 }, | |
43 | |
44 function prototypeChainMustBeCorrect(next) { | |
45 Protocol.Runtime.evaluate({ expression: "checkPrototype()", returnByValue: t
rue }) | |
46 .then(message => InspectorTest.log(message.result.result.value)) | |
47 .then(next); | |
48 } | |
49 ]); | |
OLD | NEW |