lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

July 2023

  • 1 participants
  • 91 discussions
[Git][tpo/applications/tor-browser][base-browser-115.0esrbase-13.0-1] Bug 41092: Add a RemoteSettings JSON dump for query-stripping
by ma1 (@ma1) 12 Jul '23

12 Jul '23
ma1 pushed to branch base-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 0a89389f by cypherpunks1 at 2023-07-13T00:40:56+02:00 Bug 41092: Add a RemoteSettings JSON dump for query-stripping - - - - - 2 changed files: - services/settings/static-dumps/main/moz.build - + services/settings/static-dumps/main/query-stripping.json Changes: ===================================== services/settings/static-dumps/main/moz.build ===================================== @@ -5,6 +5,7 @@ FINAL_TARGET_FILES.defaults.settings.main += [ "doh-config.json", "doh-providers.json", + "query-stripping.json", ] if CONFIG["MOZ_BUILD_APP"] == "browser": ===================================== services/settings/static-dumps/main/query-stripping.json ===================================== @@ -0,0 +1,44 @@ +{ + "data": [ + { + "schema": 1678379807899, + "allowList": [], + "stripList": [ + "gclid", + "dclid", + "msclkid", + "_openstat", + "yclid", + "wickedid", + "twclid", + "_hsenc", + "__hssc", + "__hstc", + "__hsfp", + "hsctatracking", + "wbraid", + "gbraid", + "ysclid" + ], + "id": "85078bad-f31e-4d93-bb8a-81088b25d6dd", + "last_modified": 1678736907773 + }, + { + "schema": 1649695008608, + "allowList": [], + "stripList": [ + "mc_eid", + "oly_anon_id", + "oly_enc_id", + "__s", + "vero_id", + "_hsenc", + "mkt_tok", + "fbclid" + ], + "id": "76495cfc-fac9-4079-9b5f-9ff0784484de", + "last_modified": 1649762862679 + } + ], + "timestamp": 1678736907773 +} View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0a89389… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0a89389… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.0esrbase-13.0-1] Bug 33955: When copying an image only copy the image contents to the clipboard
by richard (@richard) 12 Jul '23

12 Jul '23
richard pushed to branch base-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 53c25feb by cypherpunks1 at 2023-07-12T22:21:16+00:00 Bug 33955: When copying an image only copy the image contents to the clipboard - - - - - 2 changed files: - browser/base/content/browser-context.inc - dom/base/nsCopySupport.cpp Changes: ===================================== browser/base/content/browser-context.inc ===================================== @@ -219,7 +219,7 @@ #ifdef CONTEXT_COPY_IMAGE_CONTENTS <menuitem id="context-copyimage-contents" data-l10n-id="main-context-menu-image-copy" - oncommand="goDoCommand('cmd_copyImage');"/> + oncommand="goDoCommand('cmd_copyImageContents');"/> #endif <menuitem id="context-copyimage" data-l10n-id="main-context-menu-image-copy-link" ===================================== dom/base/nsCopySupport.cpp ===================================== @@ -503,7 +503,7 @@ nsresult nsCopySupport::ImageCopy(nsIImageLoadingContent* aImageElement, trans->SetReferrerInfo(referrerInfo); } -#ifdef XP_WIN +#if defined(XP_WIN) && !defined(BASE_BROWSER_VERSION) rv = AppendImagePromise(trans, imgRequest, aImageElement); NS_ENSURE_SUCCESS(rv, rv); #endif View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/53c25fe… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/53c25fe… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.0esrbase-13.0-1] Bug 33955: When copying an image only copy the image contents to the clipboard
by richard (@richard) 12 Jul '23

12 Jul '23
richard pushed to branch tor-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 1fde2e0f by cypherpunks1 at 2023-07-12T22:20:31+00:00 Bug 33955: When copying an image only copy the image contents to the clipboard - - - - - 2 changed files: - browser/base/content/browser-context.inc - dom/base/nsCopySupport.cpp Changes: ===================================== browser/base/content/browser-context.inc ===================================== @@ -219,7 +219,7 @@ #ifdef CONTEXT_COPY_IMAGE_CONTENTS <menuitem id="context-copyimage-contents" data-l10n-id="main-context-menu-image-copy" - oncommand="goDoCommand('cmd_copyImage');"/> + oncommand="goDoCommand('cmd_copyImageContents');"/> #endif <menuitem id="context-copyimage" data-l10n-id="main-context-menu-image-copy-link" ===================================== dom/base/nsCopySupport.cpp ===================================== @@ -503,7 +503,7 @@ nsresult nsCopySupport::ImageCopy(nsIImageLoadingContent* aImageElement, trans->SetReferrerInfo(referrerInfo); } -#ifdef XP_WIN +#if defined(XP_WIN) && !defined(BASE_BROWSER_VERSION) rv = AppendImagePromise(trans, imgRequest, aImageElement); NS_ENSURE_SUCCESS(rv, rv); #endif View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1fde2e0… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1fde2e0… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.0esrbase-13.0-1] 2 commits: fixup! Firefox preference overrides.
by ma1 (@ma1) 12 Jul '23

12 Jul '23
ma1 pushed to branch tor-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 44eff978 by cypherpunks1 at 2023-07-12T14:35:28+00:00 fixup! Firefox preference overrides. Bug 41092: Enable URL query stripping to protect against cross-site tracking - - - - - 9740e17d by cypherpunks1 at 2023-07-12T14:35:28+00:00 Bug 41092: Add a RemoteSettings JSON dump for query-stripping - - - - - 3 changed files: - browser/app/profile/001-base-profile.js - services/settings/static-dumps/main/moz.build - + services/settings/static-dumps/main/query-stripping.json Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -505,6 +505,11 @@ pref("corroborator.enabled", false); // stop using .textContent. pref("intl.multilingual.liveReload", false); +// Enable URL query stripping to protect against cross-site tracking (tor-browser#41092) +pref("privacy.query_stripping.enabled", true); +pref("privacy.query_stripping.enabled.pbmode", true); +pref("privacy.query_stripping.strip_on_share.enabled", true); + #ifdef XP_WIN // prefs to disable jump-list entries in the taskbar on Windows (see bug #12885) // this pref changes the app's set AUMID to be dependent on the profile path, rather than ===================================== services/settings/static-dumps/main/moz.build ===================================== @@ -5,6 +5,7 @@ FINAL_TARGET_FILES.defaults.settings.main += [ "doh-config.json", "doh-providers.json", + "query-stripping.json", ] if CONFIG["MOZ_BUILD_APP"] == "browser": ===================================== services/settings/static-dumps/main/query-stripping.json ===================================== @@ -0,0 +1,44 @@ +{ + "data": [ + { + "schema": 1678379807899, + "allowList": [], + "stripList": [ + "gclid", + "dclid", + "msclkid", + "_openstat", + "yclid", + "wickedid", + "twclid", + "_hsenc", + "__hssc", + "__hstc", + "__hsfp", + "hsctatracking", + "wbraid", + "gbraid", + "ysclid" + ], + "id": "85078bad-f31e-4d93-bb8a-81088b25d6dd", + "last_modified": 1678736907773 + }, + { + "schema": 1649695008608, + "allowList": [], + "stripList": [ + "mc_eid", + "oly_anon_id", + "oly_enc_id", + "__s", + "vero_id", + "_hsenc", + "mkt_tok", + "fbclid" + ], + "id": "76495cfc-fac9-4079-9b5f-9ff0784484de", + "last_modified": 1649762862679 + } + ], + "timestamp": 1678736907773 +} View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5b4fa6… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5b4fa6… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.0esrbase-13.0-1] Bug 41791: Omit the source URL when copying page contents to the clipboard
by richard (@richard) 12 Jul '23

12 Jul '23
richard pushed to branch base-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 6c9e419d by cypherpunks1 at 2023-07-12T14:29:21+00:00 Bug 41791: Omit the source URL when copying page contents to the clipboard - - - - - 2 changed files: - dom/base/nsCopySupport.cpp - widget/windows/nsDataObj.cpp Changes: ===================================== dom/base/nsCopySupport.cpp ===================================== @@ -284,6 +284,7 @@ static nsresult CreateTransferable( NS_ENSURE_SUCCESS(rv, rv); } +#if !defined(BASE_BROWSER_VERSION) // Try and get source URI of the items that are being dragged nsIURI* uri = aDocument.GetDocumentURI(); if (uri) { @@ -304,6 +305,7 @@ static nsresult CreateTransferable( NS_ENSURE_SUCCESS(rv, rv); } } +#endif } else { if (!aEncodedDocumentWithContext.mSerializationForTextUnicode.IsEmpty()) { // Add the unicode DataFlavor to the transferable ===================================== widget/windows/nsDataObj.cpp ===================================== @@ -520,11 +520,13 @@ nsDataObj::nsDataObj(nsIURI* uri) m_enumFE = new CEnumFormatEtc(); m_enumFE->AddRef(); +#if !defined(BASE_BROWSER_VERSION) if (uri) { // A URI was obtained, so pass this through to the DataObject // so it can create a SourceURL for CF_HTML flavour uri->GetSpec(mSourceURL); } +#endif } //----------------------------------------------------- // destruction @@ -1978,6 +1980,7 @@ nsresult nsDataObj ::BuildPlatformHTML(const char* inOurHTML, *outPlatformHTML = nullptr; nsDependentCString inHTMLString(inOurHTML); +#if !defined(BASE_BROWSER_VERSION) // Do we already have mSourceURL from a drag? if (mSourceURL.IsEmpty()) { nsAutoString url; @@ -1985,6 +1988,7 @@ nsresult nsDataObj ::BuildPlatformHTML(const char* inOurHTML, AppendUTF16toUTF8(url, mSourceURL); } +#endif constexpr auto kStartHTMLPrefix = "Version:0.9\r\nStartHTML:"_ns; constexpr auto kEndHTMLPrefix = "\r\nEndHTML:"_ns; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/6c9e419… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/6c9e419… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.0esrbase-13.0-1] Bug 41791: Omit the source URL when copying page contents to the clipboard
by richard (@richard) 12 Jul '23

12 Jul '23
richard pushed to branch tor-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 5b4fa6e2 by cypherpunks1 at 2023-07-12T14:27:48+00:00 Bug 41791: Omit the source URL when copying page contents to the clipboard - - - - - 2 changed files: - dom/base/nsCopySupport.cpp - widget/windows/nsDataObj.cpp Changes: ===================================== dom/base/nsCopySupport.cpp ===================================== @@ -284,6 +284,7 @@ static nsresult CreateTransferable( NS_ENSURE_SUCCESS(rv, rv); } +#if !defined(BASE_BROWSER_VERSION) // Try and get source URI of the items that are being dragged nsIURI* uri = aDocument.GetDocumentURI(); if (uri) { @@ -304,6 +305,7 @@ static nsresult CreateTransferable( NS_ENSURE_SUCCESS(rv, rv); } } +#endif } else { if (!aEncodedDocumentWithContext.mSerializationForTextUnicode.IsEmpty()) { // Add the unicode DataFlavor to the transferable ===================================== widget/windows/nsDataObj.cpp ===================================== @@ -520,11 +520,13 @@ nsDataObj::nsDataObj(nsIURI* uri) m_enumFE = new CEnumFormatEtc(); m_enumFE->AddRef(); +#if !defined(BASE_BROWSER_VERSION) if (uri) { // A URI was obtained, so pass this through to the DataObject // so it can create a SourceURL for CF_HTML flavour uri->GetSpec(mSourceURL); } +#endif } //----------------------------------------------------- // destruction @@ -1978,6 +1980,7 @@ nsresult nsDataObj ::BuildPlatformHTML(const char* inOurHTML, *outPlatformHTML = nullptr; nsDependentCString inHTMLString(inOurHTML); +#if !defined(BASE_BROWSER_VERSION) // Do we already have mSourceURL from a drag? if (mSourceURL.IsEmpty()) { nsAutoString url; @@ -1985,6 +1988,7 @@ nsresult nsDataObj ::BuildPlatformHTML(const char* inOurHTML, AppendUTF16toUTF8(url, mSourceURL); } +#endif constexpr auto kStartHTMLPrefix = "Version:0.9\r\nStartHTML:"_ns; constexpr auto kEndHTMLPrefix = "\r\nEndHTML:"_ns; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5b4fa6e… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5b4fa6e… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-build][maint-12.5] Bug 40889: Add mullvad sha256sums URL to...
by richard (@richard) 12 Jul '23

12 Jul '23
richard pushed to branch maint-12.5 at The Tor Project / Applications / tor-browser-build Commits: 8140af32 by Nicolas Vigier at 2023-07-12T13:56:25+00:00 Bug 40889: Add mullvad sha256sums URL to download-unsigned-sha256sums-gpg-signatures-from-people-tpo - - - - - 2 changed files: - + keyring/jb.gpg - tools/signing/download-unsigned-sha256sums-gpg-signatures-from-people-tpo Changes: ===================================== keyring/jb.gpg ===================================== Binary files /dev/null and b/keyring/jb.gpg differ ===================================== tools/signing/download-unsigned-sha256sums-gpg-signatures-from-people-tpo ===================================== @@ -3,16 +3,24 @@ set -e script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source "$script_dir/functions" -for builder in $tb_builders +for builder in $tb_builders jb do - for file in sha256sums-unsigned-build.txt.asc sha256sums-unsigned-build.incrementals.txt.asc + for file in sha256sums-unsigned-build.txt sha256sums-unsigned-build.incrementals.txt do tmpfile=$(mktemp) chmod 644 "$tmpfile" - for url in \ - "https://people.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$tbb_ve…" \ - "https://tb-build-04.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" \ - "https://tb-build-05.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" + if test "$builder" = 'jb'; then + file="$file.gpg" + urls=("https://cdn.devmole.eu/hashes//$SIGNING_PROJECTNAME/$tbb_version-build$tbb_…") + else + file="$file.asc" + urls=( \ + "https://people.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$tbb_ve…" \ + "https://tb-build-04.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" \ + "https://tb-build-05.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" \ + ) + fi + for url in "${urls[@]}" do if wget -q -O "$tmpfile" "$url"; then mv "$tmpfile" "$signed_version_dir/$file-$builder" View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/8… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/8… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-build][main] Bug 40889: Add mullvad sha256sums URL to...
by richard (@richard) 12 Jul '23

12 Jul '23
richard pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: 3c23c8a8 by Nicolas Vigier at 2023-07-07T11:46:30+02:00 Bug 40889: Add mullvad sha256sums URL to download-unsigned-sha256sums-gpg-signatures-from-people-tpo - - - - - 2 changed files: - + keyring/jb.gpg - tools/signing/download-unsigned-sha256sums-gpg-signatures-from-people-tpo Changes: ===================================== keyring/jb.gpg ===================================== Binary files /dev/null and b/keyring/jb.gpg differ ===================================== tools/signing/download-unsigned-sha256sums-gpg-signatures-from-people-tpo ===================================== @@ -3,16 +3,24 @@ set -e script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source "$script_dir/functions" -for builder in $tb_builders +for builder in $tb_builders jb do - for file in sha256sums-unsigned-build.txt.asc sha256sums-unsigned-build.incrementals.txt.asc + for file in sha256sums-unsigned-build.txt sha256sums-unsigned-build.incrementals.txt do tmpfile=$(mktemp) chmod 644 "$tmpfile" - for url in \ - "https://people.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$tbb_ve…" \ - "https://tb-build-04.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" \ - "https://tb-build-05.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" + if test "$builder" = 'jb'; then + file="$file.gpg" + urls=("https://cdn.devmole.eu/hashes//$SIGNING_PROJECTNAME/$tbb_version-build$tbb_…") + else + file="$file.asc" + urls=( \ + "https://people.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$tbb_ve…" \ + "https://tb-build-04.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" \ + "https://tb-build-05.torproject.org/~$builder/builds/$SIGNING_PROJECTNAME/$t…" \ + ) + fi + for url in "${urls[@]}" do if wget -q -O "$tmpfile" "$url"; then mv "$tmpfile" "$signed_version_dir/$file-$builder" View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/3… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/3… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.0esrbase-13.0-1] Bug 41854: Allow overriding download spam protection.
by richard (@richard) 11 Jul '23

11 Jul '23
richard pushed to branch base-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 84e468a9 by hackademix at 2023-07-11T22:19:11+00:00 Bug 41854: Allow overriding download spam protection. - - - - - 4 changed files: - browser/components/downloads/DownloadSpamProtection.sys.mjs - toolkit/components/downloads/DownloadCore.sys.mjs - toolkit/components/downloads/DownloadIntegration.sys.mjs - uriloader/exthandler/nsExternalHelperAppService.cpp Changes: ===================================== browser/components/downloads/DownloadSpamProtection.sys.mjs ===================================== @@ -94,8 +94,9 @@ class WindowSpamProtection { * Add a blocked download to the spamList or increment the count of an * existing blocked download, then notify listeners about this. * @param {String} url + * @param {DownloadSpamEnabler} enabler */ - addDownloadSpam(url) { + addDownloadSpam(url, enabler) { this._blocking = true; // Start listening on registered downloads views, if any exist. this._maybeAddViews(); @@ -109,7 +110,7 @@ class WindowSpamProtection { } // Otherwise, create a new DownloadSpam object for the URL, add it to the // spamList, and open the downloads panel. - let downloadSpam = new DownloadSpam(url); + let downloadSpam = new DownloadSpam(url, enabler); this.spamList.add(downloadSpam); this._downloadSpamForUrl.set(url, downloadSpam); this._notifyDownloadSpamAdded(downloadSpam); @@ -193,6 +194,39 @@ class WindowSpamProtection { } } +/** + * Helper to grant a certain principal permission for automatic downloads + * and to clear its download spam messages from the UI + */ +class DownloadSpamEnabler{ + /** + * Constructs a DownloadSpamEnabler object + * @param {nsIPrincipal} principal + * @param {DownloadSpamProtection} downloadSpamProtection + */ + constructor(principal, downloadSpamProtection) { + this.principal = principal; + this.downloadSpamProtection = downloadSpamProtection; + } + /** + * Allows a DownloadSpam item + * @param {DownloadSpam} downloadSpam + */ + allow(downloadSpam) { + const pm = Services.perms; + pm.addFromPrincipal( + this.principal, + "automatic-download", + pm.ALLOW_ACTION, + pm.EXPIRE_SESSION + ); + downloadSpam.hasBlockedData = downloadSpam.hasPartialData = false; + const {url} = downloadSpam.source; + for (let window of lazy.BrowserWindowTracker.orderedWindows) { + this.downloadSpamProtection.removeDownloadSpamForWindow(url, window); + } + } +} /** * Responsible for detecting events related to downloads spam and notifying the * relevant window's WindowSpamProtection object. This is a singleton object, @@ -210,9 +244,11 @@ export class DownloadSpamProtection { * download was blocked. This is invoked when a download is blocked by * nsExternalAppHandler::IsDownloadSpam * @param {String} url - * @param {Window} window + * @param {nsILoadInfo} loadInfo */ - update(url, window) { + update(url, loadInfo) { + loadInfo = loadInfo.QueryInterface(Ci.nsILoadInfo); + const window = loadInfo.browsingContext.topChromeWindow; if (window == null) { lazy.DownloadsCommon.log( "Download spam blocked in a non-chrome window. URL: ", @@ -226,7 +262,7 @@ export class DownloadSpamProtection { let wsp = this._forWindowMap.get(window) ?? new WindowSpamProtection(window); this._forWindowMap.set(window, wsp); - wsp.addDownloadSpam(url); + wsp.addDownloadSpam(url, new DownloadSpamEnabler(loadInfo.triggeringPrincipal, this)); } /** @@ -285,8 +321,9 @@ export class DownloadSpamProtection { * @extends Download */ class DownloadSpam extends Download { - constructor(url) { + constructor(url, downloadSpamEnabler) { super(); + this._downloadSpamEnabler = downloadSpamEnabler; this.hasBlockedData = true; this.stopped = true; this.error = new DownloadError({ @@ -297,4 +334,13 @@ class DownloadSpam extends Download { this.source = { url }; this.blockedDownloadsCount = 1; } + + /** + * Allows the principal which triggered this download to perform automatic downloads + * and clears the UI from messages reporting this download spam + */ + allow() { + this._downloadSpamEnabler.allow(this); + this._notifyChange(); + } } ===================================== toolkit/components/downloads/DownloadCore.sys.mjs ===================================== @@ -713,6 +713,10 @@ Download.prototype = { } this._promiseUnblock = (async () => { + if (this.allow) { + this.allow(); + return; + } try { await IOUtils.move(this.target.partFilePath, this.target.path); await this.target.refresh(); @@ -721,7 +725,6 @@ Download.prototype = { this._promiseUnblock = null; throw ex; } - this.succeeded = true; this.hasBlockedData = false; this._notifyChange(); @@ -951,7 +954,9 @@ Download.prototype = { await this._promiseCanceled; } // Ask the saver object to remove any partial data. - await this.saver.removeData(); + if (this.saver) { + await this.saver.removeData(); + } // For completeness, clear the number of bytes transferred. if (this.currentBytes != 0 || this.hasPartialData) { this.currentBytes = 0; ===================================== toolkit/components/downloads/DownloadIntegration.sys.mjs ===================================== @@ -1162,7 +1162,7 @@ var DownloadObserver = { DownloadIntegration._initializeDownloadSpamProtection(); DownloadIntegration.downloadSpamProtection.update( aData, - aSubject.topChromeWindow + aSubject ); } break; ===================================== uriloader/exthandler/nsExternalHelperAppService.cpp ===================================== @@ -1907,13 +1907,11 @@ bool nsExternalAppHandler::IsDownloadSpam(nsIChannel* aChannel) { if (capability == nsIPermissionManager::PROMPT_ACTION) { nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); - RefPtr<BrowsingContext> browsingContext; - loadInfo->GetBrowsingContext(getter_AddRefs(browsingContext)); nsAutoCString cStringURI; loadInfo->TriggeringPrincipal()->GetPrePath(cStringURI); observerService->NotifyObservers( - browsingContext, "blocked-automatic-download", + loadInfo, "blocked-automatic-download", NS_ConvertASCIItoUTF16(cStringURI.get()).get()); // FIXME: In order to escape memory leaks, currently we cancel blocked // downloads. This is temporary solution, because download data should be View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/84e468a… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/84e468a… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.0esrbase-13.0-1] Bug 41854: Allow overriding download spam protection.
by richard (@richard) 11 Jul '23

11 Jul '23
richard pushed to branch tor-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 5d4adde4 by hackademix at 2023-07-11T21:46:55+00:00 Bug 41854: Allow overriding download spam protection. - - - - - 4 changed files: - browser/components/downloads/DownloadSpamProtection.sys.mjs - toolkit/components/downloads/DownloadCore.sys.mjs - toolkit/components/downloads/DownloadIntegration.sys.mjs - uriloader/exthandler/nsExternalHelperAppService.cpp Changes: ===================================== browser/components/downloads/DownloadSpamProtection.sys.mjs ===================================== @@ -94,8 +94,9 @@ class WindowSpamProtection { * Add a blocked download to the spamList or increment the count of an * existing blocked download, then notify listeners about this. * @param {String} url + * @param {DownloadSpamEnabler} enabler */ - addDownloadSpam(url) { + addDownloadSpam(url, enabler) { this._blocking = true; // Start listening on registered downloads views, if any exist. this._maybeAddViews(); @@ -109,7 +110,7 @@ class WindowSpamProtection { } // Otherwise, create a new DownloadSpam object for the URL, add it to the // spamList, and open the downloads panel. - let downloadSpam = new DownloadSpam(url); + let downloadSpam = new DownloadSpam(url, enabler); this.spamList.add(downloadSpam); this._downloadSpamForUrl.set(url, downloadSpam); this._notifyDownloadSpamAdded(downloadSpam); @@ -193,6 +194,39 @@ class WindowSpamProtection { } } +/** + * Helper to grant a certain principal permission for automatic downloads + * and to clear its download spam messages from the UI + */ +class DownloadSpamEnabler{ + /** + * Constructs a DownloadSpamEnabler object + * @param {nsIPrincipal} principal + * @param {DownloadSpamProtection} downloadSpamProtection + */ + constructor(principal, downloadSpamProtection) { + this.principal = principal; + this.downloadSpamProtection = downloadSpamProtection; + } + /** + * Allows a DownloadSpam item + * @param {DownloadSpam} downloadSpam + */ + allow(downloadSpam) { + const pm = Services.perms; + pm.addFromPrincipal( + this.principal, + "automatic-download", + pm.ALLOW_ACTION, + pm.EXPIRE_SESSION + ); + downloadSpam.hasBlockedData = downloadSpam.hasPartialData = false; + const {url} = downloadSpam.source; + for (let window of lazy.BrowserWindowTracker.orderedWindows) { + this.downloadSpamProtection.removeDownloadSpamForWindow(url, window); + } + } +} /** * Responsible for detecting events related to downloads spam and notifying the * relevant window's WindowSpamProtection object. This is a singleton object, @@ -210,9 +244,11 @@ export class DownloadSpamProtection { * download was blocked. This is invoked when a download is blocked by * nsExternalAppHandler::IsDownloadSpam * @param {String} url - * @param {Window} window + * @param {nsILoadInfo} loadInfo */ - update(url, window) { + update(url, loadInfo) { + loadInfo = loadInfo.QueryInterface(Ci.nsILoadInfo); + const window = loadInfo.browsingContext.topChromeWindow; if (window == null) { lazy.DownloadsCommon.log( "Download spam blocked in a non-chrome window. URL: ", @@ -226,7 +262,7 @@ export class DownloadSpamProtection { let wsp = this._forWindowMap.get(window) ?? new WindowSpamProtection(window); this._forWindowMap.set(window, wsp); - wsp.addDownloadSpam(url); + wsp.addDownloadSpam(url, new DownloadSpamEnabler(loadInfo.triggeringPrincipal, this)); } /** @@ -285,8 +321,9 @@ export class DownloadSpamProtection { * @extends Download */ class DownloadSpam extends Download { - constructor(url) { + constructor(url, downloadSpamEnabler) { super(); + this._downloadSpamEnabler = downloadSpamEnabler; this.hasBlockedData = true; this.stopped = true; this.error = new DownloadError({ @@ -297,4 +334,13 @@ class DownloadSpam extends Download { this.source = { url }; this.blockedDownloadsCount = 1; } + + /** + * Allows the principal which triggered this download to perform automatic downloads + * and clears the UI from messages reporting this download spam + */ + allow() { + this._downloadSpamEnabler.allow(this); + this._notifyChange(); + } } ===================================== toolkit/components/downloads/DownloadCore.sys.mjs ===================================== @@ -713,6 +713,10 @@ Download.prototype = { } this._promiseUnblock = (async () => { + if (this.allow) { + this.allow(); + return; + } try { await IOUtils.move(this.target.partFilePath, this.target.path); await this.target.refresh(); @@ -721,7 +725,6 @@ Download.prototype = { this._promiseUnblock = null; throw ex; } - this.succeeded = true; this.hasBlockedData = false; this._notifyChange(); @@ -951,7 +954,9 @@ Download.prototype = { await this._promiseCanceled; } // Ask the saver object to remove any partial data. - await this.saver.removeData(); + if (this.saver) { + await this.saver.removeData(); + } // For completeness, clear the number of bytes transferred. if (this.currentBytes != 0 || this.hasPartialData) { this.currentBytes = 0; ===================================== toolkit/components/downloads/DownloadIntegration.sys.mjs ===================================== @@ -1162,7 +1162,7 @@ var DownloadObserver = { DownloadIntegration._initializeDownloadSpamProtection(); DownloadIntegration.downloadSpamProtection.update( aData, - aSubject.topChromeWindow + aSubject ); } break; ===================================== uriloader/exthandler/nsExternalHelperAppService.cpp ===================================== @@ -1907,13 +1907,11 @@ bool nsExternalAppHandler::IsDownloadSpam(nsIChannel* aChannel) { if (capability == nsIPermissionManager::PROMPT_ACTION) { nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); - RefPtr<BrowsingContext> browsingContext; - loadInfo->GetBrowsingContext(getter_AddRefs(browsingContext)); nsAutoCString cStringURI; loadInfo->TriggeringPrincipal()->GetPrePath(cStringURI); observerService->NotifyObservers( - browsingContext, "blocked-automatic-download", + loadInfo, "blocked-automatic-download", NS_ConvertASCIItoUTF16(cStringURI.get()).get()); // FIXME: In order to escape memory leaks, currently we cancel blocked // downloads. This is temporary solution, because download data should be View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5d4adde… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5d4adde… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.