[webview_flutter] Implement clearLocalStorage/onHttpError and add integration tests based on upstream v4.13.1#1069
Conversation
Add Tizen native implementations for two previously unimplemented APIs: - clearLocalStorage: clears web local storage via ewk_context_web_storage_delete_all. - onHttpError: reports HTTP error status codes (>= 400) to the navigation delegate via the policy,response,decide callback. Bump version to 0.10.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Port the remaining runnable upstream test cases from webview_flutter v4.13.1: - NavigationDelegate > onHttpError - NavigationDelegate > onHttpError is not called when no HTTP error is received - clearLocalStorage These pass thanks to the new clearLocalStorage and onHttpError implementations. The other upstream test cases remain omitted because they cannot run on Tizen: window.open/new-window behavior, HTTP basic auth, and media playback policy are not supported by the engine. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The test file wrapped most controller setup calls (setJavaScriptMode, setNavigationDelegate, loadRequest, etc.) in unawaited(), a leftover from an older upstream version. Match the upstream v4.13.1 style by awaiting those calls instead, keeping unawaited() only where upstream does (the request server loop and the two onHttpError tests). No behavior change; the full suite still passes on the device. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
getScrollPosition() settles asynchronously after scrollTo/scrollBy, so reading it once right after the call was flaky (more so on software-GL rendering such as emulators). Poll the scroll position until it reaches the expected value, with a timeout, so the test waits for the value to settle instead of failing on a transient stale read. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rash Rework WebView::Dispose() to tear resources down safely: - Detach all engine callbacks (including the missing "policy,response,decide") and defer evas_object_del() until the embedder's UnregisterTexture completion callback, so the engine-owned TBM surfaces are not freed while a raster-thread frame is still reading them (flutter-tizen/embedder#182). - Add is_alive_/is_disposing_ guards so async callbacks arriving after disposal no longer touch the destroyed WebView. - On the Tizen 10.0 TV emulator (TV_PROFILE + x86_64), hide the stopped view instead of deleting it to avoid a SIGSEGV in chromium-efl's ~SelectionControllerEfl(); revert once the engine fix ships. Verified on the TV 10.0 emulator: example integration tests previously crashed on WebView disposal and now pass 19/19.
There was a problem hiding this comment.
Code Review
This pull request implements clearLocalStorage and onHttpError for the Tizen WebView, and addresses races, use-after-frees, and crashes during WebView disposal. Additionally, integration tests are updated to await controller calls instead of using unawaited. The reviewer feedback suggests awaiting the controller calls in the newly added onHttpError tests to maintain consistency with these changes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
JSUYA
left a comment
There was a problem hiding this comment.
Do the parts related to dispose and evas_object_del ensure that it works without issues even when displaying multiple views?
| // Set under mutex_ at the start of Dispose(). The raster thread checks it | ||
| // in ObtainGpuSurface() and stops being handed engine-owned TBM surfaces | ||
| // that are about to be freed by the deferred evas_object_del(). | ||
| bool is_disposing_ = false; | ||
| // Set to false at the start of Dispose(). A pending "navigationRequest" | ||
| // reply from Dart (resolved asynchronously) captures a copy and checks it | ||
| // before dereferencing this WebView, avoiding a use-after-free. | ||
| std::shared_ptr<bool> is_alive_ = std::make_shared<bool>(true); |
There was a problem hiding this comment.
Please delete all unnecessary comments.
If you wish to explain how disposing and is_alive work, please leave an explanation in the PR.
Please only leave comments for parts that must be referenced for functionality (TODO, NOTE) or descriptions that need to be published.
| }; | ||
| auto* context = new TeardownContext{instance, std::move(pool)}; | ||
| texture_registrar_->UnregisterTexture(GetTextureId(), [context]() { | ||
| ecore_main_loop_thread_safe_call_async( |
There was a problem hiding this comment.
The ecore API is no longer in use.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ee5d4624f
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| [](void* data) { | ||
| auto* context = static_cast<TeardownContext*>(data); | ||
| if (context->instance) { | ||
| #if defined(TV_PROFILE) && (defined(__x86_64__) || defined(__i386__)) |
There was a problem hiding this comment.
Limit the leak workaround to the affected x86_64 emulator
When this is built for a 32-bit x86 TV emulator, __i386__ takes the workaround branch and hides the EWK view instead of deleting it, even though the comment below says the 32-bit x86 emulator is unaffected and should delete normally. That makes every WebView disposal leak the engine view in that environment; please restrict the condition to the affected TV 10.0 x86_64 target, or otherwise make the intended 32-bit behavior explicit.
Useful? React with 👍 / 👎.
clearLocalStorageandonHttpError, and bumpwebview_flutter_tizento 0.10.1.flutter-tizen test(or example integration tests) on TV 10.0 emulator — 19/19 passing, including previously-crashing disposal cases