Skip to content

[webview_flutter] Add removeJavaScriptChannel - #1216

Closed
seungsoo47 wants to merge 1 commit into
flutter-tizen:mainfrom
seungsoo47:upstream-plugins-webview-remove-js-channel
Closed

seungsoo47 wants to merge 1 commit into
flutter-tizen:mainfrom
seungsoo47:upstream-plugins-webview-remove-js-channel

Conversation

@seungsoo47

Copy link
Copy Markdown
Contributor

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

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T02:00:58.175873Z dbf12b7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment on lines -227 to +228
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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@seungsoo47 seungsoo47 closed this Nov 12, 2026
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.

2 participants