Skip to content

Commit e7730be

Browse files
authored
Bugfix FXIOS-13233 [Swift 6 Migration] nonisolated @obj method in ToolbarKit with MenuHelperURLBarInterface (#29142)
nonisolated @obj method
1 parent a97f038 commit e7730be

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

BrowserKit/Sources/Common/Utilities/MenuHelper/MenuHelperURLBarInterface.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import Foundation
77
@objc
88
public protocol MenuHelperURLBarInterface {
99
/// Used to add a paste and go option on the URL bar textfield
10+
/// Note: objc methods should always be marked nonisolated as `@MainActor` isolation can't be guaranteed
1011
@objc
11-
optional func menuHelperPasteAndGo()
12+
nonisolated optional func menuHelperPasteAndGo()
1213
}
1314

1415
/// Used to pass in the Client strings for the URL bar textfield menu options

BrowserKit/Sources/ToolbarKit/AddressToolbar/LocationView/LocationView.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,10 +600,12 @@ final class LocationView: UIView,
600600
return super.canPerformAction(action, withSender: sender)
601601
}
602602

603-
func menuHelperPasteAndGo() {
604-
guard let pasteboardContents = UIPasteboard.general.string else { return }
605-
delegate?.locationViewDidSubmitText(pasteboardContents)
606-
urlTextField.text = pasteboardContents
603+
nonisolated func menuHelperPasteAndGo() {
604+
ensureMainThread {
605+
guard let pasteboardContents = UIPasteboard.general.string else { return }
606+
self.delegate?.locationViewDidSubmitText(pasteboardContents)
607+
self.urlTextField.text = pasteboardContents
608+
}
607609
}
608610

609611
// MARK: - LocationTextFieldDelegate

firefox-ios/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)