Revert "[Service] Remove initializeExtensionOnMain" 62/264962/2
authorDongHyun Song <dh81.song@samsung.com>
Wed, 6 Oct 2021 06:25:04 +0000 (06:25 +0000)
committerDongHyun Song <dh81.song@samsung.com>
Wed, 6 Oct 2021 06:34:11 +0000 (06:34 +0000)
This reverts commit 5a7f3b5ebc8533f7545dc1b031a0458e4c317280.

Smack problems are comming without this patch.
"CreateTaskQueue" cannot solve the previous smack issue correctly.

Change-Id: I1d71ca855bb30b6e71634d715c026ddd935d6573

wrt_app/service/service_manager.ts

index 9f8d3e5..8e0c5bb 100644 (file)
@@ -1,5 +1,6 @@
 import { Worker, isMainThread } from 'worker_threads';
 import { wrt } from '../browser/wrt';
+import * as XWalkExtension from '../common/wrt_xwalk_extension';
 
 interface WorkerMap {
   [id: string]: any;
@@ -45,8 +46,19 @@ function terminateWorker(id: string, delay: number) {
   workers[id].postMessage({ type: 'stop', delay });
 }
 
+let initializeExtensionOnMain = () => {
+  initializeExtensionOnMain = () => {};
+  XWalkExtension.initialize();
+  // This is workaround solution to make webapis's singleton worker, which has
+  // same smack label with pid's.
+  // It must be handled ahead of dropThreadPrivilege()
+  // Otherwise, smack violation might hanppen from 'libdbuspolicy'.
+  global.tizen.systeminfo.getPropertyValue("CPU", () => { }, () => { });
+}
+
 export function startService(id: string, filename: string) {
   console.debug(`startService - ${id}`);
+  initializeExtensionOnMain();
   if (global['serviceType'] === 'STANDALONE') {
     let ids = id.split(':');
     let serviceId = ids[0];