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

Window opened with new_instance creates always mixed context #7344

Closed
gpetrov opened this issue Jan 25, 2020 · 3 comments
Closed

Window opened with new_instance creates always mixed context #7344

gpetrov opened this issue Jan 25, 2020 · 3 comments
Assignees

Comments

@gpetrov
Copy link

gpetrov commented Jan 25, 2020

NWJS Version : 0.43.6
Operating System : Windows 10

Expected behavior

When new window is opened with window.open and new_instance, it should open just as normal window.open as browser window context.

Actual behavior

However when opened with new_instance, the global variable "module" is defined and this indicates CommonJS environtment. So this results that jQuery for example can not be loaded as script include as it detects commonJS environment.

How to reproduce

Use the this test case:
test_popup_window.zip

You will see that when the same popup is open regularly - the module is underfined and jquery can load fine, but when opened with new_instance - module is defined and jquery fails to load.

I hope that is not by design @rogerwang ? Or is there an extra option to choose the type of browser context?

@gpetrov
Copy link
Author

gpetrov commented Jan 27, 2020

After further reading of http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/

Seems that the new_instance creates a new window always in mixed context mode!
But shouldn't that respect the main mixed context option @rogerwang ?

As our main window have separate browser and node context, we would like with new_instance to create just a new window with new separate browser and node contexts - not suddenly switch to mixed context!

Can this be done or do we need a new option to create new_instances in separate context mode?

@gpetrov gpetrov changed the title Window opened with new_instance creates commonJS context Window opened with new_instance creates always mixed context Jan 27, 2020
@rogerwang rogerwang self-assigned this Jun 21, 2020
@rogerwang
Copy link
Member

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

@chatcan
Copy link

chatcan commented Sep 3, 2020

if open a new_intance window that is a seperate context , how could i inspect the new created node context?

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

3 participants