Skip to content

Commit

Permalink
[DevTools] Remove Console.messagesCleared event.
Browse files Browse the repository at this point in the history
This event doesn't make sense. Frontend can clear console messages log
on navigation if it wants to.

BUG=613882

Review-Url: https://codereview.chromium.org/2146163002
Cr-Commit-Position: refs/heads/master@{#405559}
  • Loading branch information
dgozman authored and Commit bot committed Jul 14, 2016
1 parent d56fea1 commit 913b1f4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 29 deletions.
12 changes: 0 additions & 12 deletions front_end/console/ConsoleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ WebInspector.ConsoleView = function()

this._registerWithMessageSink();
WebInspector.targetManager.observeTargets(this);
WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.MainFrameNavigated, this._onMainFrameNavigated, this);

this._initConsoleMessages();

Expand Down Expand Up @@ -179,17 +178,6 @@ WebInspector.ConsoleView.prototype = {
this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSetting.get());
},

/**
* @param {!WebInspector.Event} event
*/
_onMainFrameNavigated: function(event)
{
if (!WebInspector.moduleSetting("preserveConsoleLog").get())
return;
var frame = /** @type {!WebInspector.ResourceTreeFrame} */(event.data);
WebInspector.console.log(WebInspector.UIString("Navigated to %s", frame.url));
},

_initConsoleMessages: function()
{
var mainTarget = WebInspector.targetManager.mainTarget();
Expand Down
12 changes: 0 additions & 12 deletions front_end/console/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@
"settingType": "boolean",
"defaultValue": false
},
{
"type": "setting",
"category": "Console",
"title": "Preserve log upon navigation",
"settingName": "preserveConsoleLog",
"settingType": "boolean",
"defaultValue": false,
"options": [
{ "value": true, "title": "Preserve log upon navigation" },
{ "value": false, "title": "Do not preserve log upon navigation" }
]
},
{
"type": "setting",
"category": "Console",
Expand Down
9 changes: 5 additions & 4 deletions front_end/sdk/ConsoleModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ WebInspector.ConsoleModel.prototype = {
if (msg.source === WebInspector.ConsoleMessage.MessageSource.Worker && msg.target().workerManager && msg.target().workerManager.targetByWorkerId(msg.workerId))
return;

if (msg.source === WebInspector.ConsoleMessage.MessageSource.ConsoleAPI && msg.type === WebInspector.ConsoleMessage.MessageType.Clear)
this.clear();

if (msg.level === WebInspector.ConsoleMessage.MessageLevel.RevokedError && msg._revokedExceptionId) {
var exceptionMessage = this._messageByExceptionId.get(msg._revokedExceptionId);
if (!exceptionMessage)
Expand Down Expand Up @@ -145,10 +148,10 @@ WebInspector.ConsoleModel.prototype = {
requestClearMessages: function()
{
this._consoleAgent.clearMessages();
this._messagesCleared();
this.clear();
},

_messagesCleared: function()
clear: function()
{
this._messages = [];
this._messageByExceptionId.clear();
Expand Down Expand Up @@ -563,8 +566,6 @@ WebInspector.ConsoleDispatcher.prototype = {
*/
messagesCleared: function()
{
if (!WebInspector.moduleSetting("preserveConsoleLog").get())
this._console._messagesCleared();
}
}

Expand Down
7 changes: 6 additions & 1 deletion front_end/sdk/ResourceTreeModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,13 @@ WebInspector.ResourceTreeModel.prototype = {
this._inspectedPageURL = frame.url;

this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, frame);
if (frame.isMainFrame())
if (frame.isMainFrame()) {
this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, frame);
if (WebInspector.moduleSetting("preserveConsoleLog").get())
WebInspector.console.log(WebInspector.UIString("Navigated to %s", frame.url));
else
this.target().consoleModel.clear();
}
if (addedOrigin)
this._addSecurityOrigin(addedOrigin);

Expand Down
12 changes: 12 additions & 0 deletions front_end/sdk/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
"settingType": "boolean",
"defaultValue": false
},
{
"type": "setting",
"category": "Console",
"title": "Preserve log upon navigation",
"settingName": "preserveConsoleLog",
"settingType": "boolean",
"defaultValue": false,
"options": [
{ "value": true, "title": "Preserve log upon navigation" },
{ "value": false, "title": "Do not preserve log upon navigation" }
]
},
{
"type": "setting",
"category": "Debugger",
Expand Down

0 comments on commit 913b1f4

Please sign in to comment.