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

Setting window.opener to null only works in browsers #628

Closed
alexdima opened this issue Nov 14, 2017 · 5 comments
Closed

Setting window.opener to null only works in browsers #628

alexdima opened this issue Nov 14, 2017 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Milestone

Comments

@alexdima
Copy link
Member

Extracted from #601 (comment)
From @hawkerm

Regarding #601


I'm running Monaco in a x-ms-webview, so 10.1.0 broke that as I wouldn't get the uri in the new window request anymore (only about:blank).

Saw there were some updates for this code path in the vscode tree to detect if it was a 'native' platform. Not sure if that'll detect the x-ms-webview case as well, but want to make sure this scenario can be covered too.

@alexdima alexdima self-assigned this Nov 14, 2017
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Nov 14, 2017
@alexdima alexdima added this to the On Deck milestone Nov 14, 2017
@alexdima alexdima modified the milestones: On Deck, February 2018 Feb 28, 2018
@alexdima
Copy link
Member Author

I'm not sure how to detect running in an x-ms-webview...

@alexdima alexdima added the info-needed Issue requires more information from poster label Mar 13, 2018
@alexdima alexdima modified the milestones: February 2018, On Deck Mar 13, 2018
@hawkerm
Copy link

hawkerm commented Apr 18, 2018

@alexandrudima would it make sense to provide a setting that can turn this behavior off and make the original call to window.open?

Here's the line in vs code, but they have a flag platform.isNative, but I'm not sure how/where that's set.

@alexdima
Copy link
Member Author

@hawkerm Is there any way at runtime for us to detect this special case? For example, this is how we detect the isNative case:

https://github.com/Microsoft/vscode/blob/52007064712fb8e74e8b7dd00903beaabcd79648/src/vs/base/common/platform.ts#L45

if (typeof process === 'object' && typeof process.nextTick === 'function' && typeof process.platform === 'string')

Perhaps there is a way for us to detect running under an x-ms-webview ?

@hawkerm
Copy link

hawkerm commented Apr 21, 2018

@alexandrudima how about just looking at the user agent string? It has WebView in the platform:

Mozilla/5.0 (Windows NT 10.0; WOW64; WebView/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299

Compared to the browser in Edge:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299

The Windows WebView has an event for opening new windows which requires the developer using the webview to decide what to do with the requested new window. It doesn't pass a reference or have any context from the requesting page, so its not susceptible to the opener issue.

@alexdima alexdima modified the milestones: On Deck, March Recovery 2018, April 2018 Apr 23, 2018
@hawkerm
Copy link

hawkerm commented Apr 28, 2018

Awesome, thanks for working towards a solution!

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants