Using native window open 79/258679/1
authorSangYong Park <sy302.park@samsung.com>
Fri, 4 Dec 2020 04:55:37 +0000 (13:55 +0900)
committerws29.jung <ws29.jung@samsung.com>
Mon, 24 May 2021 07:03:58 +0000 (16:03 +0900)
window.open uses electron js logic when renderer was integrated with node.
(node is integrated in renderer when addon is enabled. and default webapp
do not use node in renderer side.). It has some compatibility issue.
so, use native window open always.

Cherry picked from latest tizen branch wrtjs for backward compatibility.
https://review.tizen.org/gerrit/#/c/platform/framework/web/wrtjs/+/248995/

Change-Id: I8d786b2d9d1ba97796217f0b2cb2371e89b80479
Signed-off-by: SangYong Park <sy302.park@samsung.com>
Signed-off-by: ws29.jung <ws29.jung@samsung.com>
wrt_app/browser/wrt_window.ts
wrt_app/src/web_application.ts

index 41c16901d144cb10d285208aa3f84eb9b3f33934..ea414e15e6dd04e90ed5945a3c83a307345e7ee6 100644 (file)
@@ -26,14 +26,13 @@ WRTWindow.prototype._init = function () {
   if (typeof this.setup === 'function')
     this.setup();
   this.constructor = BrowserWindow;
-  let self = this;
   this.webContents.on('new-window', (event: Electron.NewWindowWebContentsEvent,
                                      url: string,
                                      frameName: string,
                                      disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
                                      options: any) => {
     event.preventDefault();
-    if (!options.webContents || options.webContents === self) {
+    if (!options.webContents) {
       options.webContents = WRTWebContents.create();
       options.webContents.loadURL(url);
     }
index 7c392aa5116effc5c6df77b352c4d140d481c37b..60d7be2cce238932085572635c7cdee15d290233 100755 (executable)
@@ -238,7 +238,8 @@ export class WebApplication {
       show: false,
       webPreferences: {
         nodeIntegration: options.isAddonAvailable,
-        nodeIntegrationInWorker: false
+        nodeIntegrationInWorker: false,
+        nativeWindowOpen: true,
       },
       webContents: WRTWebContents.create(),
     };