Skip to content

[webview_flutter] Add setMixedContentMode for Android #9586

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

stuartmorgan-g
Copy link
Contributor

Adds an Android-level method to control the mixed content mode.

Fixes flutter/flutter#43595

Pre-Review Checklist

Footnotes

  1. 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

google-labs-jules bot and others added 6 commits July 9, 2025 16:50
This commit introduces a new Android-specific API `setMixedContentMode` to the `webview_flutter` plugin.
This allows developers to control how the WebView handles mixed content (HTTP content on an HTTPS page).

Fixes flutter/flutter#43595
@stuartmorgan-g
Copy link
Contributor Author

This was an experiment in using Jules on flutter/packages, and in particular seeing what it would make of a plugin using ProxyApi. The initial commit is what it created, then the rest was me making it work to see what it got right and wrong. Since figuring that out was most of the work of making a full PR, we may as well land it.

Some notes on the Jules aspect for our future experiments:

  • The prompt was minimal, and I also didn't do any feedback cycles with it. In retrospect I should have tried to get it to do the enum part via follow-up prompting, since that was the most tedious change to add by hand.
  • It did much better than I expected with our use of generators. For proxy API, it didn't try to change any of the generated code, but it did generate code on the Dart and Java side that was basically correct for what the generator made when I ran it. Not bad!
  • It generated an integration test that wasn't very useful (I just removed it). Interestingly it did leave a TODO(bparrishMines) to make the test useful 🤣
  • The Dart unit test, which should have been trivial given the other examples of similar tests in that file, was entirely hallucinated. I'm not sure what happened there; that should have been one of the easiest parts of the PR for it.
  • It doesn't seem to understand Java project structure enough from repo context to know that it didn't need to API-level gate the calls given our min version.

I didn't expect it to handle proxy API plugins very well at all, so in some respects it exceeded expectations. I think it was probably a net negative in time spent, but only barely, and with better prompting might do better. It is interesting that other than test it made changes to basically all the right files, in the right places, and did a reasonable job at wiring it all up. That suggests that someone using it who was completely new to the plugin might well find it useful as a starting point.

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -866,6 +879,35 @@ enum FileSelectorMode {
save,
}

/// Mode for controlling mixed content handling.
/// See [AndroidWebViewController.setMixedContentMode].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
/// See [AndroidWebViewController.setMixedContentMode].
/// See [AndroidWebViewController.setMixedContentMode].

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

Successfully merging this pull request may close these issues.

[webview_flutter] Add option to allow mixed-mode content (http in https page)
2 participants