Skip to content

Commit

Permalink
Merge branch 'release/0.30.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunn committed Nov 25, 2022
2 parents aa1cff6 + 01cd256 commit 73e0d56
Show file tree
Hide file tree
Showing 28 changed files with 899 additions and 252 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,21 @@ jobs:
with:
report_paths: unittests.xml

verify-autoconsent-bundle:
name: 'Verify autoconsent bundle'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Build bundle
run: |
npm ci
npm run rebuild-autoconsent
- name: Verify clean tree
run: |
git update-index --refresh
git diff-index --quiet HEAD --
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MARKETING_VERSION = 0.30.8
MARKETING_VERSION = 0.30.9

2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6314,7 +6314,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 35.0.0;
version = 36.1.1;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@
ReferencedContainer = "container:DuckDuckGo.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "AutoconsentMessageProtocolTests/testInitResponds()">
</Test>
<Test
Identifier = "CBRCompileTimeReporterTests">
</Test>
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Autoconsent/autoconsent-bundle.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions DuckDuckGo/Browser Tab/Model/ContextMenuManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ extension ContextMenuManager {
menu.replaceItem(at: index, with: self.downloadMenuItem(from: item))
}

private func handleCopyLinkItem(_ item: NSMenuItem, at index: Int, in menu: NSMenu) {
private func handleCopyLinkItem(_ copyLinkItem: NSMenuItem, at index: Int, in menu: NSMenu) {
guard let openLinkItem = menu.item(with: .openLink) else {
assertionFailure("WKMenuItemIdentifierCopyLink item not found")
return
}
menu.insertItem(self.addLinkToBookmarksMenuItem(from: openLinkItem), at: index)
menu.replaceItem(at: index + 1, with: self.copyLinkMenuItem(from: openLinkItem))
menu.replaceItem(at: index + 1, with: self.copyLinkMenuItem(withTitle: copyLinkItem.title, from: openLinkItem))
}

private func handleCopyImageItem(_ item: NSMenuItem, at index: Int, in menu: NSMenu) {
Expand Down Expand Up @@ -200,8 +200,8 @@ private extension ContextMenuManager {
withIdentifierIn: [.downloadLinkedFile, .downloadMedia])
}

func copyLinkMenuItem(from item: NSMenuItem) -> NSMenuItem {
makeMenuItem(withTitle: item.title, action: #selector(copyLink), from: item, with: .openLink)
func copyLinkMenuItem(withTitle title: String, from openLinkItem: NSMenuItem) -> NSMenuItem {
makeMenuItem(withTitle: title, action: #selector(copyLink), from: openLinkItem, with: .openLink)
}

func copyImageAddressMenuItem(from item: NSMenuItem) -> NSMenuItem {
Expand Down
39 changes: 22 additions & 17 deletions DuckDuckGo/Browser Tab/Model/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,26 @@ extension Tab: WKNavigationDelegate {
@MainActor
func webView(_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {


switch await contextMenuManager.decidePolicy(for: navigationAction) {
case .instantAllow:
return .allow
case .newTab(selected: let selected):
guard let url = navigationAction.request.url else { return .cancel }
self.delegate?.tab(
self,
requestedNewTabWith: .url(url),
selected: selected
)
return .cancel
case .cancel:
return .cancel
case .download:
return .download(navigationAction, using: webView)
case .none:
break
}

if let policy = privatePlayer.decidePolicy(for: navigationAction, in: self) {
return policy
}
Expand All @@ -1253,22 +1272,8 @@ extension Tab: WKNavigationDelegate {
let isMiddleButtonClicked = navigationAction.buttonNumber == Constants.webkitMiddleClick

// to be modularized later on, see https://app.asana.com/0/0/1203268245242140/f
var isRequestingNewTab = (isLinkActivated && NSApp.isCommandPressed) || isMiddleButtonClicked || isNavigatingAwayFromPinnedTab
var shouldSelectNewTab = NSApp.isShiftPressed || (isNavigatingAwayFromPinnedTab && !isMiddleButtonClicked && !NSApp.isCommandPressed)

switch await contextMenuManager.decidePolicy(for: navigationAction) {
case .instantAllow:
return .allow
case .newTab(selected: let selected):
isRequestingNewTab = true
shouldSelectNewTab = shouldSelectNewTab || selected
case .cancel:
return .cancel
case .download:
return .download(navigationAction, using: webView)
case .none:
break
}
let isRequestingNewTab = (isLinkActivated && NSApp.isCommandPressed) || isMiddleButtonClicked || isNavigatingAwayFromPinnedTab
let shouldSelectNewTab = NSApp.isShiftPressed || (isNavigatingAwayFromPinnedTab && !isMiddleButtonClicked && !NSApp.isCommandPressed)

// This check needs to happen before GPC checks. Otherwise the navigation type may be rewritten to `.other`
// which would skip link rewrites.
Expand Down
11 changes: 4 additions & 7 deletions DuckDuckGo/Common/Extensions/NSViewExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ extension NSView {
}

func addAndLayout(_ subView: NSView) {
subView.translatesAutoresizingMaskIntoConstraints = false
subView.frame = bounds
subView.autoresizingMask = [.height, .width]
subView.translatesAutoresizingMaskIntoConstraints = true
addSubview(subView)

subView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
subView.topAnchor.constraint(equalTo: topAnchor).isActive = true
subView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
subView.widthAnchor.constraint(equalTo: widthAnchor).isActive = true
}
}

func wrappedInContainer(padding: CGFloat = 0) -> NSView {
return wrappedInContainer(padding: NSEdgeInsets(top: padding, left: padding, bottom: padding, right: padding))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import BrowserServicesKit
final class AppPrivacyConfigurationDataProvider: EmbeddedDataProvider {

public struct Constants {
public static let embeddedDataETag = "\"32bd8d6e10b78a0e0fb65bd354828262\""
public static let embeddedDataSHA = "7a0acb71de41f166c915cbe001c8f9b7de71dbe90d346e85881026daa15820c1"
public static let embeddedDataETag = "\"06522476e2e84022db27c831190d7512\""
public static let embeddedDataSHA = "55e820db38088306297ee47078769db6f7b9177c5e9bed50b7b54b40fae32cb5"
}

var embeddedDataEtag: String {
Expand Down
33 changes: 29 additions & 4 deletions DuckDuckGo/Content Blocker/macos-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"readme": "https://github.com/duckduckgo/privacy-configuration",
"version": 1668602428954,
"version": 1669370108102,
"features": {
"adClickAttribution": {
"readme": "https://help.duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/#3rd-party-tracker-loading-protection",
Expand Down Expand Up @@ -69,6 +69,10 @@
{
"domain": "www.audiosciencereview.com",
"reason": "Pages on the site end up in redirect loops in Firefox."
},
{
"domain": "identity.ibs.bankwest.com.au",
"reason": "Breaks auth flow: https://github.com/duckduckgo/duckduckgo-privacy-extension/issues/1545"
}
],
"settings": {
Expand All @@ -95,7 +99,7 @@
]
},
"state": "enabled",
"hash": "8668c1396cf49ac18e2e057c48dac1a7"
"hash": "62576f16d5b019c8d22cc289c2be6ebd"
},
"autoconsent": {
"exceptions": [
Expand Down Expand Up @@ -1601,7 +1605,7 @@
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/362"
},
{
"rule": "static-app.klaviyo.com/",
"rule": "klaviyo.com/",
"domains": [
"kmail-lists.com"
],
Expand Down Expand Up @@ -2123,13 +2127,27 @@
],
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/477"
},
{
"rule": "api.usercentrics.eu/translations",
"domains": [
"<all>"
],
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/477"
},
{
"rule": "app.usercentrics.eu/browser",
"domains": [
"<all>"
],
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/477"
},
{
"rule": "app.usercentrics.eu/session/",
"domains": [
"<all>"
],
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/477"
},
{
"rule": "graphql.usercentrics.eu/graphql",
"domains": [
Expand All @@ -2143,6 +2161,13 @@
"<all>"
],
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/477"
},
{
"rule": "aggregator.service.usercentrics.eu/aggregate",
"domains": [
"<all>"
],
"reason": "https://github.com/duckduckgo/privacy-configuration/issues/477"
}
]
},
Expand Down Expand Up @@ -3057,7 +3082,7 @@
}
},
"exceptions": [],
"hash": "9c7dae13e3e27b5e84ca385eb00d7b2e"
"hash": "0541ca019ebe167e193a84e51e52b8a2"
},
"trackingCookies1p": {
"settings": {
Expand Down
3 changes: 1 addition & 2 deletions DuckDuckGo/Navigation Bar/View/NavigationBarPopovers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ final class NavigationBarPopovers {
let popover = passwordManagementPopover ?? PasswordManagementPopover()
passwordManagementPopover = popover
popover.delegate = delegate
popover.select(category: selectedCategory)

show(popover: popover, usingView: view)
popover.select(category: selectedCategory)
}

func hasAnySavePopoversVisible() -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ final class PasswordManagementItemListModel: ObservableObject {

func selectLoginWithDomainOrFirst(domain: String, notify: Bool = true) {
for section in displayedItems {
if let account = section.items.first(where: { $0.websiteAccount?.domain == domain }) {
if let account = section.items.first(where: { $0.websiteAccount?.domain.droppingWwwPrefix() == domain.droppingWwwPrefix() }) {
selected(item: account, notify: notify)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ final class PasswordManagementViewController: NSViewController {
// Only select the matching item directly if macOS 11 is available, as 10.15 doesn't support scrolling directly to a given
// item in SwiftUI. On 10.15, show the matching item by filtering the search bar automatically instead.
if #available(macOS 11.0, *) {
refetchWithText("", selectItemMatchingDomain: domain?.droppingWwwPrefix(), clearWhenNoMatches: true)
refetchWithText("", selectItemMatchingDomain: domain, clearWhenNoMatches: true)
} else {
refetchWithText(isDirty ? "" : domain ?? "", clearWhenNoMatches: true)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<html>
<head>
<title>Icon Overlays Integration Tests</title>
<style type="text/css">
#thumbnail {
height: 100px;
width: 200px;
margin: 5px;
background: lightblue;
border: 1px solid black;
float: left;
}

#thumbnail img {
width: 100%;
height: 100%;
}

#playlist {
clear: both;
width: 100px;

}

#playlist #items {
height: 150px;
overflow: auto;
}

#playlist #thumbnail {
width: 90px;
height: 50px;
}

#loaded {
clear: both;
float: none;
width: 300px;
}

h2 {
padding-top: 2em;
}
</style>
</head>
<body>
<div id="initial"></div>
<div id="loaded"></div>

<script type="text/javascript">
const thumbnail = id => `<a id="thumbnail" href="/watch?v=${id}"><img src="//:0"></a>`;
const thumbnails = title => (title ? '<h2>'+title+'</h2>' : '') + '<div class="thumbnails" data-testid="'+title+'">' + ([1,2,3,4,5]).map(thumbnail).join('') + '</div>';
const playlist = title => `<div id="playlist"><h2>${title}</h2><div id="items" class="playlist-items" data-testid="${title}">${thumbnails()}</div></div>`;

document.querySelector('#initial').innerHTML = thumbnails('THUMBNAILS') + playlist('PLAYLIST') + thumbnails('MORE THUMBNAILS');

setTimeout(() => {
document.querySelector('#loaded').innerHTML = thumbnails('LOADED_THUMBNAILS') + thumbnails();
}, 1000);

</script>
</body>
</html>
309 changes: 114 additions & 195 deletions DuckDuckGo/Youtube Player/Resources/youtube_player_template.html

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions Unit Tests/Autoconsent/AutoconsentMessageProtocolTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,17 @@ class AutoconsentMessageProtocolTests: XCTestCase {
userScript.handleMessage(
replyHandler: {(msg: Any?, _: String?) in
expect.fulfill()
XCTAssertEqual(self.replyToJson(msg: msg!), """
{"config":{"autoAction":"optOut","detectRetries":20,"disabledCmps":[],"enabled":true,"enablePrehide":true},"rules":null,"type":"initResp"}
""")
guard let jsonData = try? JSONSerialization.data(withJSONObject: msg!, options: .sortedKeys),
let json = try? JSONSerialization.jsonObject(with: jsonData, options: []),
let dict = json as? [String: Any],
let config = dict["config"] as? [String: Any]
else {
XCTFail("Could not parse init response")
return
}

XCTAssertEqual(dict["type"] as? String, "initResp")
XCTAssertEqual(config["autoAction"] as? String, "optOut")
},
message: message
)
Expand Down
6 changes: 5 additions & 1 deletion js/youtube-player/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/dist
/dist
node_modules/
/test-results/
/playwright-report/
/playwright/.cache/
Loading

0 comments on commit 73e0d56

Please sign in to comment.