[Common] Disabled error log in case of Power special message 28/177328/1
authorPiotr Kosko <p.kosko@samsung.com>
Fri, 27 Apr 2018 06:18:39 +0000 (08:18 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Fri, 27 Apr 2018 06:29:44 +0000 (08:29 +0200)
[Verification] Code compiles without errors.
  Below code works without any JS errors (special Power
    chromium message is ignored):
  tizen.power.request("SCREEN", "SCREEN_NORMAL");
  tizen.power.release("SCREEN");

  TCT passrate for Power module is 100% (A & M).

Change-Id: I2b2cf3d97442389b722db8a9943e5c98f1a0d0cf
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/utils/utils_api.js

index c6f0c6dc7b7863cda25e5929b821db4193cc15a6..90f7a5c8c0970e6b520c34903bf57f4c804dd8e3 100644 (file)
@@ -1029,7 +1029,18 @@ var NativeManager = function(extension) {
     try {
       var msg = JSON_.parse(json);
     } catch (error) {
+      // Because of special handling of power lock in chromium, the special signals:
+      // - __DisableChromiumInternalPowerLock
+      // - __EnableChromiumInternalPowerLock
+      // could occur. In such cases we are silently ignroing those messages.
+      // TODO This is workaround for missing patch in chromium-efl package which should handle
+      // this special message and don't forward it to webapi JS. After chromium-efl will
+      // be updated, below checking should be removed.
+      if (json.substring(0,2) === '__') {
+        return;
+      }
       xwalk.utils.error('Invalid JSON received: ' + json);
+      return;
     }
     var id;