浏览代码

fix(eslint): Add eqeqeq rule

dev1
hristoterezov 8 年前
父节点
当前提交
e5472b9aca

+ 1
- 0
.eslintrc.js 查看文件

76
         'default-case': 0,
76
         'default-case': 0,
77
         'dot-location': [ 'error', 'property' ],
77
         'dot-location': [ 'error', 'property' ],
78
         'dot-notation': 2,
78
         'dot-notation': 2,
79
+        'eqeqeq': 2,
79
         'guard-for-in': 2,
80
         'guard-for-in': 2,
80
         'no-alert': 2,
81
         'no-alert': 2,
81
         'no-caller': 2,
82
         'no-caller': 2,

+ 3
- 3
JitsiConferenceEventManager.js 查看文件

332
 
332
 
333
     chatRoom.addPresenceListener('videomuted', (values, from) => {
333
     chatRoom.addPresenceListener('videomuted', (values, from) => {
334
         conference.rtc.handleRemoteTrackMute(MediaType.VIDEO,
334
         conference.rtc.handleRemoteTrackMute(MediaType.VIDEO,
335
-            values.value == 'true', from);
335
+            values.value === 'true', from);
336
     });
336
     });
337
 
337
 
338
     chatRoom.addPresenceListener('audiomuted', (values, from) => {
338
     chatRoom.addPresenceListener('audiomuted', (values, from) => {
339
         conference.rtc.handleRemoteTrackMute(MediaType.AUDIO,
339
         conference.rtc.handleRemoteTrackMute(MediaType.AUDIO,
340
-            values.value == 'true', from);
340
+            values.value === 'true', from);
341
     });
341
     });
342
 
342
 
343
     chatRoom.addPresenceListener('videoType', (data, from) => {
343
     chatRoom.addPresenceListener('videoType', (data, from) => {
575
             const resolution = ssrc2resolution[ssrc];
575
             const resolution = ssrc2resolution[ssrc];
576
 
576
 
577
             if (!resolution.width || !resolution.height
577
             if (!resolution.width || !resolution.height
578
-                || resolution.width == -1 || resolution.height == -1) {
578
+                || resolution.width === -1 || resolution.height === -1) {
579
                 return;
579
                 return;
580
             }
580
             }
581
 
581
 

+ 2
- 2
doc/example/example.js 查看文件

43
             deviceId =>
43
             deviceId =>
44
                 console.log(
44
                 console.log(
45
                     `track audio output device was changed to ${deviceId}`));
45
                     `track audio output device was changed to ${deviceId}`));
46
-        if (localTracks[i].getType() == 'video') {
46
+        if (localTracks[i].getType() === 'video') {
47
             $('body').append(`<video autoplay='1' id='localVideo${i}' />`);
47
             $('body').append(`<video autoplay='1' id='localVideo${i}' />`);
48
             localTracks[i].attach($(`#localVideo${i}`)[0]);
48
             localTracks[i].attach($(`#localVideo${i}`)[0]);
49
         } else {
49
         } else {
87
                 `track audio output device was changed to ${deviceId}`));
87
                 `track audio output device was changed to ${deviceId}`));
88
     const id = participant + track.getType() + idx;
88
     const id = participant + track.getType() + idx;
89
 
89
 
90
-    if (track.getType() == 'video') {
90
+    if (track.getType() === 'video') {
91
         $('body').append(
91
         $('body').append(
92
             `<video autoplay='1' id='${participant}video${idx}' />`);
92
             `<video autoplay='1' id='${participant}video${idx}' />`);
93
     } else {
93
     } else {

+ 1
- 1
modules/RTC/DataChannels.js 查看文件

266
  */
266
  */
267
 DataChannels.prototype.send = function(jsonObject) {
267
 DataChannels.prototype.send = function(jsonObject) {
268
     if (!this._some(dataChannel => {
268
     if (!this._some(dataChannel => {
269
-        if (dataChannel.readyState == 'open') {
269
+        if (dataChannel.readyState === 'open') {
270
             dataChannel.send(JSON.stringify(jsonObject));
270
             dataChannel.send(JSON.stringify(jsonObject));
271
 
271
 
272
             return true;
272
             return true;

+ 11
- 2
modules/RTC/RTC.js 查看文件

486
                     const mediaTrack = endpointTracks[mediaType];
486
                     const mediaTrack = endpointTracks[mediaType];
487
 
487
 
488
                     if (mediaTrack
488
                     if (mediaTrack
489
-                        && mediaTrack.getStreamId() == streamId
490
-                        && mediaTrack.getTrackId() == trackId) {
489
+                        && mediaTrack.getStreamId() === streamId
490
+                        && mediaTrack.getTrackId() === trackId) {
491
                         result = mediaTrack;
491
                         result = mediaTrack;
492
 
492
 
493
                         return true;
493
                         return true;
680
      * @param ssrc the ssrc to check.
680
      * @param ssrc the ssrc to check.
681
      */
681
      */
682
     getResourceBySSRC(ssrc) {
682
     getResourceBySSRC(ssrc) {
683
+
684
+        // FIXME: Convert the SSRCs in whole project to use the same type.
685
+        // Now we are using number and string.
683
         if (this.getLocalTracks().find(
686
         if (this.getLocalTracks().find(
687
+
688
+            // eslint-disable-next-line eqeqeq
684
                 localTrack => localTrack.getSSRC() == ssrc)) {
689
                 localTrack => localTrack.getSSRC() == ssrc)) {
685
             return this.conference.myUserId();
690
             return this.conference.myUserId();
686
         }
691
         }
699
      * matches given SSRC or <tt>undefined</tt> if no such track was found.
704
      * matches given SSRC or <tt>undefined</tt> if no such track was found.
700
      */
705
      */
701
     getRemoteTrackBySSRC(ssrc) {
706
     getRemoteTrackBySSRC(ssrc) {
707
+
708
+        // FIXME: Convert the SSRCs in whole project to use the same type.
709
+        // Now we are using number and string.
710
+        // eslint-disable-next-line eqeqeq
702
         return this.getRemoteTracks().find(t => ssrc == t.getSSRC());
711
         return this.getRemoteTracks().find(t => ssrc == t.getSSRC());
703
     }
712
     }
704
 
713
 

+ 1
- 1
modules/RTC/RTCBrowserType.js 查看文件

377
 }
377
 }
378
 
378
 
379
 const browserVersion = detectBrowser();
379
 const browserVersion = detectBrowser();
380
-const isAndroid = navigator.userAgent.indexOf('Android') != -1;
380
+const isAndroid = navigator.userAgent.indexOf('Android') !== -1;
381
 
381
 
382
 module.exports = RTCBrowserType;
382
 module.exports = RTCBrowserType;

+ 2
- 2
modules/RTC/RTCUtils.js 查看文件

328
     const audioTracksReceived = stream && stream.getAudioTracks().length > 0;
328
     const audioTracksReceived = stream && stream.getAudioTracks().length > 0;
329
     const videoTracksReceived = stream && stream.getVideoTracks().length > 0;
329
     const videoTracksReceived = stream && stream.getVideoTracks().length > 0;
330
 
330
 
331
-    if (um.indexOf('video') != -1) {
331
+    if (um.indexOf('video') !== -1) {
332
         devices.video = videoTracksReceived;
332
         devices.video = videoTracksReceived;
333
     }
333
     }
334
-    if (um.indexOf('audio') != -1) {
334
+    if (um.indexOf('audio') !== -1) {
335
         devices.audio = audioTracksReceived;
335
         devices.audio = audioTracksReceived;
336
     }
336
     }
337
 
337
 

+ 1
- 1
modules/RTC/ScreenObtainer.js 查看文件

103
                         // but this is what we are receiving from GUM when the
103
                         // but this is what we are receiving from GUM when the
104
                         // streamId for the desktop sharing is "".
104
                         // streamId for the desktop sharing is "".
105
 
105
 
106
-                        if (error && error.name == 'InvalidStateError') {
106
+                        if (error && error.name === 'InvalidStateError') {
107
                             jitsiError = new JitsiTrackError(
107
                             jitsiError = new JitsiTrackError(
108
                                 JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED
108
                                 JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED
109
                             );
109
                             );

+ 1
- 1
modules/RTC/TraceablePeerConnection.js 查看文件

862
     // default choice of setup:active to setup:passive.
862
     // default choice of setup:active to setup:passive.
863
     if (offer && answer
863
     if (offer && answer
864
             && offer.media && answer.media
864
             && offer.media && answer.media
865
-            && offer.media.length == answer.media.length) {
865
+            && offer.media.length === answer.media.length) {
866
         answer.media.forEach((a, i) => {
866
         answer.media.forEach((a, i) => {
867
             if (SDPUtil.find_line(
867
             if (SDPUtil.find_line(
868
                     offer.media[i],
868
                     offer.media[i],

+ 1
- 1
modules/connectivity/ConnectionQuality.js 查看文件

92
                 const targetHeight = height;
92
                 const targetHeight = height;
93
 
93
 
94
                 simulcastFormat
94
                 simulcastFormat
95
-                    = kSimulcastFormats.find(f => f.height == targetHeight);
95
+                    = kSimulcastFormats.find(f => f.height === targetHeight);
96
                 if (simulcastFormat) {
96
                 if (simulcastFormat) {
97
                     target += simulcastFormat.target;
97
                     target += simulcastFormat.target;
98
                 } else {
98
                 } else {

+ 1
- 2
modules/settings/Settings.js 查看文件

10
  * @returns {Storage} the local Storage object (if any)
10
  * @returns {Storage} the local Storage object (if any)
11
  */
11
  */
12
 function getLocalStorage() {
12
 function getLocalStorage() {
13
-    const global = typeof window == 'undefined' ? this : window;
14
-
13
+    const global = typeof window === 'undefined' ? this : window;
15
 
14
 
16
     return global.localStorage;
15
     return global.localStorage;
17
 }
16
 }

+ 1
- 1
modules/statistics/LocalStatsCollector.js 查看文件

120
             analyser.getByteTimeDomainData(array);
120
             analyser.getByteTimeDomainData(array);
121
             const audioLevel = timeDomainDataToAudioLevel(array);
121
             const audioLevel = timeDomainDataToAudioLevel(array);
122
 
122
 
123
-            if (audioLevel != self.audioLevel) {
123
+            if (audioLevel !== self.audioLevel) {
124
                 self.audioLevel = animateLevel(audioLevel, self.audioLevel);
124
                 self.audioLevel = animateLevel(audioLevel, self.audioLevel);
125
                 self.callback(self.audioLevel);
125
                 self.callback(self.audioLevel);
126
             }
126
             }

+ 12
- 10
modules/statistics/RTPStatsCollector.js 查看文件

259
                         let results = null;
259
                         let results = null;
260
 
260
 
261
                         if (!report || !report.result
261
                         if (!report || !report.result
262
-                            || typeof report.result != 'function') {
262
+                            || typeof report.result !== 'function') {
263
                             results = report;
263
                             results = report;
264
                         } else {
264
                         } else {
265
                             results = report.result();
265
                             results = report.result();
285
                         let results = null;
285
                         let results = null;
286
 
286
 
287
                         if (!report || !report.result
287
                         if (!report || !report.result
288
-                            || typeof report.result != 'function') {
288
+                            || typeof report.result !== 'function') {
289
                             // firefox
289
                             // firefox
290
                             results = report;
290
                             results = report;
291
                         } else {
291
                         } else {
429
             }
429
             }
430
         } catch (e) { /* not supported*/ }
430
         } catch (e) { /* not supported*/ }
431
 
431
 
432
-        if (now.type == 'googCandidatePair') {
432
+        if (now.type === 'googCandidatePair') {
433
             let active, ip, localip, type;
433
             let active, ip, localip, type;
434
 
434
 
435
             try {
435
             try {
438
                 localip = getStatValue(now, 'localAddress');
438
                 localip = getStatValue(now, 'localAddress');
439
                 active = getStatValue(now, 'activeConnection');
439
                 active = getStatValue(now, 'activeConnection');
440
             } catch (e) { /* not supported*/ }
440
             } catch (e) { /* not supported*/ }
441
-            if (!ip || !type || !localip || active != 'true') {
441
+            if (!ip || !type || !localip || active !== 'true') {
442
                 continue;
442
                 continue;
443
             }
443
             }
444
 
444
 
447
 
447
 
448
             if (!conferenceStatsTransport.some(
448
             if (!conferenceStatsTransport.some(
449
                     t =>
449
                     t =>
450
-                        t.ip == ip && t.type == type && t.localip == localip)) {
450
+                        t.ip === ip
451
+                        && t.type === type
452
+                        && t.localip === localip)) {
451
                 conferenceStatsTransport.push({ ip,
453
                 conferenceStatsTransport.push({ ip,
452
                     type,
454
                     type,
453
                     localip });
455
                     localip });
455
             continue;
457
             continue;
456
         }
458
         }
457
 
459
 
458
-        if (now.type == 'candidatepair') {
459
-            if (now.state == 'succeeded') {
460
+        if (now.type === 'candidatepair') {
461
+            if (now.state === 'succeeded') {
460
                 continue;
462
                 continue;
461
             }
463
             }
462
 
464
 
470
             });
472
             });
471
         }
473
         }
472
 
474
 
473
-        if (now.type != 'ssrc' && now.type != 'outboundrtp'
474
-            && now.type != 'inboundrtp') {
475
+        if (now.type !== 'ssrc' && now.type !== 'outboundrtp'
476
+            && now.type !== 'inboundrtp') {
475
             continue;
477
             continue;
476
         }
478
         }
477
 
479
 
655
 
657
 
656
         const now = this.currentAudioLevelsReport[idx];
658
         const now = this.currentAudioLevelsReport[idx];
657
 
659
 
658
-        if (now.type != 'ssrc') {
660
+        if (now.type !== 'ssrc') {
659
             continue;
661
             continue;
660
         }
662
         }
661
 
663
 

+ 6
- 6
modules/xmpp/ChatRoom.js 查看文件

221
                         .length
221
                         .length
222
                     === 1;
222
                     === 1;
223
 
223
 
224
-            if (locked != this.locked) {
224
+            if (locked !== this.locked) {
225
                 this.eventEmitter.emit(XMPPEvents.MUC_LOCK_CHANGED, locked);
225
                 this.eventEmitter.emit(XMPPEvents.MUC_LOCK_CHANGED, locked);
226
                 this.locked = locked;
226
                 this.locked = locked;
227
             }
227
             }
326
             }
326
             }
327
         }
327
         }
328
 
328
 
329
-        if (from == this.myroomjid) {
329
+        if (from === this.myroomjid) {
330
             const newRole
330
             const newRole
331
-                = member.affiliation == 'owner' ? member.role : 'none';
331
+                = member.affiliation === 'owner' ? member.role : 'none';
332
 
332
 
333
             if (this.role !== newRole) {
333
             if (this.role !== newRole) {
334
                 this.role = newRole;
334
                 this.role = newRole;
366
             // Watch role change:
366
             // Watch role change:
367
             const memberOfThis = this.members[from];
367
             const memberOfThis = this.members[from];
368
 
368
 
369
-            if (memberOfThis.role != member.role) {
369
+            if (memberOfThis.role !== member.role) {
370
                 memberOfThis.role = member.role;
370
                 memberOfThis.role = member.role;
371
                 this.eventEmitter.emit(
371
                 this.eventEmitter.emit(
372
                     XMPPEvents.MUC_ROLE_CHANGED, from, member.role);
372
                     XMPPEvents.MUC_ROLE_CHANGED, from, member.role);
614
         const txt = $(msg).find('>body').text();
614
         const txt = $(msg).find('>body').text();
615
         const type = msg.getAttribute('type');
615
         const type = msg.getAttribute('type');
616
 
616
 
617
-        if (type == 'error') {
617
+        if (type === 'error') {
618
             this.eventEmitter.emit(XMPPEvents.CHAT_ERROR_RECEIVED,
618
             this.eventEmitter.emit(XMPPEvents.CHAT_ERROR_RECEIVED,
619
                 $(msg).find('>text').text(), txt);
619
                 $(msg).find('>text').text(), txt);
620
 
620
 
648
             }
648
             }
649
         }
649
         }
650
 
650
 
651
-        if (from == this.roomjid
651
+        if (from === this.roomjid
652
                 && $(msg)
652
                 && $(msg)
653
                     .find(
653
                     .find(
654
                         '>x[xmlns="http://jabber.org/protocol/muc#user"]'
654
                         '>x[xmlns="http://jabber.org/protocol/muc#user"]'

+ 7
- 7
modules/xmpp/JingleSessionPC.js 查看文件

143
                         if (this.webrtcIceTcpDisable) {
143
                         if (this.webrtcIceTcpDisable) {
144
                             return;
144
                             return;
145
                         }
145
                         }
146
-                    } else if (protocol == 'udp') {
146
+                    } else if (protocol === 'udp') {
147
                         if (this.webrtcIceUdpDisable) {
147
                         if (this.webrtcIceUdpDisable) {
148
                             return;
148
                             return;
149
                         }
149
                         }
288
         const localSDP = new SDP(this.peerconnection.localDescription.sdp);
288
         const localSDP = new SDP(this.peerconnection.localDescription.sdp);
289
 
289
 
290
         for (let mid = 0; mid < localSDP.media.length; mid++) {
290
         for (let mid = 0; mid < localSDP.media.length; mid++) {
291
-            const cands = candidates.filter(el => el.sdpMLineIndex == mid);
291
+            const cands = candidates.filter(el => el.sdpMLineIndex === mid);
292
             const mline
292
             const mline
293
                 = SDPUtil.parse_mline(localSDP.media[mid].split('\r\n')[0]);
293
                 = SDPUtil.parse_mline(localSDP.media[mid].split('\r\n')[0]);
294
 
294
 
298
 
298
 
299
                 ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
299
                 ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
300
                 cand.c('content', {
300
                 cand.c('content', {
301
-                    creator: this.initiator == this.localJid
301
+                    creator: this.initiator === this.localJid
302
                                     ? 'initiator' : 'responder',
302
                                     ? 'initiator' : 'responder',
303
                     name: cands[0].sdpMid ? cands[0].sdpMid : mline.media
303
                     name: cands[0].sdpMid ? cands[0].sdpMid : mline.media
304
                 }).c('transport', ice);
304
                 }).c('transport', ice);
510
         }
510
         }
511
         localSDP.toJingle(
511
         localSDP.toJingle(
512
             accept,
512
             accept,
513
-            this.initiator == this.localJid ? 'initiator' : 'responder',
513
+            this.initiator === this.localJid ? 'initiator' : 'responder',
514
             null);
514
             null);
515
         this.fixJingle(accept);
515
         this.fixJingle(accept);
516
 
516
 
574
             transportAccept.c('content',
574
             transportAccept.c('content',
575
                 {
575
                 {
576
                     creator:
576
                     creator:
577
-                        this.initiator == this.localJid
577
+                        this.initiator === this.localJid
578
                             ? 'initiator'
578
                             ? 'initiator'
579
                             : 'responder',
579
                             : 'responder',
580
                     name: mline.media
580
                     name: mline.media
946
         return new Promise((resolve, reject) => {
946
         return new Promise((resolve, reject) => {
947
             const remoteUfrag = JingleSessionPC.getUfrag(remoteDescription.sdp);
947
             const remoteUfrag = JingleSessionPC.getUfrag(remoteDescription.sdp);
948
 
948
 
949
-            if (remoteUfrag != this.remoteUfrag) {
949
+            if (remoteUfrag !== this.remoteUfrag) {
950
                 this.remoteUfrag = remoteUfrag;
950
                 this.remoteUfrag = remoteUfrag;
951
                 this.room.eventEmitter.emit(
951
                 this.room.eventEmitter.emit(
952
                         XMPPEvents.REMOTE_UFRAG_CHANGED, remoteUfrag);
952
                         XMPPEvents.REMOTE_UFRAG_CHANGED, remoteUfrag);
969
                             const localUfrag
969
                             const localUfrag
970
                                 = JingleSessionPC.getUfrag(answer.sdp);
970
                                 = JingleSessionPC.getUfrag(answer.sdp);
971
 
971
 
972
-                            if (localUfrag != this.localUfrag) {
972
+                            if (localUfrag !== this.localUfrag) {
973
                                 this.localUfrag = localUfrag;
973
                                 this.localUfrag = localUfrag;
974
                                 this.room.eventEmitter.emit(
974
                                 this.room.eventEmitter.emit(
975
                                         XMPPEvents.LOCAL_UFRAG_CHANGED,
975
                                         XMPPEvents.LOCAL_UFRAG_CHANGED,

+ 9
- 9
modules/xmpp/SDP.js 查看文件

9
     for (let i = 1, length = media.length; i < length; i++) {
9
     for (let i = 1, length = media.length; i < length; i++) {
10
         let media_i = `m=${media[i]}`;
10
         let media_i = `m=${media[i]}`;
11
 
11
 
12
-        if (i != length - 1) {
12
+        if (i !== length - 1) {
13
             media_i += '\r\n';
13
             media_i += '\r\n';
14
         }
14
         }
15
         media[i] = media_i;
15
         media[i] = media_i;
124
         lines = this.media[i].split('\r\n');
124
         lines = this.media[i].split('\r\n');
125
         lines.pop(); // remove empty last element
125
         lines.pop(); // remove empty last element
126
         mline = SDPUtil.parse_mline(lines.shift());
126
         mline = SDPUtil.parse_mline(lines.shift());
127
-        if (mline.media != 'audio') {
127
+        if (mline.media !== 'audio') {
128
             continue; // eslint-disable-line no-continue
128
             continue; // eslint-disable-line no-continue
129
         }
129
         }
130
         newdesc = '';
130
         newdesc = '';
131
         mline.fmt.length = 0;
131
         mline.fmt.length = 0;
132
         for (j = 0; j < lines.length; j++) {
132
         for (j = 0; j < lines.length; j++) {
133
-            if (lines[j].substr(0, 9) == 'a=rtpmap:') {
133
+            if (lines[j].substr(0, 9) === 'a=rtpmap:') {
134
                 rtpmap = SDPUtil.parse_rtpmap(lines[j]);
134
                 rtpmap = SDPUtil.parse_rtpmap(lines[j]);
135
-                if (rtpmap.name == 'CN' || rtpmap.name == 'ISAC') {
135
+                if (rtpmap.name === 'CN' || rtpmap.name === 'ISAC') {
136
                     continue; // eslint-disable-line no-continue
136
                     continue; // eslint-disable-line no-continue
137
                 }
137
                 }
138
                 mline.fmt.push(rtpmap.id);
138
                 mline.fmt.push(rtpmap.id);
275
                         const idx = line.indexOf(' ');
275
                         const idx = line.indexOf(' ');
276
                         const linessrc = line.substr(0, idx).substr(7);
276
                         const linessrc = line.substr(0, idx).substr(7);
277
 
277
 
278
-                        if (linessrc != ssrc) {
278
+                        if (linessrc !== ssrc) {
279
                             elem.up();
279
                             elem.up();
280
                             ssrc = linessrc;
280
                             ssrc = linessrc;
281
                             elem.c('source', { ssrc,
281
                             elem.c('source', { ssrc,
284
                         const kv = line.substr(idx + 1);
284
                         const kv = line.substr(idx + 1);
285
 
285
 
286
                         elem.c('parameter');
286
                         elem.c('parameter');
287
-                        if (kv.indexOf(':') == -1) {
287
+                        if (kv.indexOf(':') === -1) {
288
                             elem.attrs({ name: kv });
288
                             elem.attrs({ name: kv });
289
                         } else {
289
                         } else {
290
                             const k = kv.split(':', 2)[0];
290
                             const k = kv.split(':', 2)[0];
413
         } else if (SDPUtil.find_line(m, 'a=inactive', this.session)) {
413
         } else if (SDPUtil.find_line(m, 'a=inactive', this.session)) {
414
             elem.attrs({ senders: 'none' });
414
             elem.attrs({ senders: 'none' });
415
         }
415
         }
416
-        if (mline.port == '0') {
416
+        if (mline.port === '0') {
417
             // estos hack to reject an m-line
417
             // estos hack to reject an m-line
418
             elem.attrs({ senders: 'rejected' });
418
             elem.attrs({ senders: 'rejected' });
419
         }
419
         }
521
     lines.forEach(line => {
521
     lines.forEach(line => {
522
         const tmp = SDPUtil.parse_rtcpfb(line);
522
         const tmp = SDPUtil.parse_rtcpfb(line);
523
 
523
 
524
-        if (tmp.type == 'trr-int') {
524
+        if (tmp.type === 'trr-int') {
525
             elem.c('rtcp-fb-trr-int', {
525
             elem.c('rtcp-fb-trr-int', {
526
                 xmlns: 'urn:xmpp:jingle:apps:rtp:rtcp-fb:0',
526
                 xmlns: 'urn:xmpp:jingle:apps:rtp:rtcp-fb:0',
527
                 value: tmp.params[0]
527
                 value: tmp.params[0]
628
     let tmp = { media: desc.attr('media') };
628
     let tmp = { media: desc.attr('media') };
629
 
629
 
630
     tmp.port = '1';
630
     tmp.port = '1';
631
-    if (content.attr('senders') == 'rejected') {
631
+    if (content.attr('senders') === 'rejected') {
632
         // estos hack to reject an m-line.
632
         // estos hack to reject an m-line.
633
         tmp.port = '0';
633
         tmp.port = '0';
634
     }
634
     }

+ 4
- 4
modules/xmpp/SDPDiffer.js 查看文件

19
         }
19
         }
20
 
20
 
21
         // compare lengths - can save a lot of time
21
         // compare lengths - can save a lot of time
22
-        if (this.length != array.length) {
22
+        if (this.length !== array.length) {
23
             return false;
23
             return false;
24
         }
24
         }
25
 
25
 
30
                 if (!this[i].equals(array[i])) {
30
                 if (!this[i].equals(array[i])) {
31
                     return false;
31
                     return false;
32
                 }
32
                 }
33
-            } else if (this[i] != array[i]) {
33
+            } else if (this[i] !== array[i]) {
34
                 // Warning - two different object instances will never be
34
                 // Warning - two different object instances will never be
35
                 // equal: {x:20} != {x:20}
35
                 // equal: {x:20} != {x:20}
36
                 return false;
36
                 return false;
81
             for (let i = 0; i < myMedia.ssrcGroups.length; i++) {
81
             for (let i = 0; i < myMedia.ssrcGroups.length; i++) {
82
                 const mySsrcGroup = myMedia.ssrcGroups[i];
82
                 const mySsrcGroup = myMedia.ssrcGroups[i];
83
 
83
 
84
-                if (otherSsrcGroup.semantics == mySsrcGroup.semantics
84
+                if (otherSsrcGroup.semantics === mySsrcGroup.semantics
85
                     && arrayEquals.apply(otherSsrcGroup.ssrcs,
85
                     && arrayEquals.apply(otherSsrcGroup.ssrcs,
86
                                       [ mySsrcGroup.ssrcs ])) {
86
                                       [ mySsrcGroup.ssrcs ])) {
87
 
87
 
143
                 const kv = line.substr(idx + 1);
143
                 const kv = line.substr(idx + 1);
144
 
144
 
145
                 modify.c('parameter');
145
                 modify.c('parameter');
146
-                if (kv.indexOf(':') == -1) {
146
+                if (kv.indexOf(':') === -1) {
147
                     modify.attrs({ name: kv });
147
                     modify.attrs({ name: kv });
148
                 } else {
148
                 } else {
149
                     const nv = kv.split(':', 2);
149
                     const nv = kv.split(':', 2);

+ 13
- 12
modules/xmpp/SDPUtil.js 查看文件

97
             = `a=rtpmap:${el.getAttribute('id')} ${el.getAttribute('name')}/${
97
             = `a=rtpmap:${el.getAttribute('id')} ${el.getAttribute('name')}/${
98
                 el.getAttribute('clockrate')}`;
98
                 el.getAttribute('clockrate')}`;
99
 
99
 
100
-        if (el.getAttribute('channels') && el.getAttribute('channels') != '1') {
100
+        if (el.getAttribute('channels')
101
+            && el.getAttribute('channels') !== '1') {
101
             line += `/${el.getAttribute('channels')}`;
102
             line += `/${el.getAttribute('channels')}`;
102
         }
103
         }
103
 
104
 
135
         for (let i = 0; i < parts.length; i++) {
136
         for (let i = 0; i < parts.length; i++) {
136
             let key = parts[i].split('=')[0];
137
             let key = parts[i].split('=')[0];
137
 
138
 
138
-            while (key.length && key[0] == ' ') {
139
+            while (key.length && key[0] === ' ') {
139
                 key = key.substring(1);
140
                 key = key.substring(1);
140
             }
141
             }
141
             const value = parts[i].split('=')[1];
142
             const value = parts[i].split('=')[1];
244
         const lines = desc.split('\r\n');
245
         const lines = desc.split('\r\n');
245
 
246
 
246
         for (let i = 0; i < lines.length; i++) {
247
         for (let i = 0; i < lines.length; i++) {
247
-            if (lines[i].substring(0, 7) == 'a=ssrc:') {
248
+            if (lines[i].substring(0, 7) === 'a=ssrc:') {
248
                 const idx = lines[i].indexOf(' ');
249
                 const idx = lines[i].indexOf(' ');
249
 
250
 
250
                 data[lines[i].substr(idx + 1).split(':', 2)[0]]
251
                 data[lines[i].substr(idx + 1).split(':', 2)[0]]
284
         let lines = haystack.split('\r\n');
285
         let lines = haystack.split('\r\n');
285
 
286
 
286
         for (let i = 0; i < lines.length; i++) {
287
         for (let i = 0; i < lines.length; i++) {
287
-            if (lines[i].substring(0, needle.length) == needle) {
288
+            if (lines[i].substring(0, needle.length) === needle) {
288
                 return lines[i];
289
                 return lines[i];
289
             }
290
             }
290
         }
291
         }
295
         // search session part
296
         // search session part
296
         lines = sessionpart.split('\r\n');
297
         lines = sessionpart.split('\r\n');
297
         for (let j = 0; j < lines.length; j++) {
298
         for (let j = 0; j < lines.length; j++) {
298
-            if (lines[j].substring(0, needle.length) == needle) {
299
+            if (lines[j].substring(0, needle.length) === needle) {
299
                 return lines[j];
300
                 return lines[j];
300
             }
301
             }
301
         }
302
         }
307
         const needles = [];
308
         const needles = [];
308
 
309
 
309
         for (let i = 0; i < lines.length; i++) {
310
         for (let i = 0; i < lines.length; i++) {
310
-            if (lines[i].substring(0, needle.length) == needle) {
311
+            if (lines[i].substring(0, needle.length) === needle) {
311
                 needles.push(lines[i]);
312
                 needles.push(lines[i]);
312
             }
313
             }
313
         }
314
         }
318
         // search session part
319
         // search session part
319
         lines = sessionpart.split('\r\n');
320
         lines = sessionpart.split('\r\n');
320
         for (let j = 0; j < lines.length; j++) {
321
         for (let j = 0; j < lines.length; j++) {
321
-            if (lines[j].substring(0, needle.length) == needle) {
322
+            if (lines[j].substring(0, needle.length) === needle) {
322
                 needles.push(lines[j]);
323
                 needles.push(lines[j]);
323
             }
324
             }
324
         }
325
         }
333
         if (line.indexOf('candidate:') === 0) {
334
         if (line.indexOf('candidate:') === 0) {
334
             // eslint-disable-next-line no-param-reassign
335
             // eslint-disable-next-line no-param-reassign
335
             line = `a=${line}`;
336
             line = `a=${line}`;
336
-        } else if (line.substring(0, 12) != 'a=candidate:') {
337
+        } else if (line.substring(0, 12) !== 'a=candidate:') {
337
             logger.log(
338
             logger.log(
338
                 'parseCandidate called with a line that is not a candidate'
339
                 'parseCandidate called with a line that is not a candidate'
339
                     + ' line');
340
                     + ' line');
341
 
342
 
342
             return null;
343
             return null;
343
         }
344
         }
344
-        if (line.substring(line.length - 2) == '\r\n') { // chomp it
345
+        if (line.substring(line.length - 2) === '\r\n') { // chomp it
345
             // eslint-disable-next-line no-param-reassign
346
             // eslint-disable-next-line no-param-reassign
346
             line = line.substring(0, line.length - 2);
347
             line = line.substring(0, line.length - 2);
347
         }
348
         }
348
         const candidate = {};
349
         const candidate = {};
349
         const elems = line.split(' ');
350
         const elems = line.split(' ');
350
 
351
 
351
-        if (elems[6] != 'typ') {
352
+        if (elems[6] !== 'typ') {
352
             logger.log('did not find typ in the right place');
353
             logger.log('did not find typ in the right place');
353
             logger.log(line);
354
             logger.log(line);
354
 
355
 
403
 
404
 
404
         // use tcp candidates for FF
405
         // use tcp candidates for FF
405
 
406
 
406
-        if (RTCBrowserType.isFirefox() && protocol.toLowerCase() == 'ssltcp') {
407
+        if (RTCBrowserType.isFirefox() && protocol.toLowerCase() === 'ssltcp') {
407
             protocol = 'tcp';
408
             protocol = 'tcp';
408
         }
409
         }
409
 
410
 
435
             }
436
             }
436
             break;
437
             break;
437
         }
438
         }
438
-        if (protocol.toLowerCase() == 'tcp') {
439
+        if (protocol.toLowerCase() === 'tcp') {
439
             line += 'tcptype';
440
             line += 'tcptype';
440
             line += ' ';
441
             line += ' ';
441
             line += cand.getAttribute('tcptype');
442
             line += cand.getAttribute('tcptype');

+ 1
- 1
modules/xmpp/SdpTransformUtil.js 查看文件

163
      */
163
      */
164
     getSSRCAttrValue(ssrcNumber, attrName) {
164
     getSSRCAttrValue(ssrcNumber, attrName) {
165
         const attribute = this._ssrcs.find(
165
         const attribute = this._ssrcs.find(
166
-            ssrcObj => ssrcObj.id == ssrcNumber
166
+            ssrcObj => ssrcObj.id === ssrcNumber
167
             && ssrcObj.attribute === attrName);
167
             && ssrcObj.attribute === attrName);
168
 
168
 
169
 
169
 

+ 4
- 5
modules/xmpp/recording.js 查看文件

69
 
69
 
70
     if (newState === 'undefined') {
70
     if (newState === 'undefined') {
71
         this.state = Recording.status.UNAVAILABLE;
71
         this.state = Recording.status.UNAVAILABLE;
72
-    } else if (newState === 'off') {
72
+    } else if (newState === Recording.status.OFF) {
73
         if (!this.state
73
         if (!this.state
74
             || this.state === 'undefined'
74
             || this.state === 'undefined'
75
             || this.state === Recording.status.UNAVAILABLE) {
75
             || this.state === Recording.status.UNAVAILABLE) {
87
 Recording.prototype.setRecordingJibri
87
 Recording.prototype.setRecordingJibri
88
     = function(state, callback, errCallback, options = {}) {
88
     = function(state, callback, errCallback, options = {}) {
89
 
89
 
90
-        if (state == this.state) {
90
+        if (state === this.state) {
91
             errCallback(JitsiRecorderErrors.INVALID_STATE);
91
             errCallback(JitsiRecorderErrors.INVALID_STATE);
92
         }
92
         }
93
 
93
 
123
 
123
 
124
 Recording.prototype.setRecordingJirecon
124
 Recording.prototype.setRecordingJirecon
125
     = function(state, callback, errCallback) {
125
     = function(state, callback, errCallback) {
126
-
127
-        if (state == this.state) {
126
+        if (state === this.state) {
128
             errCallback(new Error('Invalid state!'));
127
             errCallback(new Error('Invalid state!'));
129
         }
128
         }
130
 
129
 
136
                 : Recording.action.STOP,
135
                 : Recording.action.STOP,
137
             mucjid: this.roomjid });
136
             mucjid: this.roomjid });
138
 
137
 
139
-        if (state === 'off') {
138
+        if (state === Recording.status.OFF) {
140
             iq.attrs({ rid: this.jireconRid });
139
             iq.attrs({ rid: this.jireconRid });
141
         }
140
         }
142
 
141
 

+ 5
- 5
modules/xmpp/strophe.jingle.js 查看文件

50
         logger.log(`on jingle ${action} from ${fromJid}`, iq);
50
         logger.log(`on jingle ${action} from ${fromJid}`, iq);
51
         let sess = this.sessions[sid];
51
         let sess = this.sessions[sid];
52
 
52
 
53
-        if (action != 'session-initiate') {
53
+        if (action !== 'session-initiate') {
54
             if (!sess) {
54
             if (!sess) {
55
                 ack.attrs({ type: 'error' });
55
                 ack.attrs({ type: 'error' });
56
                 ack.c('error', { type: 'cancel' })
56
                 ack.c('error', { type: 'cancel' })
68
             }
68
             }
69
 
69
 
70
             // local jid is not checked
70
             // local jid is not checked
71
-            if (fromJid != sess.peerjid) {
71
+            if (fromJid !== sess.peerjid) {
72
                 logger.warn(
72
                 logger.warn(
73
                     'jid mismatch for session id', sid, sess.peerjid, iq);
73
                     'jid mismatch for session id', sid, sess.peerjid, iq);
74
                 ack.attrs({ type: 'error' });
74
                 ack.attrs({ type: 'error' });
188
 
188
 
189
     terminate(sid, reasonCondition, reasonText) {
189
     terminate(sid, reasonCondition, reasonText) {
190
         if (this.sessions.hasOwnProperty(sid)) {
190
         if (this.sessions.hasOwnProperty(sid)) {
191
-            if (this.sessions[sid].state != 'ended') {
191
+            if (this.sessions[sid].state !== 'ended') {
192
                 this.sessions[sid].onTerminated(reasonCondition, reasonText);
192
                 this.sessions[sid].onTerminated(reasonCondition, reasonText);
193
             }
193
             }
194
             delete this.sessions[sid];
194
             delete this.sessions[sid];
255
                         dict.url += el.attr('host');
255
                         dict.url += el.attr('host');
256
                         const port = el.attr('port');
256
                         const port = el.attr('port');
257
 
257
 
258
-                        if (port && port != '3478') {
258
+                        if (port && port !== '3478') {
259
                             dict.url += `:${el.attr('port')}`;
259
                             dict.url += `:${el.attr('port')}`;
260
                         }
260
                         }
261
                         const transport = el.attr('transport');
261
                         const transport = el.attr('transport');
262
 
262
 
263
-                        if (transport && transport != 'udp') {
263
+                        if (transport && transport !== 'udp') {
264
                             dict.url += `?transport=${transport}`;
264
                             dict.url += `?transport=${transport}`;
265
                         }
265
                         }
266
 
266
 

+ 2
- 2
modules/xmpp/xmpp.js 查看文件

20
     // Append token as URL param
20
     // Append token as URL param
21
     if (token) {
21
     if (token) {
22
         // eslint-disable-next-line no-param-reassign
22
         // eslint-disable-next-line no-param-reassign
23
-        bosh += `${bosh.indexOf('?') == -1 ? '?' : '&'}token=${token}`;
23
+        bosh += `${bosh.indexOf('?') === -1 ? '?' : '&'}token=${token}`;
24
     }
24
     }
25
 
25
 
26
     return new Strophe.Connection(bosh);
26
     return new Strophe.Connection(bosh);
374
         if (ev !== null && typeof ev !== 'undefined') {
374
         if (ev !== null && typeof ev !== 'undefined') {
375
             const evType = ev.type;
375
             const evType = ev.type;
376
 
376
 
377
-            if (evType == 'beforeunload' || evType == 'unload') {
377
+            if (evType === 'beforeunload' || evType === 'unload') {
378
                 // XXX Whatever we said above, synchronous sending is the best
378
                 // XXX Whatever we said above, synchronous sending is the best
379
                 // (known) way to properly disconnect from the XMPP server.
379
                 // (known) way to properly disconnect from the XMPP server.
380
                 // Consequently, it may be fine to have the source code and
380
                 // Consequently, it may be fine to have the source code and

正在加载...
取消
保存