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

fix(linux): don't share UserContentManager between webviews (v0.24) #1325

Merged
merged 7 commits into from
Aug 22, 2024

Conversation

ollpu
Copy link
Contributor

@ollpu ollpu commented Jul 24, 2024

Fixes #1308

Init scripts are registered to the UserContentManager, so if it is shared between WebViews, the init scripts conflict. Use a unique UserContentManager for each WebView instead of sharing it across the WebContext.

The IPC message handler is also registered to UserContentManager. window_hash is no longer needed as a key to register_script_message_handler since the manager is unique. (window_hash is already removed on the dev branch.)

Also changed from register_uri_scheme to try_register_uri_scheme, which doesn't attempt to register a URI scheme if we already know that one with the same name was registered to the WebContext before. Without this change, I get this error from WebKitGTK:

** (tauri-app:[...]): CRITICAL **: 14:03:50.040: Cannot register URI scheme tauri more than once

It doesn't seem to affect functionality, but better to issue a more appropriate warning on our side. (On dev, this is propagated as an error)

Corresponding PR on the dev branch: #1326

Copy link
Contributor

github-actions bot commented Jul 24, 2024

Package Changes Through c3900d7

There are 1 changes which include wry with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
wry 0.24.10 0.24.11

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

ollpu added 3 commits July 25, 2024 11:33
Fixes tauri-apps#1308

Init scripts are registered to the UserContentManager, so if it is
shared between webviews, the init scripts will conflict. Use a unique
UserContentManager for each WebView instead of sharing it across the
WebContext.

The IPC message handler is also registered to UserContentManager.
window_hash is no longer needed as a key to
register_script_message_handler since the manager is unique. window_hash
is already removed on the dev branch.
Change from register_uri_scheme to try_register_uri_scheme, which
doesn't attempt to register if we already know that one with the same
name was registered to the WebContext before. Without this change, I get
this error from WebKitGTK:

** (tauri-app:[...]): CRITICAL **: 14:03:50.040: Cannot register URI scheme tauri more than once

It doesn't seem to affect functionality, but better to issue a more
appropriate warning on our side.
@ollpu ollpu force-pushed the multiwindow-shared-context-v0.24 branch from e4ab3d4 to d119e20 Compare July 25, 2024 08:35
src/webview/webkitgtk/mod.rs Outdated Show resolved Hide resolved
@amrbashir amrbashir merged commit 3937421 into tauri-apps:v0.24.1 Aug 22, 2024
7 checks passed
@ollpu
Copy link
Contributor Author

ollpu commented Aug 22, 2024

@amrbashir Hold on, there is still

manager.register_script_message_handler("ipc");

so referencing by the window hash in the init script won't work, right?

Otherwise this is ok by me, but how was it a breaking change?

ollpu added a commit to ollpu/wry that referenced this pull request Aug 22, 2024
Fallout from changes done to tauri-apps#1325 before merging
amrbashir pushed a commit that referenced this pull request Aug 22, 2024
Fallout from changes done to #1325 before merging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants