Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: ui/file_manager/file_manager/common/js/error_util.js

Issue 645853013: Remove some platform specific stuff from views. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/common/js/error_util.js
diff --git a/ui/file_manager/file_manager/common/js/error_util.js b/ui/file_manager/file_manager/common/js/error_util.js
deleted file mode 100644
index 15cbc6ff08e031b85d552a3f41dc1dca3b1e04a1..0000000000000000000000000000000000000000
--- a/ui/file_manager/file_manager/common/js/error_util.js
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-'use strict';
-
-/**
- * This variable is checked in SelectFileDialogExtensionBrowserTest.
- * @type {number}
- */
-window.JSErrorCount = 0;
-
-/**
- * Count uncaught exceptions.
- */
-window.onerror = function() { window.JSErrorCount++; };
-
-// Overrides console.error() to count errors.
-/**
- * @param {...*} var_args Message to be logged.
- */
-console.error = (function() {
- var orig = console.error;
- return function() {
- window.JSErrorCount++;
- return orig.apply(this, arguments);
- };
-})();
-
-// Overrides console.assert() to count errors.
-/**
- * @param {boolean} condition If false, log a message and stack trace.
- * @param {...*} var_args Objects to.
- */
-console.assert = (function() {
- var orig = console.assert;
- return function(condition) {
- if (!condition)
- window.JSErrorCount++;
- return orig.apply(this, arguments);
- };
-})();
-
-/**
- * Wraps the function to use it as a callback.
- * This does:
- * - Capture the stack trace in case of error.
- * - Bind this object
- *
- * @param {Object} thisObject Object to be used as this.
- * @return {Function} Wrapped function.
- */
-Function.prototype.wrap = function(thisObject) {
- var func = this;
- var liveStack = (new Error('Stack trace before async call')).stack;
- if (thisObject === undefined)
- thisObject = null;
-
- return function wrappedCallback() {
- try {
- return func.apply(thisObject, arguments);
- } catch (e) {
- console.error('Exception happens in callback.', liveStack);
-
- window.JSErrorCount++;
- throw e;
- }
- }
-};
« no previous file with comments | « ui/file_manager/file_manager/common/js/async_util.js ('k') | ui/file_manager/file_manager/common/js/externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698