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.sendCommand("Runtime.enable", {}); | |
6 | |
7 addConsoleMessagePromise("console.log(239)") | |
8 .then(dumpMessage) | |
9 .then(() => addConsoleMessagePromise("var l = console.log;\n l(239)")) | |
10 .then(dumpMessage) | |
11 .then(() => InspectorTest.completeTest()); | |
12 | |
13 function addConsoleMessagePromise(expression) | |
14 { | |
15 var cb; | |
16 var p = new Promise((resolver) => cb = resolver); | |
17 InspectorTest.eventHandler["Runtime.consoleAPICalled"] = (messageObject) => cb
(messageObject); | |
18 InspectorTest.sendCommand("Runtime.evaluate", { expression: expression }); | |
19 return p; | |
20 } | |
21 | |
22 function dumpMessage(messageObject) | |
23 { | |
24 var msg = messageObject.params; | |
25 delete msg.executionContextId; | |
26 delete msg.args; | |
27 delete msg.timestamp; | |
28 for (var frame of msg.stackTrace.callFrames) | |
29 frame.scriptId = 0; | |
30 if (!frame.functionName) | |
31 frame.functionName = "(anonymous)"; | |
32 if (!frame.url) | |
33 frame.url = "(empty)"; | |
34 InspectorTest.logObject(msg); | |
35 } | |
OLD | NEW |