4 <script type="text/javascript" src="../../http/tests/inspector/inspector-test.js"></script>
6 // ------------------------------
7 // Setup Test Prototype Chain
8 // ------------------------------
10 function SuperBar() { this._bar = 10; }
11 SuperBar.prototype = {
12 __proto__: Object.prototype,
13 constructor: SuperBar,
15 get getterProperty() { return 20; },
16 get bar() { return this._bar; },
20 function SuperFoo() { SuperBar.call(this); this._foo = 5; }
21 SuperFoo.prototype = {
22 __proto__: SuperBar.prototype,
23 constructor: SuperFoo,
24 get getterProperty() { return 10; },
25 get foo() { return this._foo; }
28 function ClassWithBadGetter() {}
29 ClassWithBadGetter.prototype = {
30 __proto__: Object.prototype,
31 constructor: ClassWithBadGetter,
32 get badGetter() { throw "throw in getter"; }
36 // --------------------
38 // --------------------
40 // window.loadEvent is set inside of <body onload="..."> below.
41 var simpleObject = {a:1, b:"string"};
42 var complexObject = new SuperFoo;
43 var badGetterObject = new ClassWithBadGetter;
44 var unboundFunction = function() { console.log(arguments); }
45 var boundFunction = unboundFunction.bind(document.body, 1, 2, 3);
54 var currentStepIndex = 0;
56 {expression: "window.simpleObject"},
57 {expression: "window.loadEvent"},
58 {expression: "window.complexObject"},
59 {expression: "window.badGetterObject"},
60 {expression: "window.unboundFunction"},
61 {expression: "window.boundFunction"},
64 function runNextStep() {
65 if (currentStepIndex >= steps.length) {
66 InspectorTest.log("DONE");
67 InspectorTest.completeTest();
71 var step = steps[currentStepIndex++];
72 InspectorTest.log("");
73 InspectorTest.log("-----------------------------------------------------");
74 InspectorTest.log("EXPRESSION: " + step.expression);
76 WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, "test", false, true, false, false, function(remoteObject, wasThrown) {
77 InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
78 InspectorTest.log("type: " + remoteObject.type);
79 if (remoteObject.subtype)
80 InspectorTest.log("subtype: " + remoteObject.subtype);
81 InspectorTest.log("description: " + remoteObject.description);
82 remoteObject.getOwnPropertyDescriptors(function(properties) {
83 InspectorTest.log("\nOWN PROPERTIES:");
84 for (var property of properties) {
85 InspectorTest.assert(property instanceof WebInspector.PropertyDescriptor);
86 InspectorTest.log(" " + property.name);
90 remoteObject.getOwnAndGetterPropertyDescriptors(function(properties) {
91 InspectorTest.log("\nOWN AND GETTER PROPERTIES:");
92 for (var property of properties) {
93 InspectorTest.assert(property instanceof WebInspector.PropertyDescriptor);
94 InspectorTest.log(" " + property.name);
98 remoteObject.getAllPropertyDescriptors(function(properties) {
99 InspectorTest.log("\nALL PROPERTIES:");
100 for (var property of properties) {
101 InspectorTest.assert(property instanceof WebInspector.PropertyDescriptor);
102 InspectorTest.log(" " + property.name);
105 InspectorTest.log("-----------------------------------------------------");
115 <body onload="window.loadEvent = event; runTest()">