fixup! [Service] Routing API - tizen.application 88/239288/3 accepted/tizen/unified/20200727.075550 submit/tizen/20200727.002422
authorYoungsoo Choi <kenshin.choi@samsung.com>
Thu, 23 Jul 2020 10:45:34 +0000 (03:45 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Thu, 23 Jul 2020 10:56:08 +0000 (03:56 -0700)
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 <kenshin.choi@samsung.com>
wrt_app/common/service_manager.ts
wrt_app/service/device_api_router.ts

index d414bbd..a4222ab 100644 (file)
@@ -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);
   }
index f040e4c..a64c549 100644 (file)
@@ -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
+}