-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor FXIOS-14466 FXIOS-14463 [Swift 6 Migration] Migrate ShareTo and BrowserKit Package to Swift 6 #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: coderabbit_combined_20260121_augment_sentry_coderabbit_1_base_refactor_fxios-14466_fxios-14463_swift_6_migration_migrate_shareto_and_browserkit_package_to_swift_6_pr220
Are you sure you want to change the base?
Changes from all commits
54f6cc2
2f8c750
1ad6509
61460d5
84998a2
ca8483c
b554fc0
5439cb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ import Kingfisher | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import GCDWebServers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class SVGImageProcessorTests: XCTestCase, @unchecked Sendable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingSVGImage_withKingfisherProcessor_forStandardSVGCase() async { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingSVGImage_withKingfisherProcessor_forStandardSVGCase() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let assetType: AssetType = .svgCase1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let expectedRasterSize = CGSize(width: 360, height: 360) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -18,32 +18,26 @@ class SVGImageProcessorTests: XCTestCase, @unchecked Sendable { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? await startMockImageServer(imageData: imageData, forAssetType: assetType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? startMockImageServer(imageData: imageData, forAssetType: assetType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Check bundle setup for mock server response data") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let exp = expectation(description: "Image download and parse") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let siteDownloader = DefaultSiteImageDownloader() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| siteDownloader.downloadImage(with: mockedURL, options: [.processor(SVGImageProcessor())]) { result in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| switch result { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case .success(let result): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTAssertEqual(result.originalData, imageData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTAssertEqual(result.url, mockedURL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTAssertEqual(result.image.size, expectedRasterSize) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exp.fulfill() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case .failure(let error): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Should not have an error: \(error) \(error.errorDescription ?? "")") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exp.fulfill() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await fulfillment(of: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
26
to
37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Await the async download in this test. This test no longer waits for the async callback, so it can pass without executing assertions (or be flaky). Add an expectation and wait like the other tests. ✅ Proposed fix- let siteDownloader = DefaultSiteImageDownloader()
- siteDownloader.downloadImage(with: mockedURL, options: [.processor(SVGImageProcessor())]) { result in
+ let exp = expectation(description: "Image download and parse")
+ let siteDownloader = DefaultSiteImageDownloader()
+ siteDownloader.downloadImage(with: mockedURL, options: [.processor(SVGImageProcessor())]) { result in
switch result {
case .success(let result):
XCTAssertEqual(result.originalData, imageData)
XCTAssertEqual(result.url, mockedURL)
XCTAssertEqual(result.image.size, expectedRasterSize)
+ exp.fulfill()
case .failure(let error):
XCTFail("Should not have an error: \(error) \(error.errorDescription ?? "")")
+ exp.fulfill()
}
}
+ wait(for: [exp], timeout: 2.0)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// FXIOS-11361: Tests a special SVG which previously caused crashes in older versions of SwiftDraw. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingSVGImage_withKingfisherProcessor_forSpecialSVGCase() async { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingSVGImage_withKingfisherProcessor_forSpecialSVGCase() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let assetType: AssetType = .svgCase2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let expectedRasterSize = CGSize(width: 360, height: 360) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -52,7 +46,7 @@ class SVGImageProcessorTests: XCTestCase, @unchecked Sendable { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? await startMockImageServer(imageData: imageData, forAssetType: assetType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? startMockImageServer(imageData: imageData, forAssetType: assetType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Check bundle setup for mock server response data") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -73,18 +67,18 @@ class SVGImageProcessorTests: XCTestCase, @unchecked Sendable { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await fulfillment(of: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wait(for: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingICOImage_withKingfisherProcessor() async { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingICOImage_withKingfisherProcessor() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let assetType: AssetType = .ico | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let imageData = try? dataFor(type: assetType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Could not load test asset") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? await startMockImageServer(imageData: imageData, forAssetType: assetType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? startMockImageServer(imageData: imageData, forAssetType: assetType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Check bundle setup for mock server response data") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -104,16 +98,16 @@ class SVGImageProcessorTests: XCTestCase, @unchecked Sendable { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await fulfillment(of: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wait(for: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingGarbageData_withKingfisherProcessor() async { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingGarbageData_withKingfisherProcessor() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let garbageData = try? dataFor(type: .badType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Could not load test asset") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? await startMockImageServer(imageData: garbageData, forAssetType: .badType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? startMockImageServer(imageData: garbageData, forAssetType: .badType) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Check bundle setup for mock server response data") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -131,13 +125,13 @@ class SVGImageProcessorTests: XCTestCase, @unchecked Sendable { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await fulfillment(of: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wait(for: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingEmptyImage_withKingfisherProcessor() async { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func testDownloadingEmptyImage_withKingfisherProcessor() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let emptyData = Data() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? await startMockImageServer(imageData: emptyData, forAssetType: .ico) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let mockedURL = try? startMockImageServer(imageData: emptyData, forAssetType: .ico) else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCTFail("Check bundle setup for mock server response data") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -155,7 +149,7 @@ class SVGImageProcessorTests: XCTestCase, @unchecked Sendable { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await fulfillment(of: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wait(for: [exp], timeout: 2.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -211,9 +205,6 @@ extension SVGImageProcessorTests { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw MockImageServerError.noAssetData | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // GDCWebServer must be initialized for the first time on the main thread | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // So this @MainActor ensures that if this test file is run alone it will not crash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func startMockImageServer(imageData: Data, forAssetType assetType: AssetType) throws -> URL { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let webServer = GCDWebServer() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 50402
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 214
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 206
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 4087
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 677
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 567
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 445
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 1456
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 103
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 3135
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 3179
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 1678
Update BrowserKit/Package.swift swift-tools-version to match project requirements
The swift-tools-version: 6.2 in BrowserKit/Package.swift is incompatible with the project's documented toolchain (Xcode 26.1, Swift 5.10 per README.md). This will cause build failures in CI workflows using Xcode 26.1. Align BrowserKit's swift-tools-version with the other package manifests (Package.swift: 5.7, MozillaRustComponents: 5.10) or update the project-wide toolchain requirements if Swift 6.2 is intended.
🤖 Prompt for AI Agents