}
export function start(id: string, filename: string) {
+ let ids = id.split(':');
+ let serviceId = ids[0];
+ let packageId = wrt.getPackageId(id);
+ if (!packageId) {
+ console.debug(`${id}'s pkgid is empty, so stop service`);
+ requestStopService(id);
+ return;
+ }
wrt.setServiceAppId(id);
+ wrt.security?.dropThreadPrivilege(packageId, serviceId);
+
XWalkExtension.initialize();
XWalkExtension.setRuntimeMessageHandler((type, data) => {
if (type === 'tizen://exit') {
console.debug(`serviceType : ${global['serviceType']}`)
new DeviceAPIRouter(id, isGlobalService());
-
- // this is workaround solution to make webapis singleton worker
- // ahead of dropThreadPrivilege()
- global.tizen.systeminfo.getPropertyValue("CPU", () => { }, () => { });
+ printAppControlData(id);
// This is for awaking up uv loop.
if (isGlobalService()) {
}
try {
- let ids = id.split(':');
- let serviceId = ids[0];
- let packageId = global.webapis.getPackageId();
- wrt.security?.dropThreadPrivilege(packageId, serviceId);
- printAppControlData(id);
-
app = require(filename);
if (app.onStart !== undefined) {
app.onStart();
if (app.onRequest !== undefined) {
app.onRequest();
}
- if (isGlobalService()) {
- wrt.finishStartingService(id);
- }
} catch (e) {
console.debug(`exception on start: ${e}`);
requestStopService(id);
+ } finally {
+ if (isGlobalService()) {
+ wrt.finishStartingService(id);
+ }
}
}
function run() {
let id = workerData.id;
+ if (!id) {
+ console.debug('workerData.id is empty!');
+ process.exit();
+ }
+
Object.defineProperty(global, 'internalId', {
value: id,
writable: false
});
- // FIXME: this should be 'wrt.tv?.serviceMount(id)' after Tizen 6.5 release
- (wrt.tv as any)?.serviceMount(id);
-
+ wrt.tv?.serviceMount(id);
let filename = workerData.filename;
start(id, filename);
- if (!parentPort)
- return;
- parentPort.on('message', (message) => {
+ parentPort?.on('message', (message) => {
console.debug(`Received message type : ${message.type}`);
if (message.type === 'wake') {
app?.onRequest();
setTimeout(() => {
XWalkExtension.cleanup();
parentPort?.postMessage("will-terminate");
- (wrt.tv as any)?.serviceUmount(id);
+ parentPort?.close();
+ wrt.tv?.serviceUmount(id);
}, message.delay);
}
});