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

Support port mapped iframes in iframe based webviews #75854

Closed
mjbvz opened this issue Jun 20, 2019 · 2 comments
Closed

Support port mapped iframes in iframe based webviews #75854

mjbvz opened this issue Jun 20, 2019 · 2 comments
Assignees
Labels
api *duplicate Issue identified as a duplicate of another issue(s) web Issues related to running VSCode in the web webview Webview issues
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Jun 20, 2019

Problem

Webview port mapping lets extension serve up iframe content from remote resources:

<iframe src="http://localhost:3000"></iframe>

If the extension is running remotely, then port 3000 referes to a port on the remote machine. In this case, we:

  1. Intercept the request to http://localhost:3000
  2. Open a tunnel to port 3000 on the remote machine
  3. Redirect http://localhost:3000 to the tunnel

This is all possible because electron gives us control over web requests inside of <webview> tags. However, as we move to iframe based webviews for the web, we need a new approach

@mjbvz mjbvz added the web Issues related to running VSCode in the web label Jun 20, 2019
@mjbvz mjbvz self-assigned this Jun 20, 2019
@mjbvz mjbvz added this to the On Deck milestone Jun 20, 2019
@mjbvz mjbvz added the api label Jun 20, 2019
@mjbvz
Copy link
Collaborator Author

mjbvz commented Jun 20, 2019

My first thought here was to use a service worker to intercept the request for the iframe source. This is how we handle loading of workspace/extension resources inside of iframe based webviews, and I also used a service worker to implement basic port mapping: 29c0595

This however does not work as the iframe is treated more like a unique browser page (so any service worker we register outside the iframe will not see requests for the src or any content inside of the iframe)

@mjbvz mjbvz added the webview Webview issues label Aug 15, 2019
@mjbvz
Copy link
Collaborator Author

mjbvz commented Sep 19, 2019

This is essentially covered by #81131 which allows an extension to resolve the url of any localhost iframes it creates

@mjbvz mjbvz closed this as completed Sep 19, 2019
@mjbvz mjbvz added the *duplicate Issue identified as a duplicate of another issue(s) label Sep 19, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api *duplicate Issue identified as a duplicate of another issue(s) web Issues related to running VSCode in the web webview Webview issues
Projects
None yet
Development

No branches or pull requests

1 participant