Skip to content

fix(ios): scope cold-launch replay to the launch WebView - #1746

Open
GitToTheHub wants to merge 1 commit into
apache:masterfrom
GitToTheHub:fix/scene-launch-page-scope
Open

GitToTheHub wants to merge 1 commit into
apache:masterfrom
GitToTheHub:fix/scene-launch-page-scope

Conversation

@GitToTheHub

Copy link
Copy Markdown
Contributor

Platforms affected

iOS cold-launch URL and universal-link delivery.

Motivation and Context

A customized app can load an auxiliary Cordova window before creating its main Cordova view controller. The auxiliary WebView posts CDVPageDidLoadNotification, and the scene delegate currently treats it as the main page becoming ready. It immediately broadcasts and clears both buffered launch URL contexts and user activity. Main-page plugins registered later miss those events.

This was reproduced on an iOS 27.1 simulator using two real CDVViewController instances and their actual WebView navigation notifications, rather than only posting a synthetic notification. Both buffered launch values were consumed when the auxiliary page finished first.

Description

Ignore page-load notifications from unrelated views. When the launch window has a Cordova root view controller, wait for that controller's WebView; this also excludes secondary WebViews in the same window. For a custom container root, require the notifying view to belong to the launch window. The window check preserves existing support for embedded Cordova controllers without guessing which container child is primary.

Update the scene tests to use a WebView attached to their own window so page loads from the running test host cannot satisfy their expectations. Add a two-window integration regression covering both custom URLs and universal links, and a same-window regression covering a secondary WebView alongside a Cordova root controller. The integration test registers the main-page listeners only after the auxiliary page finishes, then verifies both links reach them when the main page loads.

Testing

  • Xcode 27.1, iPhone Duo simulator, iOS 27.1: all 13 CDVSceneDelegateTests passed with the fix.
  • The original two-window reproduction failed in all 3 attempts against the release code.
  • The final public-notification regression tests were also checked against the release code (without the production fix).
  • git diff --check passed.

Scope: for a custom container with several Cordova controllers in the same launch window, this retains the existing first-page behavior; selecting a primary child would require an explicit application-level convention. The confirmed cross-window loss and secondary-WebView case with a Cordova root are addressed here.

Checklist

  • Ran the affected native test suite successfully
  • Added regression coverage with actual Cordova WebView navigation
  • Commit uses the repository's fix(ios): convention
  • No existing issue to link
  • Documentation changes are not needed

@codecov-commenter

codecov-commenter commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.72%. Comparing base (f9bb658) to head (343802c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1746   +/-   ##
=======================================
  Coverage   82.72%   82.72%           
=======================================
  Files          17       17           
  Lines        5234     5234           
=======================================
  Hits         4330     4330           
  Misses        904      904           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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