Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js

Issue 2897033005: DevTools: introduce setting to filter only user messages from console API (Closed)
Patch Set: ac Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
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 cc55d6f20c8e07f9b8e0290af3b478deab959c1e..7d9b296be8e05d55c50c9277404f4e7d4e5379e6 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -84,6 +84,13 @@ Console.ConsoleView = class extends UI.VBox {
this._hideNetworkMessagesCheckbox = new UI.ToolbarSettingCheckbox(
this._filter._hideNetworkMessagesSetting, this._filter._hideNetworkMessagesSetting.title(),
Common.UIString('Hide network'));
+ var filterByExecutionContextCheckbox = new UI.ToolbarSettingCheckbox(
+ this._filter._filterByExecutionContextSetting,
+ Common.UIString('Only show messages from the current context (top, iframe, worker, extension)'),
+ Common.UIString('Selected context only'));
+ var filterConsoleAPICheckbox = new UI.ToolbarSettingCheckbox(
+ Common.moduleSetting('consoleAPIFilterEnabled'), Common.UIString('Only show messages from console API methods'),
+ Common.UIString('User messages only'));
var monitoringXHREnabledSetting = Common.moduleSetting('monitoringXHREnabled');
this._timestampsSetting = Common.moduleSetting('consoleTimestampsEnabled');
this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHistoryAutocomplete');
@@ -96,7 +103,8 @@ Console.ConsoleView = class extends UI.VBox {
settingsToolbarLeft.makeVertical();
settingsToolbarLeft.appendToolbarItem(this._hideNetworkMessagesCheckbox);
settingsToolbarLeft.appendToolbarItem(this._preserveLogCheckbox);
- settingsToolbarLeft.appendToolbarItem(this._filter._filterByExecutionContextCheckbox);
+ settingsToolbarLeft.appendToolbarItem(filterByExecutionContextCheckbox);
+ settingsToolbarLeft.appendToolbarItem(filterConsoleAPICheckbox);
var settingsToolbarRight = new UI.Toolbar('', settingsPane.element);
settingsToolbarRight.makeVertical();
@@ -284,7 +292,7 @@ Console.ConsoleView = class extends UI.VBox {
_executionContextChanged() {
this._prompt.clearAutocomplete();
- if (this._filter._filterByExecutionContextCheckbox.checked())
+ if (this._filter._filterByExecutionContextSetting.get())
this._updateMessageList();
}
@@ -996,20 +1004,20 @@ Console.ConsoleViewFilter = class {
* @param {function()} filterChangedCallback
*/
constructor(filterChangedCallback) {
- this._filterByExecutionContextCheckbox = new UI.ToolbarCheckbox(
- Common.UIString('Selected context only'),
- Common.UIString('Only show messages from the current context (top, iframe, worker, extension)'),
- filterChangedCallback);
this._filterChanged = filterChangedCallback;
this._messageURLFiltersSetting = Common.settings.createSetting('messageURLFilters', {});
this._messageLevelFiltersSetting =
Common.settings.createSetting('messageLevelFilters2', ConsoleModel.ConsoleMessage.MessageLevel.Info);
this._hideNetworkMessagesSetting = Common.moduleSetting('hideNetworkMessages');
+ this._filterByExecutionContextSetting = Common.moduleSetting('selectedContextFilterEnabled');
+ this._filterByConsoleAPISetting = Common.moduleSetting('consoleAPIFilterEnabled');
this._messageURLFiltersSetting.addChangeListener(this._filterChanged);
this._messageLevelFiltersSetting.addChangeListener(this._filterChanged);
this._hideNetworkMessagesSetting.addChangeListener(this._filterChanged);
+ this._filterByExecutionContextSetting.addChangeListener(this._filterChanged);
+ this._filterByConsoleAPISetting.addChangeListener(this._filterChanged);
this._textFilterUI = new UI.ToolbarInput(Common.UIString('Filter'), 0.2, 1, true);
this._textFilterUI.addEventListener(UI.ToolbarInput.Event.TextChanged, this._textFilterChanged, this);
@@ -1075,7 +1083,7 @@ Console.ConsoleViewFilter = class {
var message = viewMessage.consoleMessage();
var executionContext = UI.context.flavor(SDK.ExecutionContext);
- if (this._filterByExecutionContextCheckbox.checked() && executionContext) {
+ if (this._filterByExecutionContextSetting.get() && executionContext) {
if (message.runtimeModel() !== executionContext.runtimeModel)
return false;
if (message.executionContextId && message.executionContextId !== executionContext.id)
@@ -1109,13 +1117,18 @@ Console.ConsoleViewFilter = class {
return false;
}
+ if (this._filterByConsoleAPISetting.get() &&
+ message.source !== ConsoleModel.ConsoleMessage.MessageSource.ConsoleAPI)
+ return false;
+
return true;
}
reset() {
this._messageURLFiltersSetting.set({});
this._messageLevelFiltersSetting.set(ConsoleModel.ConsoleMessage.MessageLevel.Info);
- this._filterByExecutionContextCheckbox.inputElement.checked = false;
+ this._filterByExecutionContextSetting.set(false);
+ this._filterByConsoleAPISetting.set(false);
this._hideNetworkMessagesSetting.set(false);
this._textFilterUI.setValue('');
this._textFilterChanged();

Powered by Google App Engine
This is Rietveld 408576698