From: Rafal Walczyna Date: Wed, 9 Sep 2020 09:44:46 +0000 (+0200) Subject: [Utils] Change Utils.prototype.assert method to more generic X-Git-Tag: submit/tizen/20200911.055107~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F243722%2F1;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Utils] Change Utils.prototype.assert method to more generic Starfish engine, which is used in WebWidgets, does not support console.assert [Verification] WebWidgetTCT runs succesfully Change-Id: I6286537c6bc8995b5fd3c0a60f22b2d2595ed787 Signed-off-by: Rafal Walczyna --- diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 8108e7c5..2ff6b09c 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -212,7 +212,15 @@ function Utils() { Utils.prototype.error = console.error.bind(console); Utils.prototype.warn = console.warn.bind(console); Utils.prototype.log = _enableJsLogs ? console.log.bind(console) : function() {}; -Utils.prototype.assert = console.assert.bind(console); +if (console.assert) { + Utils.prototype.assert = console.assert.bind(console); +} else { + Utils.prototype.assert = function() { + if (false === arguments[0]) { + console.error("Assertion failed: ", Array.prototype.slice.call(arguments, 1)); + } + } +} Utils.prototype.global = _global;