Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capturePage captures wrong window (NW2) #7592

Closed
DjulLau opened this issue Oct 15, 2020 · 2 comments
Closed

capturePage captures wrong window (NW2) #7592

DjulLau opened this issue Oct 15, 2020 · 2 comments

Comments

@DjulLau
Copy link

DjulLau commented Oct 15, 2020

NWJS Version : 0.49.0
Operating System : Windows 10

I recently tried upgrading my app from v0.28 to v0.49.
In this app I open a second window behind the main window to do some capture.

Expected behavior

capturePage should capture content of the window it's called from.

Actual behavior

capturePage captures content from the main window even it's called from the new one.
It works as before if NW2 is disabled with --disable-features=nw2

How to reproduce

Have two html files:

  • index.html with color1 bg
  • new.html with color2 bg
  • index.html script
    require("nw.gui").Window.open("new.html", {}, (wnd) => {
        wnd.on("loaded", (e) => {
            wnd.capturePage(buffer => {
                require('fs').writeFile('screenshot.png', buffer, (err) => {
                    if (err) throw err;
                });
            }, { format: 'png', datatype: 'buffer' });
        });
    });
  • Open screenshot.png and see it's color1
  • Add "chromium-args": "--disable-features=nw2"
  • Run again
  • Open sceenshot.png and see it's color2
@DjulLau DjulLau changed the title capturePage capture wrong window (NW2) capturePage captures wrong window (NW2) Oct 15, 2020
@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rogerwang
Copy link
Member

CC #7230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants