fix(MediaScanner.qml): Remove qml M126 warning 32/22532/1 8.99.1 icefish/8.99.1 icefish_8.99.1
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>
Fri, 27 Sep 2019 12:40:58 +0000 (20:40 +0800)
committerLi Xiaoming <lixm.fnst@cn.fujitsu.com>
Fri, 27 Sep 2019 12:40:58 +0000 (20:40 +0800)
Message:
== and != may perform type coercion, use === or !== to avoid it.

Description:
The non-strict equality comparison is allowed to convert its arguments
to a common type. That can lead to unexpected results such as
' \t\r\n' == 0 being true. Use the strict equality operators === and
!== and be explicit about conversions you require.

Bug-AGL: SPEC-2814

Change-Id: If0648d063b64ac2b4265006942b9c69991459836
Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
app/api/MediaScanner.qml

index add261b..8842a18 100644 (file)
@@ -83,10 +83,10 @@ WebSocket {
             case msgid.event:
                 var payload = JSON.parse(JSON.stringify(json[2]))
                 var event = payload.event
-                if (event == "mediascanner/media_added") {
+                if (event === "mediascanner/media_added") {
                     console.debug("Media playlist is updated")
                     root.add(json[2].data.Media)
-                } else if (event == "mediascanner/media_removed") {
+                } else if (event === "mediascanner/media_removed") {
                     root.remove(json[2].data.Path)
                 }
                 break