nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

NW.js window object returning incorrect DOM window object with new_instance / mixed_context options on

Open nicolasgarfinkiel opened this issue 3 years ago • 1 comments

Issue Type

  • [x] Bug Report
  • [x] Successfully reproduced against the latest version of NW.js?

Current/Missing Behavior

Consider the following snippet:

nw.Window.open('https://www.google.com', {
//    new_instance: true,
//    mixed_context: true
}, (win) => {
    chrome.developerPrivate.openDevTools({
        renderViewId: -1,
        renderProcessId: -1,
        extensionId: chrome.runtime.id
    });
    console.log(win.window.location.href);
});

console.log outputs: https://www.google.com

On the other hand, this snippet:

nw.Window.open('https://www.google.com', {
    new_instance: true,
    mixed_context: true
}, (win) => {
    chrome.developerPrivate.openDevTools({
        renderViewId: -1,
        renderProcessId: -1,
        extensionId: chrome.runtime.id
    });
    console.log(win.window.location.href);
});

console.log outputs: chrome-extension://angoeahjodghadolndhmaahccpfijbnc/_generated_background_page.html

Expected/Proposed Behavior

Both console.log outputs should be https://www.google.com.

Additional Info

From what I could gather, mainFrameId in win.cWindow.tab[0] is wrong (it always points to 1).

  • Operating System: macOS, Linux
  • NW.js Version: 0.67.1

nicolasgarfinkiel avatar Aug 18 '22 07:08 nicolasgarfinkiel

Hello guys, any comments on this issue: it's a bit pressing for us and we can even discuss a bounty. Thanks.

nicolasgarfinkiel avatar Sep 12 '22 08:09 nicolasgarfinkiel

It works for me with latest v0.73.0

rogerwang avatar Feb 18 '23 19:02 rogerwang