[webview_flutter_web] Add WebWebViewController.runJavaScript#10215
[webview_flutter_web] Add WebWebViewController.runJavaScript#10215sophiebremer wants to merge 8 commits intoflutter:mainfrom
Conversation
|
Hello @mdebbar! Please provide guidance. Not all tests are successful, and how to add a useful test for |
| 'load', | ||
| () { | ||
| try { | ||
| _webWebViewParams.iFrame.contentDocument?.write(html.toJS); |
There was a problem hiding this comment.
team-web will still need to do a full review, but in the meantime: won't this change to loadHtmlString silently break any case where baseUrl is passed, as a regression from the previous behavior?
There was a problem hiding this comment.
This is valid concern. I see two different options to address it:
-
The previous implementation gets added as a fallback in the catch block.
-
We introduce a new controller parameter option to activate this PRs implementation and use the existing implementation by default as before.
What are your suggestions / thoughts?
There was a problem hiding this comment.
@mdebbar How do you want to handle branching for different origin setups?
2. We introduce a new controller parameter option to activate this PRs implementation and use the existing implementation by default as before.
Would the parameter add any information we don't already have? Can't we determine at runtime if the origins match?
|
Hello! We realised that we need more CORS flexibility which is in conflict with backward compatibility. Therefore we decided to go with a custom implementation based on the webview interfaces to support our usage goals. Thank you for taking the time and considering the feature. |
This PR (replaces #9835) adds an implementation for
WebWebViewController.runJavaScriptand changes the wayWebWebViewController.loadHtmlStringinjects HTML code while also adding support for thebaseUrloption.The following issues are fixed:
runJavaScriptfor Web when the content has the same origin flutter#173899Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3