fix(android): use addDocumentStartJavaScript#9
Open
friofry wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Android WebView bridge injection to use AndroidX WebKit’s document-start script injection (when supported) so bootstrap/user scripts can run earlier in the page lifecycle, plus a small JS-side readiness signal.
Changes:
- Add
window[ns].__ready = trueto the page bootstrap to allow synchronous “ready” checks in addition to theqtWebChannelReadyevent. - On Android, detect
WebViewFeature.DOCUMENT_START_SCRIPTsupport and register bootstrap + user scripts viaWebViewCompat.addDocumentStartJavaScript. - Add cleanup for registered document-start scripts and keep an onPageStarted-based fallback when the feature is unsupported.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| mobilewebview/src/js/bootstrap_page.js | Adds a __ready flag on the namespace object before firing the ready event. |
| mobilewebview/android/src/org/mobilewebview/MobileWebView.java | Registers bootstrap/user scripts at document start via AndroidX WebKit, with cleanup and fallback injection logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
92db5f9 to
1355349
Compare
* if present to make early user scripts injection refs status-im/status-app#20602
5d57efe to
fe6fa81
Compare
fe6fa81 to
a3da140
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refs status-im/status-app#20602