Skip to content

Conversation

@HolgerJeromin
Copy link
Contributor

@HolgerJeromin HolgerJeromin commented Jul 2, 2025

The webview (or its acquireVsCodeApi injector)
adds the vscode api but also deletes the properties window.parent, window.top and window.frameElement.

This voilates the HTML Spec and makes problems with some code like if (window.parent === window) to
detect if we are running in an iframe.

Yes, this affects Hyrum's Law and https://xkcd.com/1172/ but detecting acquireVsCodeApi object itself feels to be cleaner anyway.

The webview (or its  `acquireVsCodeApi` injector)
adds the vscode api but also deletes the properties
`window.parent`, `window.top` and `window.frameElement`.

This voilates the HTML Spec and makes problems with
some code like `if (window.parent === window)` to
detect if we are running in an iframe.

Yes, this affects Hyrum's Law and https://xkcd.com/1172/
but detecting `acquireVsCodeApi` object itself feels to be cleaner anyway.
@mjbvz mjbvz modified the milestones: June 2025, July 2025 Jul 8, 2025
@mjbvz mjbvz enabled auto-merge July 8, 2025 21:16
@HolgerJeromin
Copy link
Contributor Author

Thanks for helping with the hash.

@mjbvz mjbvz merged commit d5ae7bb into microsoft:main Jul 10, 2025
17 checks passed
@HolgerJeromin HolgerJeromin deleted the webviewCompatibility branch July 10, 2025 11:56
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants