Skip to content

Conversation

@cyndichin
Copy link
Contributor

@cyndichin cyndichin commented Dec 10, 2025

📜 Tickets

Jira ticket
Github issue

💡 Description

This test testGetURLGivenAboutConfigSpaceURLThenValidEscapedURL was failing for versions < iOS 17. This is because Apple changed how URL(string: xxx) works under the hood. The test was failing for about: config because it was returning nil instead of about:%20config. This is due to older versions not automatically adding the percent encoding, see more details in the doc: https://developer.apple.com/documentation/foundation/url/init(string:)

image

Note: The URLFormatted is currently not being used and discussed with @lmarceau that we eventually want to use the new DefaultURLFormatter but has not been prioritized. For now, we will add a fix specifically for iOS 17 and we revert the fix that was merged as part of this PR.

cc: @yoanarios

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

@cyndichin cyndichin force-pushed the cc/FXIOS-14375_investigate-urlformatter-tests branch from ab9b5be to 9f6f3b5 Compare December 10, 2025 15:51
Comment on lines 104 to 114
/**
Returns whether the URL's scheme is one of those listed on the official list of URI schemes.
This only accepts permanent schemes: historical and provisional schemes are not accepted.
*/
public func schemeIsValid(for url: URL) -> Bool {
guard let scheme = url.scheme else { return false }
return SchemesDefinition.permanentURISchemes.contains(scheme.lowercased())
&& url.absoluteString.lowercased() != scheme + ":"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied over from our schemeIsValid code in our URL extension

@cyndichin cyndichin requested a review from lmarceau December 10, 2025 15:58
@cyndichin cyndichin marked this pull request as ready for review December 10, 2025 15:59
@cyndichin cyndichin requested a review from a team as a code owner December 10, 2025 15:59
@cyndichin cyndichin force-pushed the cc/FXIOS-14375_investigate-urlformatter-tests branch from 9f6f3b5 to 49f01d3 Compare December 10, 2025 16:01
@cyndichin
Copy link
Contributor Author

Note: This was the only similar PR I found - #26101

Seems like we handled percent encoding in the past but not specifically mentioning iOS 17 change under the hood.

@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Dec 10, 2025

💪 Quality guardian

1 tests files modified. You're a champion of test coverage! 🚀

🧹 Tidy commit

Just 2 file(s) touched. Thanks for keeping it clean and review-friendly!

🙌 Friday high-five

Thanks for pushing us across the finish line this week! 🙌

💬 Description craftsman

Great PR description! Reviewers salute you 🫡

❌ Per-file test coverage gate

The following changed file(s) are below 35.0% coverage:

File Coverage Required
BrowserKit/Sources/WebEngine/Utilities/URLFormatter.swift 0.0% 35.0%

Generated by 🚫 Danger Swift against cb28ce5

Copy link
Contributor

@lmarceau lmarceau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment otherwise LGTM

@cyndichin cyndichin merged commit 97fa358 into main Dec 12, 2025
10 checks passed
@cyndichin cyndichin deleted the cc/FXIOS-14375_investigate-urlformatter-tests branch December 12, 2025 17:44
@github-actions
Copy link
Contributor

🚀 PR merged to main, targeting version: 147.0

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.

4 participants