diff options
| author | pfeldman <pfeldman@chromium.org> | 2016-03-24 15:50:19 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-24 22:51:08 +0000 |
| commit | a7467383c208ef2e5a90d8e20979b6ba722ac104 (patch) | |
| tree | 4a4658da1d0675b0efa18fd64db215c9599fcb4c | |
| parent | 9deaa936de481ebfae777b936e44720c311aa4d9 (diff) | |
| download | chromium_src-a7467383c208ef2e5a90d8e20979b6ba722ac104.zip chromium_src-a7467383c208ef2e5a90d8e20979b6ba722ac104.tar.gz chromium_src-a7467383c208ef2e5a90d8e20979b6ba722ac104.tar.bz2 | |
DevTools: [ux regression] There is no way to clear console history.
BUG=594342
Review URL: https://codereview.chromium.org/1820393002
Cr-Commit-Position: refs/heads/master@{#383174}
33 files changed, 147 insertions, 95 deletions
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages.html b/third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages.html index c00830c..54be7f8 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages.html +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages.html @@ -7,12 +7,12 @@ console.log("message from page!"); function test() { - var checkbox = WebInspector.ConsolePanel._view()._showAllMessagesCheckbox.inputElement; + var checkbox = WebInspector.ConsoleView.instance()._showAllMessagesCheckbox.inputElement; //we can't use usual InspectorTest.dumpConsoleMessages(), because it dumps url of message and it flakes in case of iframe function dumpVisibleConsoleMessageText() { - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messageViews.length; ++i) { InspectorTest.addResult(messageViews[i].consoleMessage().messageText); } diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js index 8155389..c5a4fad 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js @@ -7,7 +7,7 @@ InspectorTest.evaluateInConsole = function(code, callback) { callback = InspectorTest.safeWrap(callback); - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); consoleView.visible = true; consoleView._prompt.setText(code); var event = document.createEvent("KeyboardEvent"); @@ -61,7 +61,7 @@ InspectorTest.disableConsoleViewport = function() InspectorTest.fixConsoleViewportDimensions = function(width, height) { - var viewport = WebInspector.ConsolePanel._view()._viewport; + var viewport = WebInspector.ConsoleView.instance()._viewport; viewport.element.style.width = width + "px"; viewport.element.style.height = height + "px"; viewport.element.style.position = "absolute"; @@ -70,7 +70,7 @@ InspectorTest.fixConsoleViewportDimensions = function(width, height) InspectorTest.consoleMessagesCount = function() { - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); return consoleView._consoleMessages.length; } @@ -84,7 +84,7 @@ InspectorTest.dumpConsoleMessagesIntoArray = function(printOriginatingCommand, d formatter = formatter || InspectorTest.prepareConsoleMessageText; var result = []; InspectorTest.disableConsoleViewport(); - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); if (consoleView._needsFullUpdate) consoleView._updateMessageList(); var viewMessages = consoleView._visibleViewMessages; @@ -147,7 +147,7 @@ InspectorTest.dumpConsoleMessagesIgnoreErrorStackFrames = function(printOriginat InspectorTest.dumpConsoleTableMessage = function(viewMessage, forceInvalidate, results) { if (forceInvalidate) - WebInspector.ConsolePanel._view()._viewport.invalidate(); + WebInspector.ConsoleView.instance()._viewport.invalidate(); var table = viewMessage.contentElement(); var headers = table.querySelectorAll("th > div:first-child"); if (!headers.length) @@ -186,7 +186,7 @@ InspectorTest.dumpConsoleTableMessage = function(viewMessage, forceInvalidate, r InspectorTest.dumpConsoleMessagesWithStyles = function(sortMessages) { var result = []; - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messageViews.length; ++i) { var element = messageViews[i].contentElement(); var messageText = InspectorTest.prepareConsoleMessageText(element) @@ -199,7 +199,7 @@ InspectorTest.dumpConsoleMessagesWithStyles = function(sortMessages) InspectorTest.dumpConsoleMessagesWithClasses = function(sortMessages) { var result = []; - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messageViews.length; ++i) { var element = messageViews[i].contentElement(); var messageText = InspectorTest.prepareConsoleMessageText(element); @@ -213,7 +213,7 @@ InspectorTest.dumpConsoleMessagesWithClasses = function(sortMessages) { InspectorTest.dumpConsoleClassesBrief = function() { - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messageViews.length; ++i) InspectorTest.addResult(messageViews[i].toMessageElement().className); } @@ -228,7 +228,7 @@ InspectorTest.dumpConsoleCounters = function() InspectorTest.expandConsoleMessages = function(callback, deepFilter, sectionFilter) { - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; // Initiate round-trips to fetch necessary data for further rendering. for (var i = 0; i < messageViews.length; ++i) @@ -266,7 +266,7 @@ InspectorTest.expandConsoleMessages = function(callback, deepFilter, sectionFilt InspectorTest.expandGettersInConsoleMessages = function(callback) { - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; var properties = []; var propertiesCount = 0; InspectorTest.addSniffer(WebInspector.ObjectPropertyTreeElement.prototype, "_updateExpandable", propertyExpandableUpdated); @@ -296,7 +296,7 @@ InspectorTest.expandGettersInConsoleMessages = function(callback) InspectorTest.expandConsoleMessagesErrorParameters = function(callback) { - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; // Initiate round-trips to fetch necessary data for further rendering. for (var i = 0; i < messageViews.length; ++i) messageViews[i].contentElement(); @@ -321,7 +321,7 @@ InspectorTest.expandConsoleMessagesErrorParameters = function(callback) InspectorTest.waitForRemoteObjectsConsoleMessages = function(callback) { - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messages.length; ++i) messages[i].toMessageElement(); InspectorTest.runAfterPendingDispatches(callback); @@ -329,7 +329,7 @@ InspectorTest.waitForRemoteObjectsConsoleMessages = function(callback) InspectorTest.checkConsoleMessagesDontHaveParameters = function() { - var messageViews = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messageViews.length; ++i) { var m = messageViews[i].consoleMessage(); InspectorTest.addResult("Message[" + i + "]:"); @@ -364,7 +364,7 @@ InspectorTest.waitUntilNthMessageReceived = function(count, callback) InspectorTest.changeExecutionContext = function(namePrefix) { - var selector = WebInspector.ConsolePanel._view()._executionContextModel._selectElement; + var selector = WebInspector.ConsoleView.instance()._executionContextModel._selectElement; var option = selector.firstChild; while (option) { if (option.textContent && option.textContent.startsWith(namePrefix)) @@ -376,12 +376,12 @@ InspectorTest.changeExecutionContext = function(namePrefix) return; } option.selected = true; - WebInspector.ConsolePanel._view()._executionContextModel._executionContextChanged(); + WebInspector.ConsoleView.instance()._executionContextModel._executionContextChanged(); } InspectorTest.waitForConsoleMessages = function(expectedCount, callback) { - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); checkAndReturn(); function checkAndReturn() diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection.html b/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection.html index 40a00de..f985dfc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection.html +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection.html @@ -29,7 +29,7 @@ function test() return; InspectorTest.addResult("script was added"); - var message = WebInspector.ConsolePanel._view()._visibleViewMessages[0]; + var message = WebInspector.ConsoleView.instance()._visibleViewMessages[0]; message._anchorElement.click(); } diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/resources/stacktrace-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/resources/stacktrace-test.js index 5d8d556..1b12829 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/resources/stacktrace-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/resources/stacktrace-test.js @@ -2,7 +2,7 @@ function test() { InspectorTest.addConsoleSniffer(addMessage); function addMessage(message) { - var viewMessages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < viewMessages.length; ++i) { var m = viewMessages[i].consoleMessage(); InspectorTest.addResult("Message[" + i + "]: " + WebInspector.displayNameForURL(m.url) + ":" + m.line + " " + m.messageText); diff --git a/third_party/WebKit/LayoutTests/inspector-enabled/sources/debugger/script-formatter-console.html b/third_party/WebKit/LayoutTests/inspector-enabled/sources/debugger/script-formatter-console.html index d8b3a98..c0f8db7 100644 --- a/third_party/WebKit/LayoutTests/inspector-enabled/sources/debugger/script-formatter-console.html +++ b/third_party/WebKit/LayoutTests/inspector-enabled/sources/debugger/script-formatter-console.html @@ -69,7 +69,7 @@ var test = function() function dumpConsoleMessageURLs() { - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messages.length; ++i) { var element = messages[i].toMessageElement(); var anchor = element.querySelector(".console-message-url"); diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-big-array.html b/third_party/WebKit/LayoutTests/inspector/console/console-big-array.html index 93fd8c8..3afe44a 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-big-array.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-big-array.html @@ -61,7 +61,7 @@ function test() { WebInspector.ArrayGroupingTreeElement._bucketThreshold = 20; - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; var sections = []; for (var i = 0; i < messages.length; ++i) { var consoleMessage = messages[i].consoleMessage(); diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-copy-treeoutline.html b/third_party/WebKit/LayoutTests/inspector/console/console-copy-treeoutline.html index be3fafd..9b57c164 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-copy-treeoutline.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-copy-treeoutline.html @@ -19,7 +19,7 @@ function prepareForTest() function test() { InspectorTest.fixConsoleViewportDimensions(600, 200); - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); var viewport = consoleView._viewport; InspectorTest.runTestSuite([ diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-custom-formatters.html b/third_party/WebKit/LayoutTests/inspector/console/console-custom-formatters.html index 4aa79c1..ca4d565 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-custom-formatters.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-custom-formatters.html @@ -136,7 +136,7 @@ function test() function expandVariablesInConsole() { - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); if (consoleView._needsFullUpdate) consoleView._updateMessageList(); var viewMessages = consoleView._visibleViewMessages; diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-edit-expanded-tree.html b/third_party/WebKit/LayoutTests/inspector/console/console-edit-expanded-tree.html index 8a5bdcc..4566896 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-edit-expanded-tree.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-edit-expanded-tree.html @@ -20,7 +20,7 @@ function test() function onConsoleMessageExpanded() { - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messages.length; ++i) { var message = messages[i]; var node = message.contentElement(); @@ -36,7 +36,7 @@ function test() function onTreeElement(treeElement) { treeElement._startEditing(); - WebInspector.ConsolePanel._view()._viewport.refresh(); + WebInspector.ConsoleView.instance()._viewport.refresh(); InspectorTest.addResult("After viewport refresh tree element remains in editing mode: " + !!treeElement._prompt); InspectorTest.completeTest(); } diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-eval-exception-report.html b/third_party/WebKit/LayoutTests/inspector/console/console-eval-exception-report.html index 7998015..d1c7b24 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-eval-exception-report.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-eval-exception-report.html @@ -20,7 +20,7 @@ function test() { InspectorTest.dumpConsoleMessages(); - var viewMessages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessages; var uiMessage = viewMessages[viewMessages.length - 1]; var message = uiMessage.consoleMessage(); var stackTrace = message.stackTrace; diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-filter-level-test.html b/third_party/WebKit/LayoutTests/inspector/console/console-filter-level-test.html index 8bb9dae..e21cdd8 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-filter-level-test.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-filter-level-test.html @@ -29,7 +29,7 @@ function test() { function dumpVisibleMessages() { - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messages.length; i++) InspectorTest.addResult(">" + messages[i].toMessageElement().deepTextContent()); @@ -45,45 +45,45 @@ function test() function onlyWarning(next) { - WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("warning"); + WebInspector.ConsoleView.instance()._filter._levelFilterUI._toggleTypeFilter("warning"); dumpVisibleMessages(); next(); }, function onlyLog(next) { - WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("log"); + WebInspector.ConsoleView.instance()._filter._levelFilterUI._toggleTypeFilter("log"); dumpVisibleMessages(); next(); }, function onlyErrorDebug(next) { - WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("error"); - WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("debug", true); + WebInspector.ConsoleView.instance()._filter._levelFilterUI._toggleTypeFilter("error"); + WebInspector.ConsoleView.instance()._filter._levelFilterUI._toggleTypeFilter("debug", true); dumpVisibleMessages(); next(); }, function onlyAbcMessagePlain(next) { - WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter(WebInspector.NamedBitSetFilterUI.ALL_TYPES); - WebInspector.ConsolePanel._view()._filter._textFilterUI.setValue("abc"); + WebInspector.ConsoleView.instance()._filter._levelFilterUI._toggleTypeFilter(WebInspector.NamedBitSetFilterUI.ALL_TYPES); + WebInspector.ConsoleView.instance()._filter._textFilterUI.setValue("abc"); dumpVisibleMessages(); next(); }, function onlyAbcMessageRegex(next) { - WebInspector.ConsolePanel._view()._filter._textFilterUI._regexCheckBox.checked = "checked"; - WebInspector.ConsolePanel._view()._filter._textFilterUI.setValue("ab[a-z]"); + WebInspector.ConsoleView.instance()._filter._textFilterUI._regexCheckBox.checked = "checked"; + WebInspector.ConsoleView.instance()._filter._textFilterUI.setValue("ab[a-z]"); dumpVisibleMessages(); next(); }, function onlyAbcMessageRegexWarning(next) { - WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("warning", false); + WebInspector.ConsoleView.instance()._filter._levelFilterUI._toggleTypeFilter("warning", false); dumpVisibleMessages(); next(); } diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-filter-test.html b/third_party/WebKit/LayoutTests/inspector/console/console-filter-test.html index 2ad3aad..041ded6 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-filter-test.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-filter-test.html @@ -43,11 +43,11 @@ function onload() function test() { - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; function dumpVisibleMessages() { - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messages.length; ++i) { var viewMessage = messages[i]; var delimeter = viewMessage.consoleMessage().isGroupStartMessage() ? ">" : ""; @@ -70,43 +70,43 @@ function test() }, function addURL1Filter(next) { - WebInspector.ConsolePanel._view()._filter.addMessageURLFilter(url1); + WebInspector.ConsoleView.instance()._filter.addMessageURLFilter(url1); dumpVisibleMessages(); next(); }, function addURL2Filter(next) { - WebInspector.ConsolePanel._view()._filter.addMessageURLFilter(url2); + WebInspector.ConsoleView.instance()._filter.addMessageURLFilter(url2); dumpVisibleMessages(); next(); }, function removeURL1Filter(next) { - WebInspector.ConsolePanel._view()._filter.removeMessageURLFilter(url1); + WebInspector.ConsoleView.instance()._filter.removeMessageURLFilter(url1); dumpVisibleMessages(); next(); }, function restoreURL1Filter(next) { - WebInspector.ConsolePanel._view()._filter.addMessageURLFilter(url1); + WebInspector.ConsoleView.instance()._filter.addMessageURLFilter(url1); dumpVisibleMessages(); next(); }, function removeAllFilters(next) { - WebInspector.ConsolePanel._view()._filter.removeMessageURLFilter(); + WebInspector.ConsoleView.instance()._filter.removeMessageURLFilter(); dumpVisibleMessages(); next(); }, function checkTextFilter(next) { - WebInspector.ConsolePanel._view()._filter._textFilterUI.setValue("outer"); + WebInspector.ConsoleView.instance()._filter._textFilterUI.setValue("outer"); dumpVisibleMessages(); next(); }, function checkResetFilter(next) { - WebInspector.ConsolePanel._view()._filter.reset(); + WebInspector.ConsoleView.instance()._filter.reset(); dumpVisibleMessages(); next(); } diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-format-broken-unicode.html b/third_party/WebKit/LayoutTests/inspector/console/console-format-broken-unicode.html index c14cbae..df00955 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-format-broken-unicode.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-format-broken-unicode.html @@ -46,7 +46,7 @@ function test() InspectorTest.disableConsoleViewport(); var count = 0; - var viewMessages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < viewMessages.length; ++i) { var node = viewMessages[i].contentElement(); var currentNode = node; diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-linkify-message-location.html b/third_party/WebKit/LayoutTests/inspector/console/console-linkify-message-location.html index 8c8be39..2aa0268 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-linkify-message-location.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-linkify-message-location.html @@ -55,7 +55,7 @@ function test() function dumpConsoleMessageURLs() { - var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var messages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < messages.length; ++i) { var element = messages[i].toMessageElement(); var anchor = element.querySelector(".console-message-url"); diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-log-linkify-links.html b/third_party/WebKit/LayoutTests/inspector/console/console-log-linkify-links.html index 3570d1f..4cce568 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-log-linkify-links.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-log-linkify-links.html @@ -15,7 +15,7 @@ function test() InspectorTest.dumpConsoleMessages(false, true); InspectorTest.addResult("Dump urls in messages"); - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); var viewMessages = consoleView._visibleViewMessages; for (var i = 0; i < viewMessages.length; ++i) { var uiMessage = viewMessages[i]; diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-search-reveals-messages.html b/third_party/WebKit/LayoutTests/inspector/console/console-search-reveals-messages.html index 7df93ec3..8dd8ebd 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-search-reveals-messages.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-search-reveals-messages.html @@ -13,7 +13,7 @@ function populateConsoleWithMessages() function test() { - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); var viewport = consoleView._viewport; const maximumViewportMessagesCount = 150; InspectorTest.runTestSuite([ diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-search.html b/third_party/WebKit/LayoutTests/inspector/console/console-search.html index dd4c3f7..afbd673 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-search.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-search.html @@ -50,7 +50,7 @@ function test() addResult(""); } - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); var viewport = consoleView._viewport; const maximumViewportMessagesCount = 150; InspectorTest.runTestSuite([ diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-stack-overflow.html b/third_party/WebKit/LayoutTests/inspector/console/console-stack-overflow.html index 6a16acd..987fbf9 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-stack-overflow.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-stack-overflow.html @@ -19,7 +19,7 @@ function test() function step2() { - if (WebInspector.ConsolePanel._view()._visibleViewMessages.length < 1) + if (WebInspector.ConsoleView.instance()._visibleViewMessages.length < 1) InspectorTest.addConsoleSniffer(step2); else step3(); diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-uncaught-exception-in-eval.html b/third_party/WebKit/LayoutTests/inspector/console/console-uncaught-exception-in-eval.html index a17cb17..6f45632 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-uncaught-exception-in-eval.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-uncaught-exception-in-eval.html @@ -42,7 +42,7 @@ function test() function step3() { - if (WebInspector.ConsolePanel._view()._visibleViewMessages.length < 2) + if (WebInspector.ConsoleView.instance()._visibleViewMessages.length < 2) InspectorTest.addConsoleSniffer(step3); else step4(); diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-viewport-selection.html b/third_party/WebKit/LayoutTests/inspector/console/console-viewport-selection.html index 1eedad3..3a11b68 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-viewport-selection.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-viewport-selection.html @@ -16,7 +16,7 @@ function populateConsoleWithMessages(count) function test() { InspectorTest.fixConsoleViewportDimensions(600, 200); - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); var viewport = consoleView._viewport; const minimumViewportMessagesCount = 10; const messagesCount = 150; diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html b/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html index 42899ad..1d62c5a 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html @@ -18,7 +18,7 @@ function populateConsoleWithMessages(count) function test() { InspectorTest.fixConsoleViewportDimensions(600, 200); - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); var viewport = consoleView._viewport; const minimumViewportMessagesCount = 10; const messagesCount = 150; diff --git a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel.html b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel.html index 59e61af..418b7dd 100644 --- a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel.html +++ b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel.html @@ -74,7 +74,7 @@ function initialize_extensionsPanelTest() function clickOnMessage() { - var xpathResult = document.evaluate("//a[starts-with(., 'extensions-panel.html')]", WebInspector.ConsolePanel._view()._viewport.element, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null); + var xpathResult = document.evaluate("//a[starts-with(., 'extensions-panel.html')]", WebInspector.ConsoleView.instance()._viewport.element, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null); var click = document.createEvent("MouseEvent"); click.initMouseEvent("click", true, true); diff --git a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-reload.html b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-reload.html index 93ff4fb..d2679a5 100644 --- a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-reload.html +++ b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-reload.html @@ -38,7 +38,7 @@ function initialize_testReloadInjectsCodeWithMessage() { InspectorTest.lastMessageScriptId = function(callback) { - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); if (consoleView._needsFullUpdate) consoleView._updateMessageList(); var viewMessages = consoleView._visibleViewMessages; diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/show-function-definition.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/show-function-definition.html index c67bb3c..2c6c591 100644 --- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/show-function-definition.html +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/show-function-definition.html @@ -47,7 +47,7 @@ function test() InspectorTest.runAfterPendingDispatches(function() { var messages = []; InspectorTest.disableConsoleViewport(); - var viewMessages = WebInspector.ConsolePanel._view()._visibleViewMessages; + var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessages; for (var i = 0; i < viewMessages.length; ++i) { var uiMessage = viewMessages[i]; var element = uiMessage.contentElement(); diff --git a/third_party/WebKit/Source/devtools/front_end/Tests.js b/third_party/WebKit/Source/devtools/front_end/Tests.js index 81e0557..af9d033 100644 --- a/third_party/WebKit/Source/devtools/front_end/Tests.js +++ b/third_party/WebKit/Source/devtools/front_end/Tests.js @@ -978,7 +978,7 @@ TestSuite.prototype.evaluateInConsole_ = function(code, callback) function innerEvaluate() { WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionContext, showConsoleAndEvaluate, this); - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); consoleView._prompt.setText(code); consoleView._promptElement.dispatchEvent(TestSuite.createKeyEvent("Enter")); diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsolePanel.js b/third_party/WebKit/Source/devtools/front_end/console/ConsolePanel.js index fae8e44..47a5027 100644 --- a/third_party/WebKit/Source/devtools/front_end/console/ConsolePanel.js +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsolePanel.js @@ -33,18 +33,7 @@ WebInspector.ConsolePanel = function() { WebInspector.Panel.call(this, "console"); - this._view = WebInspector.ConsolePanel._view(); -} - -/** - * @return {!WebInspector.ConsoleView} - */ -WebInspector.ConsolePanel._view = function() -{ - if (!WebInspector.ConsolePanel._consoleView) - WebInspector.ConsolePanel._consoleView = new WebInspector.ConsoleView(); - - return WebInspector.ConsolePanel._consoleView; + this._view = WebInspector.ConsoleView.instance(); } WebInspector.ConsolePanel.prototype = { @@ -86,7 +75,7 @@ WebInspector.ConsolePanel.prototype = { */ searchableView: function() { - return WebInspector.ConsolePanel._view().searchableView(); + return WebInspector.ConsoleView.instance().searchableView(); }, __proto__: WebInspector.Panel.prototype @@ -103,7 +92,7 @@ WebInspector.ConsolePanel.WrapperView = function() WebInspector.ConsolePanel.WrapperView._instance = this; - this._view = WebInspector.ConsolePanel._view(); + this._view = WebInspector.ConsoleView.instance(); } WebInspector.ConsolePanel.WrapperView.prototype = { @@ -158,7 +147,7 @@ WebInspector.ConsolePanel.ConsoleRevealer.prototype = { */ reveal: function(object) { - var consoleView = WebInspector.ConsolePanel._view(); + var consoleView = WebInspector.ConsoleView.instance(); if (consoleView.isShowing()) { consoleView.focus(); return Promise.resolve(); diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js index da86d91..8513478 100644 --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js @@ -164,6 +164,12 @@ WebInspector.ConsoleView.prototype = { return this._searchableView; }, + _clearHistory: function() + { + this._consoleHistorySetting.set([]); + this._prompt.setHistoryData([]); + }, + /** * @param {!WebInspector.Event} event */ @@ -578,6 +584,7 @@ WebInspector.ConsoleView.prototype = { contextMenu.appendSeparator(); contextMenu.appendAction("console.clear"); + contextMenu.appendAction("console.clear.history"); contextMenu.appendItem(WebInspector.UIString("Save as..."), this._saveConsole.bind(this)); var request = consoleMessage ? consoleMessage.request : null; @@ -1275,6 +1282,16 @@ WebInspector.ConsoleGroup.prototype = { } /** + * @return {!WebInspector.ConsoleView} + */ +WebInspector.ConsoleView.instance = function() +{ + if (!WebInspector.ConsoleView._instance) + WebInspector.ConsoleView._instance = new WebInspector.ConsoleView(); + return WebInspector.ConsoleView._instance; +} + +/** * @constructor * @implements {WebInspector.ActionDelegate} */ @@ -1298,6 +1315,9 @@ WebInspector.ConsoleView.ActionDelegate.prototype = { case "console.clear": WebInspector.ConsoleModel.clearConsole(); return true; + case "console.clear.history": + WebInspector.ConsoleView.instance()._clearHistory(); + return true; } return false; } diff --git a/third_party/WebKit/Source/devtools/front_end/console/module.json b/third_party/WebKit/Source/devtools/front_end/console/module.json index 181d9e0..2cdde58 100644 --- a/third_party/WebKit/Source/devtools/front_end/console/module.json +++ b/third_party/WebKit/Source/devtools/front_end/console/module.json @@ -49,6 +49,13 @@ ] }, { + "type": "@WebInspector.ActionDelegate", + "category": "Console", + "actionId": "console.clear.history", + "title": "Clear console history", + "className": "WebInspector.ConsoleView.ActionDelegate" + }, + { "type": "setting", "category": "Console", "title": "Hide network messages", diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/TextEditorAutocompleteController.js b/third_party/WebKit/Source/devtools/front_end/source_frame/TextEditorAutocompleteController.js index fc75538..3c96b05 100644 --- a/third_party/WebKit/Source/devtools/front_end/source_frame/TextEditorAutocompleteController.js +++ b/third_party/WebKit/Source/devtools/front_end/source_frame/TextEditorAutocompleteController.js @@ -138,7 +138,7 @@ WebInspector.TextEditorAutocompleteController.prototype = { this._prefixRange = prefixRange; if (!oldPrefixRange || prefixRange.startLine !== oldPrefixRange.startLine || prefixRange.startColumn !== oldPrefixRange.startColumn) this._updateAnchorBox(); - this._suggestBox.updateSuggestions(this._anchorBox, wordsWithPrefix, 0, true, this._textEditor.copyRange(prefixRange)); + this._suggestBox.updateSuggestions(this._anchorBox, wordsWithPrefix.map(item => ({title: item})), 0, true, this._textEditor.copyRange(prefixRange)); if (!this._suggestBox.visible()) this.finishAutocomplete(); this._onSuggestionsShownForTest(wordsWithPrefix); diff --git a/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js b/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js index 281deb6..455cc11 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js @@ -348,7 +348,7 @@ WebInspector.TextFilterUI.prototype = { else this._suggestionBuilder.applySuggestion(this._filterInputElement, suggestions[0], true); var anchorBox = this._filterInputElement.boxInWindow().relativeTo(new AnchorBox(-3, 0)); - this._suggestBox.updateSuggestions(anchorBox, suggestions, 0, true, ""); + this._suggestBox.updateSuggestions(anchorBox, suggestions.map(item => ({title: item})), 0, true, ""); } else { this._suggestBox.hide(); } diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js index f1cb273..188772d 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js @@ -71,6 +71,11 @@ WebInspector.SuggestBox = function(suggestBoxDelegate, maxItemsHeight) this._asyncDetailsPromises = new Map(); } +/** + * @typedef Array.<{title: string, className: (string|undefined)}> + */ +WebInspector.SuggestBox.Suggestions; + WebInspector.SuggestBox.prototype = { /** * @return {boolean} @@ -240,11 +245,12 @@ WebInspector.SuggestBox.prototype = { /** * @param {string} prefix * @param {string} text + * @param {string|undefined} className * @param {number} index */ - _createItemElement: function(prefix, text, index) + _createItemElement: function(prefix, text, className, index) { - var element = createElementWithClass("div", "suggest-box-content-item source-code"); + var element = createElementWithClass("div", "suggest-box-content-item source-code " + (className || "")); element.tabIndex = -1; if (prefix && prefix.length && !text.indexOf(prefix)) { element.createChild("span", "prefix").textContent = prefix; @@ -259,7 +265,7 @@ WebInspector.SuggestBox.prototype = { }, /** - * @param {!Array.<string>} items + * @param {!WebInspector.SuggestBox.Suggestions} items * @param {string} userEnteredText * @param {function(number): !Promise<{detail:string, description:string}>=} asyncDetails */ @@ -273,7 +279,7 @@ WebInspector.SuggestBox.prototype = { for (var i = 0; i < items.length; ++i) { var item = items[i]; - var currentItemElement = this._createItemElement(userEnteredText, item, i); + var currentItemElement = this._createItemElement(userEnteredText, item.title, item.className, i); this._element.appendChild(currentItemElement); } }, @@ -338,7 +344,7 @@ WebInspector.SuggestBox.prototype = { }, /** - * @param {!Array.<string>} completions + * @param {!WebInspector.SuggestBox.Suggestions} completions * @param {boolean} canShowForSingleItem * @param {string} userEnteredText */ @@ -351,7 +357,7 @@ WebInspector.SuggestBox.prototype = { return true; // Do not show a single suggestion if it is the same as user-entered prefix, even if allowed to show single-item suggest boxes. - return canShowForSingleItem && completions[0] !== userEnteredText; + return canShowForSingleItem && completions[0].title !== userEnteredText; }, _ensureRowCountPerViewport: function() @@ -366,7 +372,7 @@ WebInspector.SuggestBox.prototype = { /** * @param {!AnchorBox} anchorBox - * @param {!Array.<string>} completions + * @param {!WebInspector.SuggestBox.Suggestions} completions * @param {number} selectedIndex * @param {boolean} canShowForSingleItem * @param {string} userEnteredText diff --git a/third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js b/third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js index 84e2a53..79952d3 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js @@ -471,7 +471,7 @@ WebInspector.TextPrompt.prototype = { /** * @param {string} prefix - * @return {!Array.<string>} + * @return {!WebInspector.SuggestBox.Suggestions} */ additionalCompletions: function(prefix) { @@ -489,18 +489,20 @@ WebInspector.TextPrompt.prototype = { _completionsReady: function(selection, originalWordPrefixRange, reverse, force, completions, selectedIndex) { var prefix = originalWordPrefixRange.toString(); - if (prefix || force) { - if (prefix) - completions = completions.concat(this.additionalCompletions(prefix)); - else - completions = this.additionalCompletions(prefix).concat(completions); - } // Filter out dupes. var store = new Set(); completions = completions.filter(item => !store.has(item) && !!store.add(item)); + var annotatedCompletions = completions.map(item => ({title: item})); + + if (prefix || force) { + if (prefix) + annotatedCompletions = annotatedCompletions.concat(this.additionalCompletions(prefix)); + else + annotatedCompletions = this.additionalCompletions(prefix).concat(annotatedCompletions); + } - if (!this._waitingForCompletions || !completions.length) { + if (!this._waitingForCompletions || !annotatedCompletions.length) { this.hideSuggestBox(); return; } @@ -522,7 +524,7 @@ WebInspector.TextPrompt.prototype = { this._userEnteredText = fullWordRange.toString(); if (this._suggestBox) - this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection, fullWordRange), completions, selectedIndex, !this.isCaretAtEndOfPrompt(), this._userEnteredText); + this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection, fullWordRange), annotatedCompletions, selectedIndex, !this.isCaretAtEndOfPrompt(), this._userEnteredText); if (selectedIndex === -1) return; @@ -531,7 +533,7 @@ WebInspector.TextPrompt.prototype = { this._commonPrefix = this._buildCommonPrefix(completions, wordPrefixLength); if (this.isCaretAtEndOfPrompt()) { - var completionText = completions[selectedIndex]; + var completionText = annotatedCompletions[selectedIndex].title; var prefixText = this._userEnteredRange.toString(); var suffixText = completionText.substring(wordPrefixLength); this._userEnteredRange.deleteContents(); @@ -827,7 +829,7 @@ WebInspector.TextPromptWithHistory.prototype = { /** * @override * @param {string} prefix - * @return {!Array.<string>} + * @return {!WebInspector.SuggestBox.Suggestions} */ additionalCompletions: function(prefix) { @@ -835,11 +837,15 @@ WebInspector.TextPromptWithHistory.prototype = { return []; var result = []; var text = this.text(); + var set = new Set(); for (var i = this._data.length - 1; i >= 0 && result.length < 50; --i) { var item = this._data[i]; if (!item.startsWith(text)) continue; - result.push(item.substring(text.length - prefix.length)); + if (set.has(item)) + continue; + set.add(item); + result.push({title: item.substring(text.length - prefix.length), className: "additional"}); } return result; }, diff --git a/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css b/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css index 4752503..e33ff52 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css +++ b/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css @@ -91,6 +91,30 @@ white-space: nowrap; } +.suggest-box .suggest-box-content-item.additional { + background-color: #f9f9f9; +} + +.suggest-box .suggest-box-content-item.additional::before { + display: inline-block; + content: ""; + -webkit-user-select: none; + background-image: url(Images/toolbarButtonGlyphs.png); + background-size: 352px 168px; + width: 10px; + height: 10px; + position: relative; + top: 2px; + margin-right: 4px; + background-position: -192px -96px; +} + +@media (-webkit-min-device-pixel-ratio: 1.5) { +.suggest-box .suggest-box-content-item.additional::before { + background-image: url(Images/toolbarButtonGlyphs_2x.png); +} +} /* media */ + .suggest-box .suggest-box-content-item .prefix { font-weight: bold; } |
