1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 * This variable is checked in SelectFileDialogExtensionBrowserTest.
11 window.JSErrorCount = 0;
14 * Count uncaught exceptions.
16 window.onerror = function() { window.JSErrorCount++; };
18 // Overrides console.error() to count errors.
20 * @param {...Object} var_args Message to be logged.
22 console.error = (function() {
23 var orig = console.error;
25 window.JSErrorCount++;
26 return orig.apply(this, arguments);
30 // Overrides console.assert() to count errors.
32 * @param {boolean} condition If false, log a message and stack trace.
33 * @param {...Object} var_args Objects to.
35 console.assert = (function() {
36 var orig = console.assert;
37 return function(condition) {
39 window.JSErrorCount++;
40 return orig.apply(this, arguments);