Repository navigation
[webview_flutter] Add removeJavaScriptChannel - #1216
seungsoo47 wants to merge 1 commit into
Conversation
PlatformWebViewController.removeJavaScriptChannel has been part of webview_flutter_platform_interface since 2.0.0, but TizenWebViewController threw UnimplementedError. Neither EWK nor the WV API exports a function to remove a message handler (only *_javascript_message_handler_add), so the channel is removed on the Dart side and its messages are no longer delivered. The JavaScript object is not removed. Adding a channel with the same name again delivers each message once. Upstream: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| Future<void> removeJavaScriptChannel(String javaScriptChannelName) async { | ||
| throw UnimplementedError( | ||
| 'This version of `TizenWebViewController` currently has no ' | ||
| 'implementation of `removeJavaScriptChannel`.', | ||
| ); | ||
| } | ||
| Future<void> removeJavaScriptChannel(String javaScriptChannelName) => | ||
| _webview.removeJavaScriptChannel(javaScriptChannelName); |
There was a problem hiding this comment.
I honestly don’t understand the purpose of this PR.
There is no platform API for "removing JavaScript," so this is an unsupported feature.
Since an unsupported API is being used, an appropriate exception should be thrown.
Please explain if I have misunderstood something.
There was a problem hiding this comment.
You're right. Neither EWK nor WV can unregister a message handler, so this only drops messages on the Dart side while the JS object stays on the page. That differs from the upstream contract, so I'll close this PR and keep the existing UnimplementedError.
PlatformWebViewController.removeJavaScriptChannel has been part of webview_flutter_platform_interface since 2.0.0, but TizenWebViewController threw UnimplementedError.
Neither EWK nor the WV API exports a function to remove a message handler (only *_javascript_message_handler_add), so the channel is removed on the Dart side and its messages are no longer delivered. The JavaScript object is not removed. Adding a channel with the same name again delivers each message once.
Upstream: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart