fixup! [WRT Service] Provide sandbox context per servcie app and support legacy APIs 71/212971/1
authorYoungsoo Choi <kenshin.choi@samsung.com>
Thu, 29 Aug 2019 03:24:18 +0000 (20:24 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Thu, 29 Aug 2019 03:29:52 +0000 (20:29 -0700)
This calls client process termination after loading each service app.

Change-Id: Ida5ff3044e233f6d135acf3e7fdd958e58b705b5
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
wrt_app/service/main.js

index 9b1edad..782fd2e 100755 (executable)
@@ -30,6 +30,10 @@ wrt.on('start-service', (event, app_id) => {
     };
     let options = { filename: app_id };
     vm.runInNewContext(wrt.readService(app_id), sandbox[app_id], options);
+
+    if (!wrt.terminateClient(app_id)) {
+      console.log('Failed to terminate client process');
+    }
   }
   if (sandbox[app_id]['started'] === undefined) {
     sandbox[app_id]['started'] = true;
@@ -38,9 +42,6 @@ wrt.on('start-service', (event, app_id) => {
   }
   const request_callback_string = 'if (module.exports.onRequest !== undefined) { module.exports.onRequest(); }';
   vm.runInContext(request_callback_string, sandbox[app_id]);
-  if (!wrt.terminateClient(app_id)) {
-    console.log('Failed to terminate client process');
-  }
 })
 
 process.on('exit', (code) => {