From: SangYong Park Date: Fri, 4 Dec 2020 04:55:37 +0000 (+0900) Subject: Using native window open X-Git-Tag: submit/submit/tizen_6.0/20210617.021127/20210617.021112~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1ae3034cbdbdf0c66edffb5827e194cba034a55;p=platform%2Fframework%2Fweb%2Fwrtjs.git Using native window open 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 Signed-off-by: ws29.jung --- diff --git a/wrt_app/browser/wrt_window.ts b/wrt_app/browser/wrt_window.ts index 41c16901..ea414e15 100644 --- a/wrt_app/browser/wrt_window.ts +++ b/wrt_app/browser/wrt_window.ts @@ -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); } diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index 7c392aa5..60d7be2c 100755 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -238,7 +238,8 @@ export class WebApplication { show: false, webPreferences: { nodeIntegration: options.isAddonAvailable, - nodeIntegrationInWorker: false + nodeIntegrationInWorker: false, + nativeWindowOpen: true, }, webContents: WRTWebContents.create(), };