| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 WebInspector.ConsoleView.prototype = { | 158 WebInspector.ConsoleView.prototype = { |
| 159 /** | 159 /** |
| 160 * @return {!WebInspector.SearchableView} | 160 * @return {!WebInspector.SearchableView} |
| 161 */ | 161 */ |
| 162 searchableView: function() | 162 searchableView: function() |
| 163 { | 163 { |
| 164 return this._searchableView; | 164 return this._searchableView; |
| 165 }, | 165 }, |
| 166 | 166 |
| 167 _clearHistory: function() |
| 168 { |
| 169 this._consoleHistorySetting.set([]); |
| 170 this._prompt.setHistoryData([]); |
| 171 }, |
| 172 |
| 167 /** | 173 /** |
| 168 * @param {!WebInspector.Event} event | 174 * @param {!WebInspector.Event} event |
| 169 */ | 175 */ |
| 170 _onMainFrameNavigated: function(event) | 176 _onMainFrameNavigated: function(event) |
| 171 { | 177 { |
| 172 var frame = /** @type {!WebInspector.ResourceTreeFrame} */(event.data); | 178 var frame = /** @type {!WebInspector.ResourceTreeFrame} */(event.data); |
| 173 WebInspector.console.log(WebInspector.UIString("Navigated to %s", frame.
url)); | 179 WebInspector.console.log(WebInspector.UIString("Navigated to %s", frame.
url)); |
| 174 }, | 180 }, |
| 175 | 181 |
| 176 _initConsoleMessages: function() | 182 _initConsoleMessages: function() |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 for (var url in this._filter.messageURLFilters) { | 577 for (var url in this._filter.messageURLFilters) { |
| 572 filterSubMenu.appendCheckboxItem(String.sprintf("%s (%d)", new WebIn
spector.ParsedURL(url).displayName, this._urlToMessageCount[url]), this._filter.
removeMessageURLFilter.bind(this._filter, url), true); | 578 filterSubMenu.appendCheckboxItem(String.sprintf("%s (%d)", new WebIn
spector.ParsedURL(url).displayName, this._urlToMessageCount[url]), this._filter.
removeMessageURLFilter.bind(this._filter, url), true); |
| 573 hasFilters = true; | 579 hasFilters = true; |
| 574 } | 580 } |
| 575 | 581 |
| 576 filterSubMenu.setEnabled(hasFilters || (consoleMessage && consoleMessage
.url)); | 582 filterSubMenu.setEnabled(hasFilters || (consoleMessage && consoleMessage
.url)); |
| 577 unhideAll.setEnabled(hasFilters); | 583 unhideAll.setEnabled(hasFilters); |
| 578 | 584 |
| 579 contextMenu.appendSeparator(); | 585 contextMenu.appendSeparator(); |
| 580 contextMenu.appendAction("console.clear"); | 586 contextMenu.appendAction("console.clear"); |
| 587 contextMenu.appendAction("console.clear.history"); |
| 581 contextMenu.appendItem(WebInspector.UIString("Save as..."), this._saveCo
nsole.bind(this)); | 588 contextMenu.appendItem(WebInspector.UIString("Save as..."), this._saveCo
nsole.bind(this)); |
| 582 | 589 |
| 583 var request = consoleMessage ? consoleMessage.request : null; | 590 var request = consoleMessage ? consoleMessage.request : null; |
| 584 if (request && request.resourceType() === WebInspector.resourceTypes.XHR
) { | 591 if (request && request.resourceType() === WebInspector.resourceTypes.XHR
) { |
| 585 contextMenu.appendSeparator(); | 592 contextMenu.appendSeparator(); |
| 586 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), request.
replayXHR.bind(request)); | 593 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), request.
replayXHR.bind(request)); |
| 587 } | 594 } |
| 588 | 595 |
| 589 contextMenu.show(); | 596 contextMenu.show(); |
| 590 }, | 597 }, |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 /** | 1275 /** |
| 1269 * @return {?WebInspector.ConsoleGroup} | 1276 * @return {?WebInspector.ConsoleGroup} |
| 1270 */ | 1277 */ |
| 1271 parentGroup: function() | 1278 parentGroup: function() |
| 1272 { | 1279 { |
| 1273 return this._parentGroup || this; | 1280 return this._parentGroup || this; |
| 1274 }, | 1281 }, |
| 1275 } | 1282 } |
| 1276 | 1283 |
| 1277 /** | 1284 /** |
| 1285 * @return {!WebInspector.ConsoleView} |
| 1286 */ |
| 1287 WebInspector.ConsoleView.instance = function() |
| 1288 { |
| 1289 if (!WebInspector.ConsoleView._instance) |
| 1290 WebInspector.ConsoleView._instance = new WebInspector.ConsoleView(); |
| 1291 return WebInspector.ConsoleView._instance; |
| 1292 } |
| 1293 |
| 1294 /** |
| 1278 * @constructor | 1295 * @constructor |
| 1279 * @implements {WebInspector.ActionDelegate} | 1296 * @implements {WebInspector.ActionDelegate} |
| 1280 */ | 1297 */ |
| 1281 WebInspector.ConsoleView.ActionDelegate = function() | 1298 WebInspector.ConsoleView.ActionDelegate = function() |
| 1282 { | 1299 { |
| 1283 } | 1300 } |
| 1284 | 1301 |
| 1285 WebInspector.ConsoleView.ActionDelegate.prototype = { | 1302 WebInspector.ConsoleView.ActionDelegate.prototype = { |
| 1286 /** | 1303 /** |
| 1287 * @override | 1304 * @override |
| 1288 * @param {!WebInspector.Context} context | 1305 * @param {!WebInspector.Context} context |
| 1289 * @param {string} actionId | 1306 * @param {string} actionId |
| 1290 * @return {boolean} | 1307 * @return {boolean} |
| 1291 */ | 1308 */ |
| 1292 handleAction: function(context, actionId) | 1309 handleAction: function(context, actionId) |
| 1293 { | 1310 { |
| 1294 switch (actionId) { | 1311 switch (actionId) { |
| 1295 case "console.show": | 1312 case "console.show": |
| 1296 WebInspector.console.show(); | 1313 WebInspector.console.show(); |
| 1297 return true; | 1314 return true; |
| 1298 case "console.clear": | 1315 case "console.clear": |
| 1299 WebInspector.ConsoleModel.clearConsole(); | 1316 WebInspector.ConsoleModel.clearConsole(); |
| 1300 return true; | 1317 return true; |
| 1318 case "console.clear.history": |
| 1319 WebInspector.ConsoleView.instance()._clearHistory(); |
| 1320 return true; |
| 1301 } | 1321 } |
| 1302 return false; | 1322 return false; |
| 1303 } | 1323 } |
| 1304 } | 1324 } |
| 1305 | 1325 |
| 1306 /** | 1326 /** |
| 1307 * @typedef {{messageIndex: number, matchIndex: number}} | 1327 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1308 */ | 1328 */ |
| 1309 WebInspector.ConsoleView.RegexMatchRange; | 1329 WebInspector.ConsoleView.RegexMatchRange; |
| OLD | NEW |