Bug 1376357 - Drop use of non-standard catch-if in dom/media/*.js. r?bwc draft
authorMark Banner <standard8@mozilla.com>
Mon, 26 Jun 2017 16:55:26 -0700
changeset 601454 148e81d466f8e426f13ad658b330c5d8c2dba731
parent 601236 306d2070e105b75f7076d30cc0288171f1435c07
child 601455 add2fef19e3284d28ac6cb38541f01f20895ede7
child 601456 25aed6e28ec3ea16052da491885682ce719bbe7e
push id66061
push userbmo:standard8@mozilla.com
push dateWed, 28 Jun 2017 19:37:10 +0000
reviewersbwc
bugs1376357
milestone56.0a1
Bug 1376357 - Drop use of non-standard catch-if in dom/media/*.js. r?bwc MozReview-Commit-ID: 1LkJGQz1y1w
dom/media/IdpSandbox.jsm
dom/media/PeerConnection.js
--- a/dom/media/IdpSandbox.jsm
+++ b/dom/media/IdpSandbox.jsm
@@ -163,19 +163,22 @@ IdpSandbox.createIdpUri = function(domai
     if (uri.hostPort !== domain) {
       throw new Error(message + 'domain is invalid');
     }
     if (uri.path.indexOf('/.well-known/idp-proxy/') !== 0) {
       throw new Error(message + 'must produce a /.well-known/idp-proxy/ URI');
     }
 
     return uri;
-  } catch (e if (typeof e.result !== 'undefined' &&
-                 e.result === Cr.NS_ERROR_MALFORMED_URI)) {
-    throw new Error(message + 'must produce a valid URI');
+  } catch (e) {
+    if (typeof e.result !== 'undefined' &&
+                   e.result === Cr.NS_ERROR_MALFORMED_URI) {
+      throw new Error(message + 'must produce a valid URI');
+    }
+    throw e;
   }
 };
 
 IdpSandbox.prototype = {
   isSame: function(domain, protocol) {
     return this.source.spec === IdpSandbox.createIdpUri(domain, protocol).spec;
   },
 
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -617,19 +617,22 @@ class RTCPeerConnection {
       }
     });
 
     let ios = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService);
 
     let nicerNewURI = uriStr => {
       try {
         return ios.newURI(uriStr);
-      } catch (e if (e.result == Cr.NS_ERROR_MALFORMED_URI)) {
-        throw new this._win.DOMException(msg + " - malformed URI: " + uriStr,
-                                         "SyntaxError");
+      } catch (e) {
+        if (e.result == Cr.NS_ERROR_MALFORMED_URI) {
+          throw new this._win.DOMException(msg + " - malformed URI: " + uriStr,
+                                           "SyntaxError");
+        }
+        throw e;
       }
     };
 
     var stunServers = 0;
 
     iceServers.forEach(({ urls, username, credential, credentialType }) => {
       if (!urls) {
         throw new this._win.DOMException(msg + " - missing urls", "InvalidAccessError");