Skip to content

test(bridge): add unit tests for kNoFlushModules optimisation#919

Merged
andycall merged 1 commit into
release/0.22.25from
fix/skip-flush-ui-command-for-no-dom-modules-test
May 8, 2026
Merged

test(bridge): add unit tests for kNoFlushModules optimisation#919
andycall merged 1 commit into
release/0.22.25from
fix/skip-flush-ui-command-for-no-dom-modules-test

Conversation

@daltoncaoyuan
Copy link
Copy Markdown
Collaborator

Background

Commit 1eab726 introduced a performance optimisation in ModuleManager::webf_invoke_module: modules that never inspect the DOM tree (e.g. Fetch, LocalStorage, Navigator) now skip the FlushUICommand call, avoiding an expensive PostToDartSync round-trip on every invocation.

This PR adds the missing unit tests to verify the correctness of that optimisation.

Changes

Test infrastructure (bridge/test/)

Added g_flush_ui_command_call_count global counter (declared in webf_test_env.h, defined in webf_test_env.cc) so tests can observe whether flushUICommand was triggered.
Updated the TEST_flushUICommand mock to increment the counter on each call.
Registered the new test file in test.cmake.

How to test

# Build bridge (incremental if already built)
npm run build:bridge:macos

# run  tests
bridge/build/macos/lib/x86_64/webf_unit_test --gtest_filter="ModuleManagerNoFlush.*"

@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
use-case Error Error May 6, 2026 7:32am
vue_usecase Error Error May 6, 2026 7:32am

Request Review

@andycall andycall merged commit 61218cb into release/0.22.25 May 8, 2026
5 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants