Bläddra i källkod

fix(eslint): Add eqeqeq rule

dev1
hristoterezov 8 år sedan
förälder
incheckning
e5472b9aca

+ 1
- 0
.eslintrc.js Visa fil

@@ -76,6 +76,7 @@ module.exports = {
76 76
         'default-case': 0,
77 77
         'dot-location': [ 'error', 'property' ],
78 78
         'dot-notation': 2,
79
+        'eqeqeq': 2,
79 80
         'guard-for-in': 2,
80 81
         'no-alert': 2,
81 82
         'no-caller': 2,

+ 3
- 3
JitsiConferenceEventManager.js Visa fil

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

+ 2
- 2
doc/example/example.js Visa fil

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

+ 1
- 1
modules/RTC/DataChannels.js Visa fil

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

+ 11
- 2
modules/RTC/RTC.js Visa fil

@@ -486,8 +486,8 @@ export default class RTC extends Listenable {
486 486
                     const mediaTrack = endpointTracks[mediaType];
487 487
 
488 488
                     if (mediaTrack
489
-                        && mediaTrack.getStreamId() == streamId
490
-                        && mediaTrack.getTrackId() == trackId) {
489
+                        && mediaTrack.getStreamId() === streamId
490
+                        && mediaTrack.getTrackId() === trackId) {
491 491
                         result = mediaTrack;
492 492
 
493 493
                         return true;
@@ -680,7 +680,12 @@ export default class RTC extends Listenable {
680 680
      * @param ssrc the ssrc to check.
681 681
      */
682 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 686
         if (this.getLocalTracks().find(
687
+
688
+            // eslint-disable-next-line eqeqeq
684 689
                 localTrack => localTrack.getSSRC() == ssrc)) {
685 690
             return this.conference.myUserId();
686 691
         }
@@ -699,6 +704,10 @@ export default class RTC extends Listenable {
699 704
      * matches given SSRC or <tt>undefined</tt> if no such track was found.
700 705
      */
701 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 711
         return this.getRemoteTracks().find(t => ssrc == t.getSSRC());
703 712
     }
704 713
 

+ 1
- 1
modules/RTC/RTCBrowserType.js Visa fil

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

+ 2
- 2
modules/RTC/RTCUtils.js Visa fil

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

+ 1
- 1
modules/RTC/ScreenObtainer.js Visa fil

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

+ 1
- 1
modules/RTC/TraceablePeerConnection.js Visa fil

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

+ 1
- 1
modules/connectivity/ConnectionQuality.js Visa fil

@@ -92,7 +92,7 @@ function getTarget(simulcast, resolution, millisSinceStart) {
92 92
                 const targetHeight = height;
93 93
 
94 94
                 simulcastFormat
95
-                    = kSimulcastFormats.find(f => f.height == targetHeight);
95
+                    = kSimulcastFormats.find(f => f.height === targetHeight);
96 96
                 if (simulcastFormat) {
97 97
                     target += simulcastFormat.target;
98 98
                 } else {

+ 1
- 2
modules/settings/Settings.js Visa fil

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

+ 1
- 1
modules/statistics/LocalStatsCollector.js Visa fil

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

+ 12
- 10
modules/statistics/RTPStatsCollector.js Visa fil

@@ -259,7 +259,7 @@ StatsCollector.prototype.start = function(startAudioLevelStats) {
259 259
                         let results = null;
260 260
 
261 261
                         if (!report || !report.result
262
-                            || typeof report.result != 'function') {
262
+                            || typeof report.result !== 'function') {
263 263
                             results = report;
264 264
                         } else {
265 265
                             results = report.result();
@@ -285,7 +285,7 @@ StatsCollector.prototype.start = function(startAudioLevelStats) {
285 285
                         let results = null;
286 286
 
287 287
                         if (!report || !report.result
288
-                            || typeof report.result != 'function') {
288
+                            || typeof report.result !== 'function') {
289 289
                             // firefox
290 290
                             results = report;
291 291
                         } else {
@@ -429,7 +429,7 @@ StatsCollector.prototype.processStatsReport = function() {
429 429
             }
430 430
         } catch (e) { /* not supported*/ }
431 431
 
432
-        if (now.type == 'googCandidatePair') {
432
+        if (now.type === 'googCandidatePair') {
433 433
             let active, ip, localip, type;
434 434
 
435 435
             try {
@@ -438,7 +438,7 @@ StatsCollector.prototype.processStatsReport = function() {
438 438
                 localip = getStatValue(now, 'localAddress');
439 439
                 active = getStatValue(now, 'activeConnection');
440 440
             } catch (e) { /* not supported*/ }
441
-            if (!ip || !type || !localip || active != 'true') {
441
+            if (!ip || !type || !localip || active !== 'true') {
442 442
                 continue;
443 443
             }
444 444
 
@@ -447,7 +447,9 @@ StatsCollector.prototype.processStatsReport = function() {
447 447
 
448 448
             if (!conferenceStatsTransport.some(
449 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 453
                 conferenceStatsTransport.push({ ip,
452 454
                     type,
453 455
                     localip });
@@ -455,8 +457,8 @@ StatsCollector.prototype.processStatsReport = function() {
455 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 462
                 continue;
461 463
             }
462 464
 
@@ -470,8 +472,8 @@ StatsCollector.prototype.processStatsReport = function() {
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 477
             continue;
476 478
         }
477 479
 
@@ -655,7 +657,7 @@ StatsCollector.prototype.processAudioLevelReport = function() {
655 657
 
656 658
         const now = this.currentAudioLevelsReport[idx];
657 659
 
658
-        if (now.type != 'ssrc') {
660
+        if (now.type !== 'ssrc') {
659 661
             continue;
660 662
         }
661 663
 

+ 6
- 6
modules/xmpp/ChatRoom.js Visa fil

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

+ 7
- 7
modules/xmpp/JingleSessionPC.js Visa fil

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

+ 9
- 9
modules/xmpp/SDP.js Visa fil

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

+ 4
- 4
modules/xmpp/SDPDiffer.js Visa fil

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

+ 13
- 12
modules/xmpp/SDPUtil.js Visa fil

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

+ 1
- 1
modules/xmpp/SdpTransformUtil.js Visa fil

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

+ 4
- 5
modules/xmpp/recording.js Visa fil

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

+ 5
- 5
modules/xmpp/strophe.jingle.js Visa fil

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

+ 2
- 2
modules/xmpp/xmpp.js Visa fil

@@ -20,7 +20,7 @@ function createConnection(token, bosh = '/http-bind') {
20 20
     // Append token as URL param
21 21
     if (token) {
22 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 26
     return new Strophe.Connection(bosh);
@@ -374,7 +374,7 @@ export default class XMPP extends Listenable {
374 374
         if (ev !== null && typeof ev !== 'undefined') {
375 375
             const evType = ev.type;
376 376
 
377
-            if (evType == 'beforeunload' || evType == 'unload') {
377
+            if (evType === 'beforeunload' || evType === 'unload') {
378 378
                 // XXX Whatever we said above, synchronous sending is the best
379 379
                 // (known) way to properly disconnect from the XMPP server.
380 380
                 // Consequently, it may be fine to have the source code and

Laddar…
Avbryt
Spara