Fix duplicate domain navigation in Jetpack - #25880
Conversation
|
@oguzkocer, this is ready for review. I reproduced the duplicate navigation, verified the root cause, and confirmed the fix manually in Jetpack. Six focused tests, targeted SwiftLint, and a Jetpack simulator build pass locally. Because this PR comes from my fork, Buildkite has not created any statuses; could you trigger the maintainer-gated CI when reviewing? |
|
Thanks for the PR @mauropereiira! I've requested a review from @crazytonyli and @jkmassel for the changes. I've also triggered the Buildkite build, but note that the result of this may not be reported to the PR. Specifically danger checks might not run at all. Jeremy or Tony should be able to sort out the merge once they review the PR. |
|
Thanks, Oğuz. I'll keep an eye on the Buildkite build and address anything that comes up in review. |
Description
Fixes CMM-2221.
Problem
Opening a domain from
My Site > DomainspresentedDomainDetailsWebViewController, but one tap also opened Safari with the same management page.DomainDetailsWebViewControllerobserved every change toWKWebView.url. It allowed only the exact URL used to create the controller. When the initial WordPress.com request changed URL during page loading, the observer treated that automatic navigation like a tapped link, opened the new URL in Safari, and calledgoBack(). Jetpack therefore kept its domain webview while Safari opened a duplicate page.Change
The controller now uses the existing
LinkBehavior.urlOnlynavigation policy with its initial domain URL. This policy distinguishes navigation type instead of comparing URL strings:This also removes the URL KVO observer, stored observation, exact-URL comparison, and direct
UIApplication.shared.opencall. Domain URL construction, authentication, analytics, and back navigation are unchanged.Regression coverage
DomainDetailsNavigationTests.navigationPolicyDistinguishesRedirectsFromLinksverifies both sides of the contract:.otherrequest to a changed URL returns.allowand does not call the external URL handler..linkActivatedrequest returns.canceland opens the tapped URL through the external URL handler.Expected behavior after this change:
RenewscardDomain expiry and renewal-date behavior are outside this change.
Testing instructions
My Site > Domains.Renewscard.Local verification completed: