tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
3k stars 252 forks source link

Fix blank popup window bug on Firefox #1610

Closed mtlynch closed 1 year ago

mtlynch commented 1 year ago

Resolves #1609

There's a bug that affects (at least) Firefox on Win10 where if the user tries View > Dedicated Window, the window comes up blank and the JS console has errors about "can't access dead object".

The issue seems like a bug in Firefox. What seems to be happening is that the popup is trying to share resources with the main window, but the browser's garbage seems to not be aware of the additional reference. So the popup starts loading, we redirect the original window, which causes the browser to tear down its resources, and then the popup continues loading, but the shared resources it was trying to access have been garbage collected in redirecting the original window.

Adding noopener seems to fix the issue, as it prevents the two windows from sharing resources:

noopener

If this feature is set, the new window will not have access to the originating window via Window.opener and returns null.

When noopener is used, non-empty target names, other than _top, _self, and _parent, are treated like _blank in terms of deciding whether to open a new browsing context.

https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters

mtlynch commented 1 year ago
Automated comment from CodeApprove ➜

⏳ @jdeanwallace please review this Pull Request