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

Set 'noopener' when opening windows to avoid sharing event loops #6683

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

DanTup
Copy link
Contributor

@DanTup DanTup commented Dec 3, 2019

Prevents the web UI pausing when an app opened with window.open is paused in the browsers debugger.

Fixes #5857.

Note: I'm not sure how to test this from source. I tested it on GitPod by replacing window.open with a wrapper using the dev tools like this:

var oldWO = window.open; window.open = function(url) {console.log(url); oldWO(url, undefined, 'noopener');}

This resolved the issue of the GitPod UI hanging when my web app stopped at a breakpoint. If this is something I should be able to test locally, please provide some pointers (and ofc, I'm happy to re-test on staging once it gets there).

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanTup thank you, it is very good change!

I will merge if the build is green and there is no objections, i.e. someone actually expect an instance of Window.

@akosyakov akosyakov added the core issues related to the core of the application label Dec 3, 2019
@kittaakos
Copy link
Contributor

@DanTup, please update the changelog, it is a breaking change. Thank you!

@kittaakos
Copy link
Contributor

The electron implementation does not return with the new BrowserWindow instance either. Can we change the API to void if we break it anyway?

@DanTup
Copy link
Contributor Author

DanTup commented Dec 3, 2019

I'm not sure how best to describe this in the changelog, since I'm not really sure how this is exposed. Is something like this correct?

  • [core] new browser windows spawned through opener-service have noopener set, preventing them from accessing window.opener and giveing them their own event loop. openNewWindow will no longer return a Window as a result.

@kittaakos
Copy link
Contributor

Is something like this correct?

Perfect, we just need some info to trace back who did the breaking change ;)

@vince-fugnitto
Copy link
Member

@DanTup in general we ask that every commit be signed-off (recent reason for the failed ECA check).
It is enough to squash the commits and preserve your initial commit message :)

@DanTup
Copy link
Contributor Author

DanTup commented Dec 3, 2019

Heh, I was just checking why that went red. I'll fix!

Prevents the web UI pausing when an app opened with window.open is paused in the browsers debugger.

Fixes eclipse-theia#5857.

Signed-off-by: Danny Tuppeny <danny@tuppeny.com>
@kittaakos
Copy link
Contributor

I propose

  • leaving the API as : Window | undefined so that subclasses can override the behavior if they want to. If you leave as is, no changelog modification is required.
  • Or switching to : void return value.

The former approach feels the more flexible one, but : undefined does not make much sense to me.

@DanTup
Copy link
Contributor Author

DanTup commented Dec 3, 2019

I thought leaving Window might be misleading to include it but always return undefined, but I didn't consider others overriding it. I'm happy to change either way, just let me know what your preferences.

@kittaakos kittaakos self-requested a review December 3, 2019 16:21
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, none of the downstream projects expect a Window object, looks good to me 👍

Thank you for your contribution, @DanTup

@DanTup
Copy link
Contributor Author

DanTup commented Dec 3, 2019

No problem! I'm not sure if you want anything changing or if it's ok as-is. Feel free to change after merging if that's easier than going back and forth. My need is only the noopener part to free us from sharing a thread :-)

@kittaakos kittaakos merged commit a551e6d into eclipse-theia:master Dec 3, 2019
@DanTup DanTup deleted the noopener branch December 3, 2019 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core issues related to the core of the application
Projects
None yet
Development

Successfully merging this pull request may close these issues.

don't share event loop between windows when possible
5 participants