-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[webview_flutter_wkebview] Verify JavaScriptChannels have a unique name #5904
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
Conversation
packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart
Outdated
Show resolved
Hide resolved
@@ -326,6 +326,13 @@ class WebKitWebViewController extends PlatformWebViewController { | |||
Future<void> addJavaScriptChannel( | |||
JavaScriptChannelParams javaScriptChannelParams, | |||
) { | |||
final String channelName = javaScriptChannelParams.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is somewhere already checking this isn't an empty string?
This parameter must be unique within the user content controller and must not be an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea it checks it here with an assert: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart#L695
flutter/packages@1a2b780...83c2c4d 2024-01-18 [email protected] [google_maps_flutter] Restore the arm64 workaround (flutter/packages#5915) 2024-01-17 [email protected] [pigeon] Separates message call code generation into separate methods in the KotlinGenerator (flutter/packages#5891) 2024-01-17 [email protected] [webview_flutter_wkebview] Verify JavaScriptChannels have a unique name (flutter/packages#5904) 2024-01-17 [email protected] [pigeon] Separates message call code generation into separate methods in the `DartGenerator` (flutter/packages#5859) 2024-01-17 [email protected] Roll Flutter from 8e94423 to def6af0 (23 revisions) (flutter/packages#5911) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…me (flutter#5904) Fixes flutter/flutter#141242 According to [WKUserContentController.addScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537172-addscriptmessagehandler?language=objc), a handler must have a unique name. In flutter/flutter#141242, this led to a crash. This PR prevents the app crash and throws an error from Dart when the method is called.
Fixes flutter/flutter#141242
According to WKUserContentController.addScriptMessageHandler, a handler must have a unique name. In flutter/flutter#141242, this led to a crash. This PR prevents the app crash and throws an error from Dart when the method is called.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.