From: k2.nagaraju Date: Thu, 20 Aug 2020 10:56:48 +0000 (+0530) Subject: [Service] TypeMismatchError causing because of passing undefined as parameter. X-Git-Tag: accepted/tizen/unified/20200826.133035~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=487d46a0dcd023edbdf8b69262569caa657e9403;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Service] TypeMismatchError causing because of passing undefined as parameter. systeminfo tizen web api as optional parameters, for optional parameters passing |undefined| causing this error. Added code for handling these scenarios. https://www.tizen.org/tv/web_device_api/systeminfo Change-Id: I2c156c2b2ab06e71cc00db45891e48d0b6beec9a Signed-off-by: k2.nagaraju --- diff --git a/wrt_app/service/access_control_manager.ts b/wrt_app/service/access_control_manager.ts index 4517cbe..0a00ac5 100644 --- a/wrt_app/service/access_control_manager.ts +++ b/wrt_app/service/access_control_manager.ts @@ -2,12 +2,12 @@ import * as vm from 'vm'; function checkSystemInfoApiPrivilege(func: any, permissions: string[]) { let override_func = func; - return (type: string, onSuccess: any, onError: any) => { - if (type === "CELLULAR_NETWORK" && !permissions.includes("http://tizen.org/privilege/telephony")) { + return (...args: any[]) => { + if (args[0] === "CELLULAR_NETWORK" && !permissions.includes("http://tizen.org/privilege/telephony")) { console.log('The telephony permission is missing.'); return ; } - override_func.call(global.tizen.systeminfo, type, onSuccess, onError); + override_func.call(global.tizen.systeminfo, ...args); } }