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", "warning-icon
"]); | 792 this._counter = new WebInspector.ToolbarCounter(["error-icon", "revokedError
-icon", "warning-icon"]); |
| 793 WebInspector.Main.WarningErrorCounter._instanceForTest = this._counter; |
793 this._counter.addEventListener("click", showConsole); | 794 this._counter.addEventListener("click", showConsole); |
794 | 795 |
795 function showConsole() | 796 function showConsole() |
796 { | 797 { |
797 WebInspector.console.show(); | 798 WebInspector.console.show(); |
798 } | 799 } |
799 | 800 |
800 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); | 801 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); |
801 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); | 802 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); |
802 } | 803 } |
803 | 804 |
804 WebInspector.Main.WarningErrorCounter.prototype = { | 805 WebInspector.Main.WarningErrorCounter.prototype = { |
805 _updateErrorAndWarningCounts: function() | 806 _updateErrorAndWarningCounts: function() |
806 { | 807 { |
807 var errors = 0; | 808 var errors = 0; |
| 809 var revokedErrors = 0; |
808 var warnings = 0; | 810 var warnings = 0; |
809 var targets = WebInspector.targetManager.targets(); | 811 var targets = WebInspector.targetManager.targets(); |
810 for (var i = 0; i < targets.length; ++i) { | 812 for (var i = 0; i < targets.length; ++i) { |
811 errors = errors + targets[i].consoleModel.errors; | 813 errors += targets[i].consoleModel.errors(); |
812 warnings = warnings + targets[i].consoleModel.warnings; | 814 revokedErrors += targets[i].consoleModel.revokedErrors(); |
| 815 warnings += targets[i].consoleModel.warnings(); |
813 } | 816 } |
814 this._counter.setCounter("error-icon", errors, WebInspector.UIString(err
ors > 1 ? "%d errors" : "%d error", errors)); | 817 this._counter.setCounter("error-icon", errors, WebInspector.UIString(err
ors === 1 ? "%d errors" : "%d error", errors)); |
815 this._counter.setCounter("warning-icon", warnings, WebInspector.UIString
(warnings > 1 ? "%d warnings" : "%d warning", warnings)); | 818 this._counter.setCounter("revokedError-icon", revokedErrors, WebInspecto
r.UIString(revokedErrors === 1 ? "%d handled promise rejections" : "%d handled p
romise rejection", revokedErrors)); |
| 819 this._counter.setCounter("warning-icon", warnings, WebInspector.UIString
(warnings === 1 ? "%d warnings" : "%d warning", warnings)); |
816 WebInspector.inspectorView.toolbarItemResized(); | 820 WebInspector.inspectorView.toolbarItemResized(); |
817 }, | 821 }, |
818 | 822 |
819 /** | 823 /** |
820 * @override | 824 * @override |
821 * @return {?WebInspector.ToolbarItem} | 825 * @return {?WebInspector.ToolbarItem} |
822 */ | 826 */ |
823 item: function() | 827 item: function() |
824 { | 828 { |
825 return this._counter; | 829 return this._counter; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 p.classList.add("help-section"); | 901 p.classList.add("help-section"); |
898 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); | 902 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); |
899 } | 903 } |
900 | 904 |
901 WebInspector.WorkerTerminatedScreen.prototype = { | 905 WebInspector.WorkerTerminatedScreen.prototype = { |
902 | 906 |
903 __proto__: WebInspector.HelpScreen.prototype | 907 __proto__: WebInspector.HelpScreen.prototype |
904 } | 908 } |
905 | 909 |
906 new WebInspector.Main(); | 910 new WebInspector.Main(); |
OLD | NEW |