3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/console-test.js"></script>
7 // Used to interfere into InjectedScript._propertyDescriptors()
8 Object
.prototype.get = function() { return "FAIL"; };
9 Object
.prototype.set = function() { return "FAIL"; };
10 Object
.prototype.value
= "FAIL";
11 Object
.prototype.getter
= "FAIL";
12 Object
.prototype.setter
= "FAIL";
13 Object
.prototype.isOwn
= true;
14 // Used to interfere into InjectedScript.primitiveTypes
15 Object
.prototype.object
= true;
16 // Used to interfere into InjectedScript.getEventListeners()
17 Object
.prototype.nullValue
= null;
18 Object
.prototype.undefValue
= undefined;
32 console
.log('with: ' + a
);
33 eval("console.log('eval in with: ' + a)");
35 })({ a
: "Object property value" })
39 (function (a
) { eval("console.log('eval in function: ' + a)"); })("Function parameter")
42 function bodyText(f
) {
43 var text
= f
.toString();
44 var begin
= text
.indexOf("{");
45 return text
.substring(begin
);
48 function dumpAndClearConsoleMessages(next
)
50 InspectorTest
.runAfterPendingDispatches(function() {
51 InspectorTest
.dumpConsoleMessages();
52 InspectorTest
.consoleModel
.requestClearMessages();
53 InspectorTest
.runAfterPendingDispatches(next
);
57 InspectorTest
.runTestSuite([
58 function testSnippet1(next
)
60 InspectorTest
.evaluateInPage(bodyText(snippet1
), dumpAndClearConsoleMessages
.bind(null, next
));
63 function testSnippet2(next
)
65 InspectorTest
.evaluateInPage(bodyText(snippet2
), dumpAndClearConsoleMessages
.bind(null, next
));
68 function testConsoleEvalPrimitiveValue(next
)
70 InspectorTest
.evaluateInConsole("foo", dumpAndClearConsoleMessages
.bind(null, next
));
73 function testConsoleEvalObject(next
)
75 InspectorTest
.RuntimeAgent
.evaluate("testObj", step1
);
77 function step1(error
, result
)
79 InspectorTest
.RuntimeAgent
.getProperties(result
.objectId
, /* isOwnProperty */ true, step2
);
82 function step2(error
, properties
)
84 for (var i
= 0; i
< properties
.length
; i
++)
85 InspectorTest
.dump(properties
[i
], { objectId
: "formatAsTypeName" });
91 function testGetEventListenersDoesNotThrow(next
)
93 InspectorTest
.evaluateInConsole("getEventListeners(document.body.firstChild)", dumpAndClearConsoleMessages
.bind(null, next
));
99 <body onload=
"runTest()">
101 Tests that evaluating 'console.log()' in the console will have access to its outer scope variables.
102 <a href=
"https://bugs.webkit.org/show_bug.cgi?id=60547">Bug
60547.
</a>