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

Unified Diff: chrome/browser/resources/sync_internals/chrome_sync.js

Issue 6538047: [Sync] Clean up about:sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix HTML errors Created 9 years, 10 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: chrome/browser/resources/sync_internals/chrome_sync.js
diff --git a/chrome/browser/resources/sync_internals/chrome_sync.js b/chrome/browser/resources/sync_internals/chrome_sync.js
index c8dbcc676832ae7d6c56c9e3b63fd2f5a834fe55..3e5d21fe797b9e91a109c2cdb1e70ae81312ecdd 100644
--- a/chrome/browser/resources/sync_internals/chrome_sync.js
+++ b/chrome/browser/resources/sync_internals/chrome_sync.js
@@ -40,14 +40,20 @@ Event.prototype.findListener_ = function(listener) {
return -1;
};
-// Fires the event. Called by the actual event callback.
+// Fires the event. Called by the actual event callback. Any
+// exceptions thrown by a listener are caught and logged.
Event.prototype.dispatch_ = function() {
var args = Array.prototype.slice.call(arguments);
for (var i = 0; i < this.listeners_.length; i++) {
try {
this.listeners_[i].apply(null, args);
} catch (e) {
- console.error(e);
+ if (e instanceof Error) {
+ // Non-standard, but useful.
+ console.error(e.stack);
+ } else {
+ console.error(e);
+ }
}
}
};
@@ -90,12 +96,10 @@ AsyncFunction.prototype.call = function() {
// Handle a reply, assuming that messages are processed in FIFO order.
AsyncFunction.prototype.handleReply = function() {
var args = Array.prototype.slice.call(arguments);
+ // Remove the callback before we call it since the callback may
+ // throw.
var callback = this.callbacks_.shift();
- try {
- callback.apply(null, args);
- } catch (e) {
- console.error(e);
- }
+ callback.apply(null, args);
}
// Sync service functions.
« no previous file with comments | « chrome/browser/resources/sync_internals/about.html ('k') | chrome/browser/resources/sync_internals/notifications.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698