Skip to content

Add web target [#21]#33

Open
DrUlysses wants to merge 12 commits intokdroidFilter:mainfrom
DrUlysses:main
Open

Add web target [#21]#33
DrUlysses wants to merge 12 commits intokdroidFilter:mainfrom
DrUlysses:main

Conversation

@DrUlysses
Copy link

I have used legacy Webview as basis and adjusted formatting as well.
Have added a demo for wasmJs as well.

@DrUlysses
Copy link
Author

@kdroidFilter review please 😄

@Sterta
Copy link
Contributor

Sterta commented Mar 13, 2026

You have also fixed the bug from the old one nice 🤣

@maicol07
Copy link

@DrUlysses why not using the webMain source set to target both js and wasmJs?

@DrUlysses
Copy link
Author

DrUlysses commented Mar 13, 2026

@DrUlysses why not using the webMain source set to target both js and wasmJs?

Because the whole structure should be migrated. Here is the issue for it #34

I'll do it after the merge

@kdroidFilter
Copy link
Owner

Thank you very much, nice work. I'm currently reviewing it, but I've already noticed that the webview state resets when the page is resized.

@DrUlysses
Copy link
Author

Thanks! I'll test it and will fix it

@kdroidFilter
Copy link
Owner

I also see that the loading bar is not displayed.

…fy state management

- Remove duplicate message handler registration in WasmJsWebView.injectJsBridge()
  that caused every JS bridge message to be dispatched twice
- Keep single handler in setupJsBridgeForWasm() with strict JSON regex parsing
  and proper param unescaping
- Add removeEventListener cleanup on dispose to prevent memory leaks
- Remove unnecessary WasmJsWebViewState intermediate class and WebViewStateAdapter,
  sync HtmlViewState directly to WebViewState
- Replace polling loop (while/delay 100ms) with reactive snapshotFlow for
  navigation state sync
- Simulate loading progress (0.1→0.9) like desktop platform since iframe
  doesn't expose real progress
- Add onLoadStarted callback so direct loadUrl/loadHtml/reload calls
  properly trigger loading state
- Add comments explaining canGoForward=false browser limitation
…cookies

Browser document.cookie API does not support URL-specific cookie removal.
Log a warning instead of silently deleting all cookies.
The Updater lambda was unconditionally setting iframe.src/srcdoc on every
recomposition (triggered by onGloballyPositioned during resize), causing
the WebView to lose its state and reload. Track last applied content and
skip re-applying when unchanged.
@DrUlysses
Copy link
Author

I have noticed by me what the cookies are not being set as well

@kdroidFilter
Copy link
Owner

I've fixed the two problems I mentioned above and simplified the code, but it still needs a thorough review.

Append trailing slash to bare-domain HTTP(S) URLs
(e.g. https://example.comhttps://example.com/) in
WebViewNavigator before the interceptor runs, matching
standard browser normalization behavior across all platforms.
@kdroidFilter
Copy link
Owner

kdroidFilter commented Mar 13, 2026

In the last commit, I normalized the URL in the common code to have similar behavior between the web and other platforms, but I'm not sure if this is correct.
Because otherwise, on the web, if I open example.com without the "/", it displays a JSON .

@kdroidFilter
Copy link
Owner

kdroidFilter commented Mar 13, 2026

It's a lot of work; I also see that the URL isn't updated in real time if it changes in the webview. it's probably because of cors.

@kdroidFilter
Copy link
Owner

kdroidFilter commented Mar 13, 2026

We need to add HTML pages on the github page so we can test it without any problems of cors.

@kdroidFilter
Copy link
Owner

But I can't contribute more than that for now, sorry.

@DrUlysses
Copy link
Author

Thanks for checking out a lot! I'll set to draft for now and will notify when it will be more ready

@DrUlysses DrUlysses marked this pull request as draft March 13, 2026 09:38
@DrUlysses
Copy link
Author

Upon testing I have also found out, what resize in jvm causes the reload of the page (because the loading bar changing there all the time)

@DrUlysses
Copy link
Author

DrUlysses commented Mar 16, 2026

Thanks to @Sterta, we have fixed some stuff. But there are some limitations, since the IFrame is being used for the solution:

  • The IFrame can't be used for everything. It will work only if the website has configured appropriately its cors.
  • JS can be executed only on the same origin.
  • Cookies can be set only for the parent destination (when destination of the iframe is the same as the parent destination - cookies can be set. Otherwise they will be ignored (there is a hack for it, but it is not clean solution then https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#security)

@DrUlysses DrUlysses marked this pull request as ready for review March 16, 2026 11:41
@DrUlysses
Copy link
Author

@kdroidFilter Have made some changes. Tell please if something else should be done

@kdroidFilter
Copy link
Owner

Thank you very much, I haven't checked yet, could you document in the readme the constraints and differences with other platforms?

@kdroidFilter kdroidFilter changed the title Closes #21 Add web target Mar 16, 2026
@kdroidFilter kdroidFilter changed the title Add web target Add web target [#21] Mar 16, 2026
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.

4 participants