Repository navigation
Use current Safari identity for Google Sheets - #9536
Conversation
# Conflicts: # Sources/Panels/WKWebView+BrowserUserAgentPolicy.swift
Restore the original navigation-action API and remove the regression test that encoded the same-URL stale-identity fallback. Keep PR #9482 nil/empty normalization as the sole convergence rule.
# Conflicts: # cmuxTests/BrowserUserAgentPolicyWebKitTests.swift
📝 WalkthroughWalkthroughThis PR removes the webKitDefault case from BrowserUserAgentPolicyResolution and its handling logic. All HTTP/HTTPS destinations, including Google Sheets, now receive a custom Safari-compatible user agent. Navigation restart call sites now pass the full WKNavigationAction. Tests are updated to match. ChangesUnified Safari-compatible user agent policy
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant BrowserNavigationDelegate
participant BrowserPopupWindowController
participant WKWebViewExtension as WKWebView+BrowserUserAgentPolicy
BrowserNavigationDelegate->>WKWebViewExtension: restartNavigationForBrowserUserAgentPolicyIfNeeded(navigationAction)
BrowserPopupWindowController->>WKWebViewExtension: restartNavigationForBrowserUserAgentPolicyIfNeeded(navigationAction)
WKWebViewExtension->>WKWebViewExtension: derive request and isMainFrame from navigationAction
WKWebViewExtension->>WKWebViewExtension: apply Safari-compatible custom user agent
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 23 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (23 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Closes #9462
Root cause
#9054 gave Google Sheets a unique
.webKitDefaultidentity to preserve an older sharp-canvas behavior. The #9462 CPU loop happened because WebKit can expose that native identity as eithernilor an empty string. Raw comparison treated those equivalent values as different, so every replacement navigation synchronously requested another replacement before first paint.#9482 correctly made that comparison semantic and idempotent. #9483 added separate same-URL retry state that could allow a mismatched identity to proceed. This PR removes the #9483-only state and keeps the
nil/empty normalization.Once navigation could finish, a second regression became visible: the embedded WebKit UA omits the
Version/... Safari/...tokens. Google Sheets therefore displayed its unsupported-browser banner even though the document loaded. Sheets was also the only HTTP(S) destination that could switch away from the current Safari-compatible identity.Fix
.webKitDefaultweb resolution entirely, so a remote navigation cannot downgrade into the unsupported embedded UAnil/empty normalization when non-web destinations clear a custom identityEvery web URL now resolves to one target identity. The first real identity change can restart once; every repeated evaluation sees the already-applied target and becomes a no-op. Redirect chains cannot toggle between Sheets and non-Sheets identities.
Regression coverage
docs.google.com/spreadsheets,sheets.google.com, andspreadsheets.google.comto resolve to the current Safari-compatible identityfe19c02230followed byc7374d1715./scripts/lint-pbxproj-test-wiring.sh./scripts/check-pbxproj.shpython3 scripts/check-package-resolved-policy.pygit diff --checkRuntime validation
Tagged app:
issue-9462-google-sheets-browser-pane-cpu-hangTested the reported Sheet in the embedded browser on the pushed head:
navigator.userAgent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.6 Safari/605.1.15document.readyState:completefalseBuild succeeded on the pushed head with:
CMUX_SKIP_ZIG_BUILD=1 /Users/austinwang/manaflow/cmuxterm-hq/scripts/reload-cloud.sh --builder fleet --pool-tag tag:macbuilder --tag issue-9462-google-sheets-browser-pane-cpu-hang --launchNo user-facing strings changed. Localization files were audited and are unaffected.