| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 { | 782 { |
| 783 return WebInspector.targetManager.inspectedPageURL(); | 783 return WebInspector.targetManager.inspectedPageURL(); |
| 784 }); | 784 }); |
| 785 | 785 |
| 786 /** | 786 /** |
| 787 * @constructor | 787 * @constructor |
| 788 * @implements {WebInspector.ToolbarItem.Provider} | 788 * @implements {WebInspector.ToolbarItem.Provider} |
| 789 */ | 789 */ |
| 790 WebInspector.Main.WarningErrorCounter = function() | 790 WebInspector.Main.WarningErrorCounter = function() |
| 791 { | 791 { |
| 792 this._counter = new WebInspector.ToolbarCounter(["error-icon", "revokedError
-icon", "warning-icon"]); | 792 this._counter = new WebInspector.ToolbarCounter(["error-icon", "warning-icon
"]); |
| 793 WebInspector.Main.WarningErrorCounter._instanceForTest = this._counter; | |
| 794 this._counter.addEventListener("click", showConsole); | 793 this._counter.addEventListener("click", showConsole); |
| 795 | 794 |
| 796 function showConsole() | 795 function showConsole() |
| 797 { | 796 { |
| 798 WebInspector.console.show(); | 797 WebInspector.console.show(); |
| 799 } | 798 } |
| 800 | 799 |
| 801 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); | 800 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); |
| 802 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); | 801 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); |
| 803 } | 802 } |
| 804 | 803 |
| 805 WebInspector.Main.WarningErrorCounter.prototype = { | 804 WebInspector.Main.WarningErrorCounter.prototype = { |
| 806 _updateErrorAndWarningCounts: function() | 805 _updateErrorAndWarningCounts: function() |
| 807 { | 806 { |
| 808 var errors = 0; | 807 var errors = 0; |
| 809 var revokedErrors = 0; | |
| 810 var warnings = 0; | 808 var warnings = 0; |
| 811 var targets = WebInspector.targetManager.targets(); | 809 var targets = WebInspector.targetManager.targets(); |
| 812 for (var i = 0; i < targets.length; ++i) { | 810 for (var i = 0; i < targets.length; ++i) { |
| 813 errors += targets[i].consoleModel.errors(); | 811 errors = errors + targets[i].consoleModel.errors; |
| 814 revokedErrors += targets[i].consoleModel.revokedErrors(); | 812 warnings = warnings + targets[i].consoleModel.warnings; |
| 815 warnings += targets[i].consoleModel.warnings(); | |
| 816 } | 813 } |
| 817 this._counter.setCounter("error-icon", errors, WebInspector.UIString(err
ors === 1 ? "%d errors" : "%d error", errors)); | 814 this._counter.setCounter("error-icon", errors, WebInspector.UIString(err
ors > 1 ? "%d errors" : "%d error", errors)); |
| 818 this._counter.setCounter("revokedError-icon", revokedErrors, WebInspecto
r.UIString(revokedErrors === 1 ? "%d handled promise rejections" : "%d handled p
romise rejection", revokedErrors)); | 815 this._counter.setCounter("warning-icon", warnings, WebInspector.UIString
(warnings > 1 ? "%d warnings" : "%d warning", warnings)); |
| 819 this._counter.setCounter("warning-icon", warnings, WebInspector.UIString
(warnings === 1 ? "%d warnings" : "%d warning", warnings)); | |
| 820 WebInspector.inspectorView.toolbarItemResized(); | 816 WebInspector.inspectorView.toolbarItemResized(); |
| 821 }, | 817 }, |
| 822 | 818 |
| 823 /** | 819 /** |
| 824 * @override | 820 * @override |
| 825 * @return {?WebInspector.ToolbarItem} | 821 * @return {?WebInspector.ToolbarItem} |
| 826 */ | 822 */ |
| 827 item: function() | 823 item: function() |
| 828 { | 824 { |
| 829 return this._counter; | 825 return this._counter; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 p.classList.add("help-section"); | 897 p.classList.add("help-section"); |
| 902 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); | 898 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); |
| 903 } | 899 } |
| 904 | 900 |
| 905 WebInspector.WorkerTerminatedScreen.prototype = { | 901 WebInspector.WorkerTerminatedScreen.prototype = { |
| 906 | 902 |
| 907 __proto__: WebInspector.HelpScreen.prototype | 903 __proto__: WebInspector.HelpScreen.prototype |
| 908 } | 904 } |
| 909 | 905 |
| 910 new WebInspector.Main(); | 906 new WebInspector.Main(); |
| OLD | NEW |