| OLD | NEW |
| 1 var initialize_ConsoleTest = function() { | 1 var initialize_ConsoleTest = function() { |
| 2 | 2 |
| 3 InspectorTest.preloadPanel("console"); | 3 InspectorTest.preloadPanel("console"); |
| 4 | 4 |
| 5 InspectorTest.evaluateInConsole = function(code, callback) | 5 InspectorTest.evaluateInConsole = function(code, callback) |
| 6 { | 6 { |
| 7 callback = InspectorTest.safeWrap(callback); | 7 callback = InspectorTest.safeWrap(callback); |
| 8 | 8 |
| 9 var consoleView = WebInspector.ConsolePanel._view(); | 9 var consoleView = WebInspector.ConsolePanel._view(); |
| 10 consoleView.visible = true; | 10 consoleView.visible = true; |
| 11 consoleView._prompt.text = code; | 11 consoleView._prompt.text = code; |
| 12 var event = document.createEvent("KeyboardEvent"); | 12 var event = document.createEvent("KeyboardEvent"); |
| 13 event.initKeyboardEvent("keydown", true, true, null, "Enter", ""); | 13 event.initKeyboardEvent("keydown", true, true, null, "Enter", ""); |
| 14 consoleView._prompt.proxyElement.dispatchEvent(event); | 14 consoleView._prompt.proxyElement.dispatchEvent(event); |
| 15 InspectorTest.addConsoleViewSniffer(function(commandResult) { | 15 InspectorTest.addConsoleViewSniffer(function(commandResult) { |
| 16 callback(commandResult.toMessageElement().textContent); | 16 callback(commandResult.toMessageElement().deepTextContent()); |
| 17 }); | 17 }); |
| 18 } | 18 } |
| 19 | 19 |
| 20 InspectorTest.addConsoleViewSniffer = function(override, opt_sticky) | 20 InspectorTest.addConsoleViewSniffer = function(override, opt_sticky) |
| 21 { | 21 { |
| 22 var sniffer = function (viewMessage) { | 22 var sniffer = function (viewMessage) { |
| 23 override(viewMessage); | 23 override(viewMessage); |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessag
eAddedForTest", sniffer, opt_sticky); | 26 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessag
eAddedForTest", sniffer, opt_sticky); |
| 27 } | 27 } |
| 28 | 28 |
| 29 InspectorTest.evaluateInConsoleAndDump = function(code, callback) | 29 InspectorTest.evaluateInConsoleAndDump = function(code, callback) |
| 30 { | 30 { |
| 31 callback = InspectorTest.safeWrap(callback); | 31 callback = InspectorTest.safeWrap(callback); |
| 32 | 32 |
| 33 function mycallback(text) | 33 function mycallback(text) |
| 34 { | 34 { |
| 35 InspectorTest.addResult(code + " = " + text); | 35 InspectorTest.addResult(code + " = " + text); |
| 36 callback(text); | 36 callback(text); |
| 37 } | 37 } |
| 38 InspectorTest.evaluateInConsole(code, mycallback); | 38 InspectorTest.evaluateInConsole(code, mycallback); |
| 39 } | 39 } |
| 40 | 40 |
| 41 InspectorTest.prepareConsoleMessageText = function(messageElement, consoleMessag
e) | 41 InspectorTest.prepareConsoleMessageText = function(messageElement, consoleMessag
e) |
| 42 { | 42 { |
| 43 var messageText = messageElement.textContent.replace(/\u200b/g, ""); | 43 var messageText = messageElement.deepTextContent().replace(/\u200b/g, ""); |
| 44 // Replace scriptIds with generic scriptId string to avoid flakiness. | 44 // Replace scriptIds with generic scriptId string to avoid flakiness. |
| 45 messageText = messageText.replace(/VM\d+/g, "VM"); | 45 messageText = messageText.replace(/VM\d+/g, "VM"); |
| 46 // Strip out InjectedScript line numbers from stack traces to avoid rebaseli
ning each time InjectedScriptSource is edited. | 46 // Strip out InjectedScript line numbers from stack traces to avoid rebaseli
ning each time InjectedScriptSource is edited. |
| 47 messageText = messageText.replace(/VM:\d+ InjectedScript\./g, " InjectedScri
pt."); | 47 messageText = messageText.replace(/VM:\d+ InjectedScript\./g, " InjectedScri
pt."); |
| 48 // Strip out InjectedScript line numbers from console message anchor. | 48 // Strip out InjectedScript line numbers from console message anchor. |
| 49 var functionName = consoleMessage && consoleMessage.stackTrace && consoleMes
sage.stackTrace[0] && consoleMessage.stackTrace[0].functionName || ""; | 49 var functionName = consoleMessage && consoleMessage.stackTrace && consoleMes
sage.stackTrace[0] && consoleMessage.stackTrace[0].functionName || ""; |
| 50 if (functionName.indexOf("InjectedScript") !== -1) | 50 if (functionName.indexOf("InjectedScript") !== -1) |
| 51 messageText = messageText.replace(/\bVM:\d+/, ""); // Only first replace
. | 51 messageText = messageText.replace(/\bVM:\d+/, ""); // Only first replace
. |
| 52 if (messageText.startsWith("Navigated to")) { | 52 if (messageText.startsWith("Navigated to")) { |
| 53 var fileName = messageText.split(" ").pop().split("/").pop(); | 53 var fileName = messageText.split(" ").pop().split("/").pop(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 256 } |
| 257 if (!option) { | 257 if (!option) { |
| 258 InspectorTest.addResult("FAILED: context with prefix: " + namePrefix +
" not found in the context list"); | 258 InspectorTest.addResult("FAILED: context with prefix: " + namePrefix +
" not found in the context list"); |
| 259 return; | 259 return; |
| 260 } | 260 } |
| 261 option.selected = true; | 261 option.selected = true; |
| 262 WebInspector.ConsolePanel._view()._executionContextChanged(); | 262 WebInspector.ConsolePanel._view()._executionContextChanged(); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } | 265 } |
| OLD | NEW |