Commit 506ce45d authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Revert "Unify JSErrorCounter for Files, Audio, Video and Gallery apps."

This reverts commit c4d25f5b.

Reason for revert: This made some tests for Video and Audio players flaky crbug.com/896529

Original change's description:
> Unify JSErrorCounter for Files, Audio, Video and Gallery apps.
>
> Bug: 893430
> Change-Id: I4cb8149eaec9c9ab22700905dae804ac893fdb6c
> Reviewed-on: https://chromium-review.googlesource.com/c/1282517
> Reviewed-by: Noel Gordon <noel@chromium.org>
> Reviewed-by: Trent Apted <tapted@chromium.org>
> Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#600308}

TBR=tapted@chromium.org,noel@chromium.org,lucmult@chromium.org

Change-Id: I676ef1e26b98ff842158501ebf1221520db18bc9
Bug: 896529
Reviewed-on: https://chromium-review.googlesource.com/c/1287729
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600642}
parent ccd7ac3e
......@@ -9,6 +9,7 @@ js_type_check("closure_compile") {
":audio_player",
":background",
":closure_compile_externs",
":error_util",
":metadata_worker",
]
}
......@@ -42,5 +43,8 @@ js_library("background") {
]
}
js_library("error_util") {
}
js_library("metadata_worker") {
}
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// <include src="../../base/js/error_counter.js">
// <include src="../../../webui/resources/js/cr.js">
// <include src="../../../webui/resources/js/cr/event_target.js">
// <include src="../../../webui/resources/js/cr/ui/array_data_model.js">
......
......@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// <include src="error_util.js">
// <include src="test_util.js">
// The main background script must be at the end.
// <include src="background.js">
// Copyright 2015 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.
/**
* This variable is checked in SelectFileDialogExtensionBrowserTest.
* @type {number}
*/
window.JSErrorCount = 0;
/**
* Counts uncaught exceptions.
*/
window.onerror = function() { window.JSErrorCount++; };
......@@ -10,7 +10,6 @@
* Note that adding a script in this file results in being loaded in each app.
*/
// <include src="../../../base/js/error_counter.js">
// <include src="../../common/js/async_util.js">
// <include src="../../common/js/file_type.js">
// <include src="../../common/js/metrics_base.js">
......
......@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// error_counter.js must be loaded before all other scripts of the Files app.
// <include src="../../../base/js/error_counter.js">
// <include src="../../common/js/metrics_events.js">
// <include src="../../common/js/metrics.js">
// <include src="metrics_start.js">
......
......@@ -8,7 +8,6 @@
// included file but that's all right since any javascript file should start
// with a copyright comment anyway.
// <include src="../../base/js/error_counter.js">
// <include src="../../file_manager/common/js/metrics_base.js">
// <include src="gallery_metrics.js">
// <include src="../../file_manager/foreground/js/metrics_start.js">
......
......@@ -2,6 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* This variable is checked in SelectFileDialogExtensionBrowserTest.
* @type {number}
*/
window.JSErrorCount = 0;
/**
* Counts uncaught exceptions.
*/
window.onerror = function() { window.JSErrorCount++; };
/**
* Opens the gallery window and waits until it is ready.
*
......
......@@ -8,6 +8,7 @@ js_type_check("closure_compile") {
deps = [
":background",
":closure_compile_externs",
":error_util",
":media_controls",
":mouse_inactivity_watcher",
":video_player",
......@@ -28,11 +29,15 @@ js_library("closure_compile_externs") {
js_library("background") {
deps = [
":error_util",
"../../file_manager/background/js:app_window_wrapper",
"../../file_manager/background/js:background_base",
]
}
js_library("error_util") {
}
js_library("media_controls") {
deps = [
"../../file_manager/common/js:util",
......@@ -46,12 +51,12 @@ js_library("mouse_inactivity_watcher") {
js_library("video_player") {
deps = [
":error_util",
":media_controls",
":mouse_inactivity_watcher",
":video_player_metrics",
"cast:cast_video_element",
"cast:media_manager",
"//ui/file_manager/base/js:error_counter",
"//ui/file_manager/base/js:filtered_volume_manager",
"//ui/file_manager/file_manager/common/js:metrics_base",
"//ui/file_manager/file_manager/common/js:util",
......
......@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// <include src="error_util.js">
// <include src="video_player_metrics.js">
// <include src="test_util.js">
// The main background script must be at the end.
......
......@@ -27,11 +27,15 @@ js_library("closure_compile_externs") {
}
js_library("cast_extension_discoverer") {
deps = [
"..:error_util",
]
}
js_library("cast_video_element") {
deps = [
":media_manager",
"..:error_util",
"..:video_player_metrics",
"//ui/webui/resources/js/cr:event_target",
]
......
// 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.
/**
* This variable is checked in SelectFileDialogExtensionBrowserTest.
* @type {number}
*/
window.JSErrorCount = 0;
/**
* Counts uncaught exceptions.
*/
window.onerror = function() { window.JSErrorCount++; };
/**
* Wraps the function to use it as a callback.
* This does:
* - Capture the stack trace in case of error.
* - Bind this object
*
* @param {Object=} opt_thisObject Object to be used as this.
* @param {...} var_args Arguments to be bound with the wrapped function.
* @return {function(...)} Wrapped function.
*/
Function.prototype.wrap = function(opt_thisObject, var_args) {
var func = this;
var liveStack = (new Error('Stack trace before async call')).stack;
var thisObject = opt_thisObject || null;
var boundArguments = Array.prototype.slice.call(arguments, 1);
return function wrappedCallback(var_args) {
try {
var args = boundArguments.concat(Array.prototype.slice.call(arguments));
return func.apply(thisObject, args);
} catch (e) {
// Some async function doesn't handle exception correctly. So outputting
// the exception message and stack trace just in case.
// The message will show twice if the caller handles exception correctly.
console.error(e.stack);
console.info('Exception above happened in callback.', liveStack);
window.JSErrorCount++;
throw e;
}
};
};
......@@ -8,7 +8,7 @@
// included file but that's all right since any javascript file should start
// with a copyright comment anyway.
// <include src="../../base/js/error_counter.js">
// <include src="error_util.js">
// <include src="../../file_manager/common/js/metrics_base.js">
// <include src="video_player_metrics.js">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment