From 509e81fec86e3ef1ff78ca641e2192bdce4873ce Mon Sep 17 00:00:00 2001 From: Alexey Martemyanov Date: Mon, 1 Jul 2024 13:51:18 +0600 Subject: [PATCH 1/2] Fix goBack/goForward for same-document navigation history (#2926) Task/Issue URL: https://app.asana.com/0/1202406491309510/1207645682318770/f --- DuckDuckGo/Common/Extensions/URLExtension.swift | 2 +- DuckDuckGo/Tab/Model/Tab.swift | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DuckDuckGo/Common/Extensions/URLExtension.swift b/DuckDuckGo/Common/Extensions/URLExtension.swift index db79eac20f..a46f54f001 100644 --- a/DuckDuckGo/Common/Extensions/URLExtension.swift +++ b/DuckDuckGo/Common/Extensions/URLExtension.swift @@ -341,7 +341,7 @@ extension URL { } var isExternalSchemeLink: Bool { - return ![.https, .http, .about, .file, .blob, .data, .ftp, .javascript].contains(navigationalScheme) + return ![.https, .http, .about, .file, .blob, .data, .ftp, .javascript, .duck].contains(navigationalScheme) } // MARK: - DuckDuckGo diff --git a/DuckDuckGo/Tab/Model/Tab.swift b/DuckDuckGo/Tab/Model/Tab.swift index a6fce323b1..44bcd01aa9 100644 --- a/DuckDuckGo/Tab/Model/Tab.swift +++ b/DuckDuckGo/Tab/Model/Tab.swift @@ -618,7 +618,7 @@ protocol NewWindowPolicyDecisionMaker { @MainActor @discardableResult func goBack() -> ExpectedNavigation? { - guard canGoBack else { + guard canGoBack, let backItem = webView.backForwardList.backItem else { if canBeClosedWithBack { delegate?.closeTab(self) } @@ -626,7 +626,7 @@ protocol NewWindowPolicyDecisionMaker { } userInteractionDialog = nil - let navigation = webView.navigator()?.goBack(withExpectedNavigationType: .backForward(distance: -1)) + let navigation = webView.navigator()?.go(to: backItem, withExpectedNavigationType: .backForward(distance: -1)) // update TabContent source to .historyEntry on navigation navigation?.appendResponder(willStart: { [weak self] navigation in guard let self, @@ -640,10 +640,10 @@ protocol NewWindowPolicyDecisionMaker { @MainActor @discardableResult func goForward() -> ExpectedNavigation? { - guard canGoForward else { return nil } + guard canGoForward, let forwardItem = webView.backForwardList.forwardItem else { return nil } userInteractionDialog = nil - let navigation = webView.navigator()?.goForward(withExpectedNavigationType: .backForward(distance: 1)) + let navigation = webView.navigator()?.go(to: forwardItem, withExpectedNavigationType: .backForward(distance: 1)) // update TabContent source to .historyEntry on navigation navigation?.appendResponder(willStart: { [weak self] navigation in guard let self, From 5fccf8eda11fca80dfb6125903f8614a2c203f57 Mon Sep 17 00:00:00 2001 From: Alexey Martemyanov Date: Mon, 1 Jul 2024 15:25:53 +0600 Subject: [PATCH 2/2] Fix same-document navigation breaking current main frame navigation (#2927) Task/Issue URL: https://app.asana.com/0/1202406491309510/1207272003030126/f BSK PR: duckduckgo/BrowserServicesKit#873 --- DuckDuckGo.xcodeproj/project.pbxproj | 2 +- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- LocalPackages/DataBrokerProtection/Package.swift | 2 +- LocalPackages/NetworkProtectionMac/Package.swift | 2 +- LocalPackages/SubscriptionUI/Package.swift | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 6e4abacfe7..19033a10aa 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -13042,7 +13042,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 164.0.0; + version = 164.0.1; }; }; 9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 66904431e9..a407693dae 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "be669f88c20b862b43e6267004c45022447209ee", - "version" : "164.0.0" + "revision" : "ae719ad6e86c44c4d5ed80f696685d1ee3997f32", + "version" : "164.0.1" } }, { diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index 97abf62148..174f210bb2 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.1"), .package(path: "../SwiftUIExtensions"), .package(path: "../XPCHelper"), ], diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 88469792bc..b3f07c7eb8 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -32,7 +32,7 @@ let package = Package( .library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.1"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.1"), .package(path: "../AppLauncher"), .package(path: "../UDSHelper"), diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index af82e98f6b..68c207438f 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -12,7 +12,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.1"), .package(path: "../SwiftUIExtensions") ], targets: [