win.window undefined after navigation

22 views
Skip to first unread message

Cole Franz

unread,
May 2, 2023, 5:49:58 PM5/2/23
to nw.js
Firstly, my question: Why would win.window ever be undefined if we have an open and visible nw instance? 

There is an open issue for this which one of my coworkers posted a while ago. I've since started a new investigation and have found that it's less general than he had made it sound. I've only been able to reproduce this issue using our application, and thus I felt it was more appropriate to ask an open question here.

Circumstance:
  1. Run nw.Window.open(..) to boot to our login page
  2. Login
  3. After redirection the win.window object is undefined
  4. Returning to the logout screen restores the win.window reference correctly
Additional info:
  • This starts happening on v0.50.0 and is not resolved on any newer version.
  • nw is installed using npm (if that matters)
  • Environments tested
    • Ubuntu 20.04 and Node v18.14.2
    • Ubuntu 18.04 and Node v16.13.2
  • We are using a mixed_context and new_instance environment
  • No CLI arguments are provided, nor chromium args.
  • I can not reproduce this anywhere other than our web app.
Ultimately I'm just looking for any threads to pull on to resolve the issue, so any possible reason that the win.window reference would be undefined would be invaluable to us. Or if you believe it's a bug on your end that's great too, but given the lack of issues in that area I'm inclined to believe it's on us.

Thanks,
Cole

Brian Bothwell

unread,
May 3, 2023, 7:40:40 AM5/3/23
to Cole Franz, nw.js
Nowhere near enough information provided. Suggest you join Discord or Gitter and post some code.

In short win.window is not something "globally" defined. If you need a handle for a window, you call nw.Window.get() or you save the handle somewhere after opening the window. If you're navigating to a new page, you cannot hold it in memory since the entire script will be unloaded when the page changes.

Additionally, new_instance could be causing issues here. No way of knowing without seeing your code.

- Brian



This email and any attachments may contain confidential and/or privileged information. If you are not the intended recipient of this message or their agent, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited.

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nwjs-general/6107c796-8857-4f21-90ce-831ac2bfe7abn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages