-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
'webview.getWebContents()' is deprecated and will be removed #95955
Comments
Looks like https://www.electronjs.org/docs/breaking-changes#deprecated-webviewgetwebcontents outlines a solution without |
@bpasero @deepak1556 We use the web contents in a few different ways:
Moving all of these to use ipc will be difficult. There may be some other electron APIs that can help us here though This doesn't block updating electron 8 though, correct? |
This doesn't block electron 8 but will block electron 9 exploration.
Can you expand on this ? Whatever method is being used on Also caching the webContents on the renderer side is not a good idea as there is no clear signal for the destruction path, which can lead to issues like #96207 . Handling the |
@deepak1556 does it make sense to push this any further given we already know that Can you maybe clarify what the exact conditions are, because I thought about enabling preload+contextIsolation this month, but maybe we cannot do that until we are off |
@bpasero we need a bit of planning here on how to tackle this over the next few iterations.
But the usage has not been blocked in electron master yet and it will most likely happen with electron v12 which gives us time to transition to OOPIF based implementation. Given the above we can start the work for preload+contextIsolation in this iteration and in parallel start exploring the transition to OOPIF which will atleast take one or two iterations. In this iteration, I am exploring #96307 which is one of the blocker for iframe transition. And the actual work to transition can happen in June or July depending on @mjbvz availability. And to answer the main question of fixing the usage of Just to reiterate the transition to OOPIF will not block adopting preload+contextIsolation work, so please go ahead with it :) |
Part of microsoft#95955 Switches from calling `setIgnoreMenuShortcuts` on the renderer to calling it on the main thread
Part of #95955 Switches from calling `setIgnoreMenuShortcuts` on the renderer to calling it on the main thread
Part of #95955 Switches from calling `setIgnoreMenuShortcuts` on the renderer to calling it on the main thread
* Move webview's use of setIgnoreMenuShortcuts to main processes Part of #95955 Switches from calling `setIgnoreMenuShortcuts` on the renderer to calling it on the main thread * Use channels for communication instead of ipc * Cleanup ipc implementation * Rename webviewMainService -> WebviewManagerService
I quickly explored two other approaches for serving up the content for the webview (the stuff that we control). These would (ideally) let us move away from custom protocols but I couldn't get either working :
|
Fixes microsoft#95955 Our port mapping impl for webview currently relies on `getWebContents` to handle port mapping in the renderer process. This API has been deprecated by electron. This change instead moves the webview port mapping handler to the main process. To make this change, I also realized that the tunnel service needed to be moved from `vs/workbench` to `vs/platform` so that we could consume it from the main process Other changes made as part of this refactoring: - Register all webview in a `webview` partition. This ensures that our port mapping manger only intercepts requests made inside webviews. - Send the `webContentsId` to the main process. This is required to implement `onBeforeRequest`. Unfortunatly the referrer always seems to be undefined for these requests - Have the tunnel service take a resolved authority instead of taking the raw authority. This was required due to the tunnel service moving to `vs/platform`
Fixes microsoft#95955 Our port mapping impl for webview currently relies on `getWebContents` to handle port mapping in the renderer process. This API has been deprecated by electron. This change instead moves the webview port mapping handler to the main process. To make this change, I also realized that the tunnel service needed to be moved from `vs/workbench` to `vs/platform` so that we could consume it from the main process Other changes made as part of this refactoring: - Register all webview in a `webview` partition. This ensures that our port mapping manger only intercepts requests made inside webviews. - Send the `webContentsId` to the main process. This is required to implement `onBeforeRequest`. Unfortunatly the referrer always seems to be undefined for these requests - Have the tunnel service take a resolved authority instead of taking the raw authority. This was required due to the tunnel service moving to `vs/platform`
* Move the webview port mapping from renderer to main process Fixes #95955 Our port mapping impl for webview currently relies on `getWebContents` to handle port mapping in the renderer process. This API has been deprecated by electron. This change instead moves the webview port mapping handler to the main process. To make this change, I also realized that the tunnel service needed to be moved from `vs/workbench` to `vs/platform` so that we could consume it from the main process Other changes made as part of this refactoring: - Register all webview in a `webview` partition. This ensures that our port mapping manger only intercepts requests made inside webviews. - Send the `webContentsId` to the main process. This is required to implement `onBeforeRequest`. Unfortunatly the referrer always seems to be undefined for these requests - Have the tunnel service take a resolved authority instead of taking the raw authority. This was required due to the tunnel service moving to `vs/platform` * Cleanup and adding url filter
@deepak1556 it looks like this was the last dependency on |
@bpasero yes that would be safe to add now. |
Please use 'remote.webContents.fromId(webview.getWebContentsId())' instead
Seeing this in my E8 exploration build console. I am not sure we want to support the usage of the
remote
module. Maybe we can do this access alternatively not requiring it at all?//cc @deepak1556
The text was updated successfully, but these errors were encountered: