[Pkg-mozext-commits] [requestpolicy] 181/257: [ref] coding style: don't use catch-if anymore

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:11 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit 94d31465395035a3a47258f07032e9fd37026865
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Dec 1 19:49:28 2015 +0100

    [ref] coding style: don't use catch-if anymore
    
    Don't use `catch (e if ...)` anymore. JSCS can't handle it.
---
 src/content/lib/http-response.jsm     |  5 ++++-
 src/content/lib/request-processor.jsm | 18 +++++++++++++++---
 src/content/main/about-uri.jsm        | 10 +++++++---
 src/content/main/content-policy.jsm   | 10 +++++++---
 4 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/src/content/lib/http-response.jsm b/src/content/lib/http-response.jsm
index 7e2b135..0c43ae4 100644
--- a/src/content/lib/http-response.jsm
+++ b/src/content/lib/http-response.jsm
@@ -61,7 +61,10 @@ HttpResponse.prototype.removeResponseHeader = function() {
 HttpResponse.prototype._getResponseHeader = function (aHeaderName) {
   try {
     return this.httpChannel.getResponseHeader(aHeaderName);
-  } catch (e if e.result === Cr.NS_ERROR_NOT_AVAILABLE) {
+  } catch (e) {
+    if (e.result !== Cr.NS_ERROR_NOT_AVAILABLE) {
+      Cu.reportError(e);
+    }
     // The header is not set in the response.
     return undefined;
   }
diff --git a/src/content/lib/request-processor.jsm b/src/content/lib/request-processor.jsm
index 76eaa69..fdb499f 100644
--- a/src/content/lib/request-processor.jsm
+++ b/src/content/lib/request-processor.jsm
@@ -553,7 +553,11 @@ var RequestProcessor = (function () {
         let domNode;
         try {
           domNode = request.aContext.QueryInterface(Ci.nsIDOMNode);
-        } catch (e if e.result === Cr.NS_ERROR_NO_INTERFACE) {}
+        } catch (e) {
+          if (e.result !== Cr.NS_ERROR_NO_INTERFACE) {
+            throw e;
+          }
+        }
         if (domNode && domNode.nodeType === Ci.nsIDOMNode.DOCUMENT_NODE) {
           let newOriginURI;
           if (request.aContext.documentURI &&
@@ -599,7 +603,11 @@ var RequestProcessor = (function () {
         let domNode;
         try {
           domNode = request.aContext.QueryInterface(Ci.nsIDOMNode);
-        } catch (e if e.result === Cr.NS_ERROR_NO_INTERFACE) {}
+        } catch (e) {
+          if (e.result !== Cr.NS_ERROR_NO_INTERFACE) {
+            throw e;
+          }
+        }
 
         if (domNode && domNode.nodeName === "LINK" &&
             (domNode.rel === "icon" || domNode.rel === "shortcut icon")) {
@@ -707,7 +715,11 @@ var RequestProcessor = (function () {
         let domNode;
         try {
           domNode = request.aContext.QueryInterface(Ci.nsIDOMNode);
-        } catch (e if e.result === Cr.NS_ERROR_NO_INTERFACE) {}
+        } catch (e) {
+          if (e.result !== Cr.NS_ERROR_NO_INTERFACE) {
+            throw e;
+          }
+        }
 
         if (domNode && domNode.nodeName === "xul:browser" &&
             domNode.currentURI && domNode.currentURI.spec === "about:blank") {
diff --git a/src/content/main/about-uri.jsm b/src/content/main/about-uri.jsm
index b1a6fd9..39792ab 100644
--- a/src/content/main/about-uri.jsm
+++ b/src/content/main/about-uri.jsm
@@ -108,9 +108,13 @@ var AboutRequestPolicy = (function() {
       function () {
         try {
           registerFactory();
-        } catch (e if e.result === Cr.NS_ERROR_FACTORY_EXISTS) {
-          // When upgrading restartless the old factory might still exist.
-          Utils.runAsync(registerFactory);
+        } catch (e) {
+          if (e.result === Cr.NS_ERROR_FACTORY_EXISTS) {
+            // When upgrading restartless the old factory might still exist.
+            Utils.runAsync(registerFactory);
+          } else {
+            Cu.reportError(e);
+          }
         }
       });
 
diff --git a/src/content/main/content-policy.jsm b/src/content/main/content-policy.jsm
index 0bffa88..15942d3 100644
--- a/src/content/main/content-policy.jsm
+++ b/src/content/main/content-policy.jsm
@@ -80,9 +80,13 @@ var PolicyImplementation = (function() {
       function () {
         try {
           register();
-        } catch (e if e.result === Cr.NS_ERROR_FACTORY_EXISTS) {
-          // When upgrading restartless the old factory might still exist.
-          Utils.runAsync(register);
+        } catch (e) {
+          if (e.result === Cr.NS_ERROR_FACTORY_EXISTS) {
+            // When upgrading restartless the old factory might still exist.
+            Utils.runAsync(register);
+          } else {
+            Cu.reportError(e);
+          }
         }
       });
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list