[extensions-web] js: Don't blindly ignore all errors in the API callback



commit 131bb2c123fc2d635fc4bc5e6b8915ecef251958
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Dec 18 04:34:08 2011 -0500

    js: Don't blindly ignore all errors in the API callback

 sweettooth/static/js/versions/common/common.js |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/sweettooth/static/js/versions/common/common.js b/sweettooth/static/js/versions/common/common.js
index aeb0425..6b69fdf 100644
--- a/sweettooth/static/js/versions/common/common.js
+++ b/sweettooth/static/js/versions/common/common.js
@@ -40,23 +40,15 @@ define(['jquery', 'dbus!API'], function($, API) {
 
         API_onchange: function(proxy) {
             return function(uuid, newState, error) {
-                try {
+                if (proxy.extensionStateChangedHandler !== null)
                     proxy.extensionStateChangedHandler(uuid, newState, error);
-                } catch(e) {
-                    // There's no way to tell if a property is callable, so
-                    // just catch the error.
-                }
             };
         },
 
         API_onshellrestart: function(proxy) {
             return function() {
-                try {
+                if (proxy.shellRestartHandler !== null)
                     proxy.shellRestartHandler();
-                } catch(e) {
-                    // There's no way to tell if a property is callable, so
-                    // just catch the error.
-                }
             };
         }
     };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]