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 /third_party/WebKit/Source/devtools/front_end/console | |
| 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}
Diffstat (limited to 'third_party/WebKit/Source/devtools/front_end/console')
3 files changed, 31 insertions, 15 deletions
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", |
