Bug 1376357 - Fix remaining ESLint issues in dom/media/*.js*. r?bwc draft
authorMark Banner <standard8@mozilla.com>
Mon, 26 Jun 2017 17:25:22 -0700
changeset 601457 67f6bbbcbfe7851ae969e4bc9f8d76ec5b7ef6ef
parent 601456 25aed6e28ec3ea16052da491885682ce719bbe7e
child 635258 d9d421104b90c91562b569299c069c4208c1a48c
push id66062
push userbmo:standard8@mozilla.com
push dateWed, 28 Jun 2017 19:42:50 +0000
reviewersbwc
bugs1376357
milestone56.0a1
Bug 1376357 - Fix remaining ESLint issues in dom/media/*.js*. r?bwc MozReview-Commit-ID: 7kjmQt1Ik6e
dom/media/PeerConnection.js
dom/media/PeerConnectionIdp.jsm
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -99,16 +99,17 @@ class GlobalPCList {
         for (let pcref of this._list[winId]) {
           let pc = pcref.get();
           if (pc && pc._globalPCListId == globalPCListId) {
             return pc;
           }
         }
       }
     }
+    return null;
   }
 
   removeNullRefs(winID) {
     if (this._list[winID] === undefined) {
       return;
     }
     this._list[winID] = this._list[winID].filter(
       function(e, i, a) { return e.get() !== null; });
@@ -435,18 +436,16 @@ class RTCPeerConnection {
     this.makeGetterSetterEH("onidpvalidationerror");
 
     this._pc = new this._win.PeerConnectionImpl();
     this._operationsChain = this._win.Promise.resolve();
 
     this.__DOM_IMPL__._innerObject = this;
     this._observer = new this._win.PeerConnectionObserver(this.__DOM_IMPL__);
 
-    var location = "" + this._win.location;
-
     // Warn just once per PeerConnection about deprecated getStats usage.
     this._warnDeprecatedStatsAccessNullable = { warn: () =>
       this.logWarning("non-maplike pc.getStats access is deprecated, and will be removed in the near future! " +
                       "See http://w3c.github.io/webrtc-pc/#getstats-example for usage.") };
 
     this._warnDeprecatedStatsCallbacksNullable = { warn: () =>
       this.logWarning("Callback-based pc.getStats is deprecated, and will be removed in the near future! Use promise-version! " +
                       "See http://w3c.github.io/webrtc-pc/#getstats-example for usage.") };
@@ -522,17 +521,17 @@ class RTCPeerConnection {
     let p = (async () => {
       await this._operationsChain;
       // Don't _checkClosed() inside the chain, because it throws, and spec
       // behavior is to NOT reject outstanding promises on close. This is what
       // happens most of the time anyways, as the c++ code stops calling us once
       // closed, hanging the chain. However, c++ may already have queued tasks
       // on us, so if we're one of those then sit back.
       if (this._closed) {
-        return;
+        return null;
       }
       return await func();
     })();
     // don't propagate errors in the operations chain (this is a fork of p).
     this._operationsChain = p.catch(() => {});
     return await p;
   }
 
@@ -1126,17 +1125,17 @@ class RTCPeerConnection {
       return uniqueRids;
     }, {});
 
     this._impl.setParameters(track, parameters);
   }
 
   _getParameters({ track }) {
     if (!Services.prefs.getBoolPref("media.peerconnection.simulcast")) {
-      return;
+      return null;
     }
     return this._impl.getParameters(track);
   }
 
   close() {
     if (this._closed) {
       return;
     }
@@ -1286,17 +1285,16 @@ setupPrototype(RTCPeerConnection, {
   contractID: PC_CONTRACT,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
                                          Ci.nsIDOMGlobalPropertyInitializer]),
   _actions: {
     offer: Ci.IPeerConnection.kActionOffer,
     answer: Ci.IPeerConnection.kActionAnswer,
     pranswer: Ci.IPeerConnection.kActionPRAnswer,
     rollback: Ci.IPeerConnection.kActionRollback,
-    answer: Ci.IPeerConnection.kActionAnswer,
   },
 });
 
 // This is a separate class because we don't want to expose it to DOM.
 
 class PeerConnectionObserver {
   init(win) {
     this._win = win;
--- a/dom/media/PeerConnectionIdp.jsm
+++ b/dom/media/PeerConnectionIdp.jsm
@@ -101,17 +101,17 @@ PeerConnectionIdp.prototype = {
     // a=identity is session level
     let idMatch;
     let mLineMatch = sdp.match(PeerConnectionIdp._mLinePattern);
     if (mLineMatch) {
       let sessionLevel = sdp.substring(0, mLineMatch.index);
       idMatch = sessionLevel.match(PeerConnectionIdp._identityPattern);
     }
     if (!idMatch) {
-      return; // undefined === no identity
+      return undefined; // undefined === no identity
     }
 
     let assertion;
     try {
       assertion = JSON.parse(atob(idMatch[1]));
     } catch (e) {
       throw new this._win.DOMException("invalid identity assertion: " + e,
                                        "InvalidSessionDescriptionError");