-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into release/7.109.0
- Loading branch information
Showing
97 changed files
with
1,470 additions
and
3,990 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
appId: com.duckduckgo.mobile.ios | ||
tags: | ||
- dataclearing | ||
|
||
--- | ||
|
||
# Set up | ||
- clearState | ||
- launchApp | ||
- runFlow: | ||
when: | ||
visible: | ||
text: "Let’s Do It!" | ||
index: 0 | ||
file: ../shared/onboarding.yaml | ||
|
||
# Load Site | ||
- assertVisible: | ||
id: "searchEntry" | ||
- tapOn: | ||
id: "searchEntry" | ||
- inputText: "https://setcookie.net" | ||
- pressKey: Enter | ||
|
||
# Set a cookie | ||
- assertVisible: "Cookie Test" | ||
- tapOn: "Cookie name" | ||
- inputText: "TestName" | ||
- tapOn: "Cookie value" | ||
- inputText: "TestValue" | ||
- scrollUntilVisible: | ||
centerElement: true | ||
element: | ||
text: "Submit" | ||
- tapOn: "Submit" | ||
|
||
# Fireproof the site | ||
- tapOn: "Browsing Menu" | ||
- tapOn: "Fireproof This Site" | ||
- tapOn: "Fireproof" | ||
- assertVisible: "setcookie.net is now Fireproof" | ||
|
||
# Fire Button - twice, just to be sure | ||
- tapOn: "Close Tabs and Clear Data" | ||
- tapOn: | ||
id: "alert.forget-data.confirm" | ||
- assertVisible: | ||
id: "searchEntry" | ||
- tapOn: "Close Tabs and Clear Data" | ||
- tapOn: | ||
id: "alert.forget-data.confirm" | ||
|
||
# Validate Cookie was retained | ||
- tapOn: | ||
id: "searchEntry" | ||
- inputText: "https://setcookie.net" | ||
- pressKey: Enter | ||
- assertVisible: "TestName = TestValue" | ||
|
||
# Remove fireproofing | ||
- tapOn: "Browsing Menu" | ||
- tapOn: "Remove Fireproofing" | ||
|
||
# Fire Button | ||
- tapOn: "Close Tabs and Clear Data" | ||
- tapOn: | ||
id: "alert.forget-data.confirm" | ||
|
||
# Validate Cookie was removed | ||
- tapOn: | ||
id: "searchEntry" | ||
- inputText: "https://setcookie.net" | ||
- pressKey: Enter | ||
- assertVisible: "Cookie Test" | ||
- assertVisible: "Received no cookies." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
appId: com.duckduckgo.mobile.ios | ||
tags: | ||
- privacy | ||
|
||
--- | ||
|
||
# Set up | ||
- clearState | ||
- launchApp | ||
- runFlow: | ||
when: | ||
visible: | ||
text: "Let’s Do It!" | ||
index: 0 | ||
file: ../shared/onboarding.yaml | ||
|
||
# Load Site | ||
- assertVisible: | ||
id: "searchEntry" | ||
- tapOn: | ||
id: "searchEntry" | ||
- inputText: "privacy blogs" | ||
- pressKey: Enter | ||
|
||
# Change settings | ||
- tapOn: "Safe search: moderate ▼" | ||
- tapOn: "Off" | ||
|
||
# Fire Button - twice, just to be sure | ||
- tapOn: "Close Tabs and Clear Data" | ||
- tapOn: | ||
id: "alert.forget-data.confirm" | ||
- assertVisible: | ||
id: "searchEntry" | ||
- tapOn: "Close Tabs and Clear Data" | ||
- tapOn: | ||
id: "alert.forget-data.confirm" | ||
|
||
# Validate Cookie was retained | ||
- tapOn: | ||
id: "searchEntry" | ||
- inputText: "creepy trackers" | ||
- pressKey: Enter | ||
- assertVisible: "Safe search: off ▼" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// | ||
// DataStoreWarmup.swift | ||
// DuckDuckGo | ||
// | ||
// Copyright © 2024 DuckDuckGo. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Combine | ||
import WebKit | ||
|
||
/// WKWebsiteDataStore is basically non-functional until a web view has been instanciated and a page is successfully loaded. | ||
public class DataStoreWarmup { | ||
|
||
public init() { } | ||
|
||
@MainActor | ||
public func ensureReady() async { | ||
await BlockingNavigationDelegate().loadInBackgroundWebView(url: URL(string: "about:blank")!) | ||
} | ||
|
||
} | ||
|
||
private class BlockingNavigationDelegate: NSObject, WKNavigationDelegate { | ||
|
||
let finished = PassthroughSubject<Void, Never>() | ||
|
||
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy { | ||
return .allow | ||
} | ||
|
||
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | ||
finished.send() | ||
} | ||
|
||
func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { | ||
Pixel.fire(pixel: .webKitDidTerminateDuringWarmup) | ||
// We won't get a `didFinish` if the webview crashes | ||
finished.send() | ||
} | ||
|
||
var cancellable: AnyCancellable? | ||
func waitForLoad() async { | ||
await withCheckedContinuation { continuation in | ||
cancellable = finished.sink { _ in | ||
continuation.resume() | ||
} | ||
} | ||
} | ||
|
||
@MainActor | ||
func loadInBackgroundWebView(url: URL) async { | ||
let config = WKWebViewConfiguration.persistent() | ||
let webView = WKWebView(frame: .zero, configuration: config) | ||
webView.navigationDelegate = self | ||
let request = URLRequest(url: url) | ||
webView.load(request) | ||
await waitForLoad() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.