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

bug(custom-protocol): history push state error on windows #170

Closed
1 of 2 tasks
lemarier opened this issue Apr 19, 2021 · 6 comments
Closed
1 of 2 tasks

bug(custom-protocol): history push state error on windows #170

lemarier opened this issue Apr 19, 2021 · 6 comments

Comments

@lemarier
Copy link
Member

lemarier commented Apr 19, 2021

Describe the bug
Unable to use history API on windows.

Steps To Reproduce

  • Launch any wry example on Windows.
  • Open Console.
  • Execute code below:
history.pushState({}, "Test", "index.html");

Expected behavior
Expect no error

Screenshots
Screen Shot 2021-04-19 at 3 04 01 PM

Platform and Versions (please complete the following information):
OS: Windows
Rustc: 1.51.0

Would you assign yourself to resolve this bug?

  • Yes
  • No
@lemarier
Copy link
Member Author

I think we should check SetVirtualHostNameToFolderMapping -- instead of using file:// we'll be able to use http:// or maybe there is other possibilities that I'm not aware?

@nothingismagick
Copy link
Member

origin 'null' is scary

@wusyong
Copy link
Member

wusyong commented Apr 20, 2021

I think this also has something to do with our workaround on Windows. Current webview2 binding doesn't expose this method either.
So either way, we'll need to update upstream webview2.

@wusyong
Copy link
Member

wusyong commented Apr 20, 2021

@lemarier
Copy link
Member Author

lemarier commented Apr 20, 2021

Looks like it's possible to register a custom protocol with version 1.0774
https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.addwebresourcerequestedfilter?view=webview2-dotnet-1.0.774.44#Microsoft_Web_WebView2_Core_CoreWebView2_AddWebResourceRequestedFilter_System_String_Microsoft_Web_WebView2_Core_CoreWebView2WebResourceContext_

Do you think we should open a PR to webview2 crate to add the binding?

Edit: I saw binding are already here and we already use it. So more tests are required by changing the file handler to the same approach we are doing with macOS and Linux?

Edit 2: Available since 1.0.664.37 and we already use it. Tried with webview2 current branch who use 1.0774 and got (same error as crate version)
Screen Shot 2021-04-20 at 8 22 46 AM

@wusyong
Copy link
Member

wusyong commented Apr 20, 2021

Ah sorry I should link the issue instead: MicrosoftEdge/WebView2Feedback#73
But again with the new stable version 1.0744, it should include this fix.
I'll test it on winrt first.

Edit: ugh sorry again. It's these issues that should be tracked: MicrosoftEdge/WebView2Feedback#172 / MicrosoftEdge/WebView2Feedback#173
And it seems it hasn't resolved yet. We'll need to stick to current workaround for a while :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants