Fix "about:blank" flicker in omnibar when a link is opened in a new tab #7291
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Task/Issue URL: https://app.asana.com/1/137249556945/project/1211724162604201/task/1212317263326283?focus=true
Description
This PR improves the handling of new tabs with empty URLs by:
handleNewTabIfEmptyUrl()call with a 200ms delay to ensure proper timinghandleNewTabIfEmptyUrl()call fromonMessageReceived()to be triggered after a delaywebNavigationState == nullinstead of checkingsite?.url.isNullOrEmpty()handleNewTabIfEmptyUrl()public to support the new calling patternThe delay is necessary because we need to wait for other webview events to be fired, before setting the about blank text in the omnibar. If there are other events fired and the navigation state changed, then it means that a new url is about to be loaded. In case the navigation state does’t change we are in the spoofing scenario.
Steps to test this PR
Steps to test this PR
Handle about:blank in omnibar
handleAboutBlankfeature toggle(should be enabled by default on internal builds)
UI changes
Note
Delays about:blank handling by 200ms after new window messages, switches empty-tab detection to navigation-state based, exposes the handler, and updates tests to match.
handleNewTabIfEmptyUrl()public and change condition towebNavigationState == null(instead ofsite?.url.isNullOrEmpty()).onMessageReceived().processMessage, add a 200ms delayed call toviewModel.handleNewTabIfEmptyUrl()(CHECK_IF_ABOUT_BLANK_DELAY).BrowserTabViewModelTest):handleNewTabIfEmptyUrl()directly and validate new navigation-state logic (including Custom Tab scenarios).distinctUntilChangedimport and defineCHECK_IF_ABOUT_BLANK_DELAYconstant.Written by Cursor Bugbot for commit fc4556d. This will update automatically on new commits. Configure here.