From: liwei Date: Thu, 1 Sep 2022 05:36:43 +0000 (+0800) Subject: Stop Inspector when all windows are closed X-Git-Tag: submit/tizen/20220923.160021^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=808bcf8f8b5f2ec7f4dd49345647e9f0641de1c1;p=platform%2Fframework%2Fweb%2Fwrtjs.git Stop Inspector when all windows are closed Some apps(ex. hulu) will call window.close() when terminate, it will cause 'before-quit' invoked after 'window-all-closed'. In current logic, WRT stop inspector when receive 'before-quit' event, but at this case, any wrt api cannot be called successfully(I think it's related with window is closed firstly), so stop inspector in 'window-all-closed' event, then RWI cannot stopped properly and RWI port will be released normally Change-Id: I8d3d46973cc1536bf6818c346d7c3ef43ed4be0a Signed-off-by: liwei --- diff --git a/wrt_app/src/runtime.ts b/wrt_app/src/runtime.ts index 6bc933a..c1a2e8e 100644 --- a/wrt_app/src/runtime.ts +++ b/wrt_app/src/runtime.ts @@ -49,6 +49,7 @@ class Runtime { app.on('window-all-closed', () => { console.log('window-all-closed'); + this.webApplication?.stopInspector(); app.quit(); }); diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index c7d497a..eef640b 100644 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -302,6 +302,14 @@ export class WebApplication { } } + stopInspector() { + if (this.debugPort) { + console.log('stop inspector server'); + this.debugPort = 0; + wrt.stopInspectorServer(); + } + } + loadUrl(appControl: NativeWRTjs.AppControl) { this.contentSrc = appControl.getLoadInfo().getSrc(); this.launchInspectorIfNeeded(appControl); @@ -361,11 +369,7 @@ export class WebApplication { console.log('WebApplication : beforeQuit'); this.profileDelegate.beforeQuit(); addonManager.emit('lcQuit', this.mainWindow.id); - if (this.debugPort) { - console.log('stop inspector server'); - this.debugPort = 0; - wrt.stopInspectorServer(); - } + this.stopInspector(); this.inQuit = true; }