From: Youngsoo Choi Date: Thu, 23 Jul 2020 10:45:34 +0000 (-0700) Subject: fixup! [Service] Routing API - tizen.application X-Git-Tag: accepted/tizen/unified/20200727.075550^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F88%2F239288%2F3;p=platform%2Fframework%2Fweb%2Fwrtjs.git fixup! [Service] Routing API - tizen.application This resovles folloinwg error on public target: TypeError: Cannot read property 'getServiceId' of undefined The public profile has the webapis in sandbox, not in global. Change-Id: I99a2eb4ff373bf8103c0ef9e6392f96e7f6ffb09 Signed-off-by: Youngsoo Choi --- diff --git a/wrt_app/common/service_manager.ts b/wrt_app/common/service_manager.ts index d414bbd..a4222ab 100644 --- a/wrt_app/common/service_manager.ts +++ b/wrt_app/common/service_manager.ts @@ -111,7 +111,7 @@ export function startService(id: string, filename?: string) { } code = `const app = require('${filename}')`; if (service_type === 'DAEMON') { - internal_handler[id].deivce_api_router = new DeviceAPIRouter(); + internal_handler[id].deivce_api_router = new DeviceAPIRouter(sandbox[id]); } vm.runInNewContext(code, sandbox[id], options); } diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index f040e4c..a64c549 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -2,6 +2,7 @@ import { wrt } from '../browser/wrt'; export class DeviceAPIRouter { currentApplication: any; + sandbox: any; funcCurrentApplication: any; funcRequestedAppcontrol: any; funcGetAppInfo: any; @@ -11,18 +12,19 @@ export class DeviceAPIRouter { funcGetPackageInfo: any; funcPathResolve: any; - constructor() { + constructor(sandbox: any) { + this.sandbox = sandbox; this.RefineApplicationApis(); this.RefinePackageApis(); this.RefineFilesystemApis() } GetServiceId() { - return global.webapis.getServiceId(); + return this.sandbox.webapis.getServiceId(); } GetPackageId() { - return global.webapis.getPackageId(); + return this.sandbox.webapis.getPackageId(); } RefineApplicationApis() { @@ -99,4 +101,4 @@ export class DeviceAPIRouter { this.funcPathResolve(location, onSuccess, onError, mode ?? 'rw'); } } -} \ No newline at end of file +}