tor-commits
Threads by month
- ----- 2025 -----
- 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
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2021
- 17 participants
- 1287 discussions

02 Jun '21
commit d8fd57da4a777f2b413170e00dc59d1adb0707fa
Author: Matthew Finkel <sysrqb(a)torproject.org>
Date: Wed Jun 2 15:55:41 2021 +0000
Add new Tor Browser (Desktop) version 10.0.17
---
databags/versions.ini | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/databags/versions.ini b/databags/versions.ini
index 0bc9ca3a..ba857f9b 100644
--- a/databags/versions.ini
+++ b/databags/versions.ini
@@ -1,15 +1,15 @@
[torbrowser-stable]
-version = 10.0.16
-win32 = 0.4.5.7
+version = 10.0.17
+win32 = 0.4.5.8
[torbrowser-android-stable]
version = 10.0.16
[torbrowser-win-stable]
-version = 10.0.16
+version = 10.0.17
[torbrowser-linux-stable]
-version = 10.0.16
+version = 10.0.17
[torbrowser-alpha]
version = 10.5a15
1
0

[translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
by translation@torproject.org 02 Jun '21
by translation@torproject.org 02 Jun '21
02 Jun '21
commit 228fa3b70713143bd2b8650489b06caf455bbda0
Author: Translation commit bot <translation(a)torproject.org>
Date: Wed Jun 2 15:46:38 2021 +0000
https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
pl.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pl.po b/pl.po
index cb7f8ff3df..4372983276 100644
--- a/pl.po
+++ b/pl.po
@@ -24,7 +24,7 @@
# phla47 <phla47(a)gmail.com>, 2013
# sebx, 2013-2015
# sebx, 2015
-# Waldemar Stoczkowski, 2019-2020
+# Waldis, 2019-2020
msgid ""
msgstr ""
"Project-Id-Version: Tor Project\n"
1
0

[Git][tpo/applications/fenix] Pushed new tag tor-browser-89.1.1-10.5-1-build1
by Matthew Finkel (@sysrqb) 02 Jun '21
by Matthew Finkel (@sysrqb) 02 Jun '21
02 Jun '21
Matthew Finkel pushed new tag tor-browser-89.1.1-10.5-1-build1 at The Tor Project / Applications / fenix
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/tree/tor-browser-89.…
You're receiving this email because of your account on gitlab.torproject.org.
1
0

02 Jun '21
commit 41123dc2413e37e6dc45c291765795b2a5ad5d6c
Author: Matthew Finkel <sysrqb(a)torproject.org>
Date: Wed Jun 2 14:04:48 2021 +0000
Release preparations for 10.5a16
Versions bump and Changelog update
---
projects/firefox/config | 2 +-
projects/go/config | 4 +-
.../tor-browser/Bundle-Data/Docs/ChangeLog.txt | 23 ++
projects/tor-browser/allowed_addons.json | 276 ++++++++++-----------
projects/tor-browser/config | 4 +-
projects/tor/config | 2 +-
rbm.conf | 4 +-
7 files changed, 169 insertions(+), 146 deletions(-)
diff --git a/projects/firefox/config b/projects/firefox/config
index d12ae9a..e5ba431 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -8,7 +8,7 @@ git_submodule: 1
gpg_keyring: torbutton.gpg
var:
- firefox_platform_version: 78.10.0
+ firefox_platform_version: 78.11.0
firefox_version: '[% c("var/firefox_platform_version") %]esr'
torbrowser_branch: 10.5
branding_directory: 'browser/branding/alpha'
diff --git a/projects/go/config b/projects/go/config
index f31ef61..ec6ed92 100644
--- a/projects/go/config
+++ b/projects/go/config
@@ -1,5 +1,5 @@
# vim: filetype=yaml sw=2
-version: 1.15.11
+version: 1.15.12
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
var:
@@ -118,7 +118,7 @@ input_files:
enable: '[% ! c("var/linux") %]'
- URL: 'https://golang.org/dl/go[% c("version") %].src.tar.gz'
name: go
- sha256sum: f25b2441d4c76cf63cde94d59bab237cc33e8a2a139040d904c8630f46d061e5
+ sha256sum: 1c6911937df4a277fa74e7b7efc3d08594498c4c4adc0b6c4ae3566137528091
- URL: 'https://golang.org/dl/go[% c("var/go14_version") %].src.tar.gz'
name: go14
sha256sum: 9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
diff --git a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
index 3ca5415..56f83a7 100644
--- a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
+++ b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
@@ -1,3 +1,26 @@
+Tor Browser 10.5a16 -- June 5 2021
+ * All Platforms
+ * Update NoScript to 11.2.8
+ * Update Tor to 0.4.6.4-rc
+ * Bug 40432: Prevent probing installed applications [tor-browser]
+ * Windows + OS X + Linux
+ * Update Firefox to 78.11.0esr
+ * Bug 27476: Implement about:torconnect captive portal within Tor Browser [tor-browser]
+ * Bug 40037: Announce v2 onion service deprecation on about:tor [torbutton]
+ * Bug 40428: Correct minor Cryptocurrency warning string typo [tor-browser]
+ * Android
+ * Update Fenix to 89.1.1
+ * Bug 40055: Rebase android-componets patches on 75.0.22 for Fenix 89 [android-components]
+ * Bug 40165: Announce v2 onion service deprecation on about:tor [fenix]
+ * Bug 40169: Rebase fenix patches to fenix v89.1.1 [fenix]
+ * Bug 40170: Error building tor-browser-89.1.1-10.5-1 [fenix]
+ * Bug 40453: Rebase tor-browser patches to 89.0 [tor-browser]
+ * Build System
+ * All Platforms
+ * Update Go to 1.15.12
+ * Android
+ * Bug 40290: Update components for mozilla89-based Fenix [tor-browser-build]
+
Tor Browser 10.5a15 -- April 23 2021
* All Platforms
* Update Tor to 0.4.6.2-alpha
diff --git a/projects/tor-browser/allowed_addons.json b/projects/tor-browser/allowed_addons.json
index c5c5e18..9cd6b11 100644
--- a/projects/tor-browser/allowed_addons.json
+++ b/projects/tor-browser/allowed_addons.json
@@ -17,7 +17,7 @@
"picture_url": "https://addons.cdn.mozilla.net/user-media/userpics/13/13299/13299734.png?mo…"
}
],
- "average_daily_users": 612002,
+ "average_daily_users": 609068,
"categories": {
"android": [
"experimental",
@@ -31,7 +31,7 @@
"contributions_url": "https://opencollective.com/darkreader?utm_content=product-page-contribute&u…",
"created": "2017-09-19T07:03:00Z",
"current_version": {
- "id": 5219368,
+ "id": 5239111,
"compatibility": {
"firefox": {
"min": "54.0",
@@ -42,19 +42,19 @@
"max": "*"
}
},
- "edit_url": "https://addons.mozilla.org/en-US/developers/addon/darkreader/versions/52193…",
+ "edit_url": "https://addons.mozilla.org/en-US/developers/addon/darkreader/versions/52391…",
"files": [
{
- "id": 3763728,
- "created": "2021-04-21T13:54:44Z",
- "hash": "sha256:6d0d1ec5ba638bd0b897d3ff2b2e785770302b58c4ba0e735e10b3f9c4227bf6",
+ "id": 3783471,
+ "created": "2021-05-28T13:29:07Z",
+ "hash": "sha256:49e7ec13cfdb953dfb785a2442582788e895a5623956d0b7dff02f59db2e3159",
"is_restart_required": false,
"is_webextension": true,
"is_mozilla_signed_extension": false,
"platform": "all",
- "size": 535888,
+ "size": 541560,
"status": "public",
- "url": "https://addons.mozilla.org/firefox/downloads/file/3763728/dark_reader-4.9.3…",
+ "url": "https://addons.mozilla.org/firefox/downloads/file/3783471/dark_reader-4.9.3…",
"permissions": [
"storage",
"tabs",
@@ -97,10 +97,10 @@
"url": "http://www.opensource.org/licenses/mit-license.php"
},
"release_notes": {
- "en-US": "- Dynamic mode bug fixes.\n- Users' fixes for websites."
+ "en-US": "- Fixed disability to switch on sites in Global Dark List.\n- Bug fixes.\n- Users' fixes for websites."
},
"reviewed": null,
- "version": "4.9.32"
+ "version": "4.9.33"
},
"default_locale": "en-US",
"description": {
@@ -164,7 +164,7 @@
},
"is_disabled": false,
"is_experimental": false,
- "last_updated": "2021-04-21T15:04:05Z",
+ "last_updated": "2021-05-28T14:02:13Z",
"name": {
"ar": "Dark Reader",
"bn": "Dark Reader",
@@ -205,12 +205,12 @@
2400,
1500
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/201/201069.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/201/201069.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/201/201069.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/201/201069.jpg?mo…"
},
{
"id": 201070,
@@ -221,12 +221,12 @@
2400,
1500
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/201/201070.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/201/201070.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/201/201070.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/201/201070.jpg?mo…"
}
],
"promoted": {
@@ -237,10 +237,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.5588,
- "bayesian_average": 4.557413617113341,
- "count": 3586,
- "text_count": 1181
+ "average": 4.561,
+ "bayesian_average": 4.559622274063027,
+ "count": 3654,
+ "text_count": 1194
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/darkreader/reviews/",
"requires_payment": false,
@@ -337,7 +337,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/darkreader/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/darkreader/versions/",
- "weekly_downloads": 22377
+ "weekly_downloads": 21862
},
"notes": null
},
@@ -353,7 +353,7 @@
"picture_url": "https://addons.cdn.mozilla.net/user-media/userpics/5/5474/5474073.png?modif…"
}
],
- "average_daily_users": 727486,
+ "average_daily_users": 696905,
"categories": {
"android": [
"security-privacy"
@@ -470,12 +470,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/214/214771.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/214/214771.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/214/214771.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/214/214771.jpg?mo…"
}
],
"promoted": {
@@ -486,10 +486,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.6654,
- "bayesian_average": 4.662905382291137,
- "count": 2047,
- "text_count": 402
+ "average": 4.6659,
+ "bayesian_average": 4.663398110551469,
+ "count": 2065,
+ "text_count": 406
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/https-everywhere/reviews/",
"requires_payment": false,
@@ -523,7 +523,7 @@
"type": "extension",
"url": "https://www.eff.org/https-everywhere",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/https-everywhere/versions/",
- "weekly_downloads": 13172
+ "weekly_downloads": 14011
},
"notes": null
},
@@ -539,7 +539,7 @@
"picture_url": "https://addons.cdn.mozilla.net/user-media/userpics/6/6937/6937656.png?modif…"
}
],
- "average_daily_users": 203144,
+ "average_daily_users": 197173,
"categories": {
"android": [
"security-privacy"
@@ -720,12 +720,12 @@
700,
521
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/137/137406.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/137/137406.png?modi…",
"thumbnail_size": [
533,
397
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/137/137406.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/137/137406.jpg?mo…"
},
{
"id": 205808,
@@ -736,12 +736,12 @@
700,
521
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/205/205808.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/205/205808.png?modi…",
"thumbnail_size": [
533,
397
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/205/205808.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/205/205808.jpg?mo…"
}
],
"promoted": {
@@ -752,10 +752,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.8015,
- "bayesian_average": 4.796715220442379,
- "count": 1103,
- "text_count": 216
+ "average": 4.802,
+ "bayesian_average": 4.797234472807067,
+ "count": 1121,
+ "text_count": 217
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/decentraleyes/reviews/",
"requires_payment": false,
@@ -851,7 +851,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/decentraleyes/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/decentraleyes/versions/",
- "weekly_downloads": 4579
+ "weekly_downloads": 4721
},
"notes": null
},
@@ -867,7 +867,7 @@
"picture_url": "https://addons.cdn.mozilla.net/user-media/userpics/5/5474/5474073.png?modif…"
}
],
- "average_daily_users": 973105,
+ "average_daily_users": 933634,
"categories": {
"android": [
"security-privacy"
@@ -1379,12 +1379,12 @@
1920,
1080
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/225/225184.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/225/225184.png?modi…",
"thumbnail_size": [
533,
300
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/225/225184.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/225/225184.jpg?mo…"
},
{
"id": 171793,
@@ -1395,12 +1395,12 @@
700,
394
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/171/171793.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/171/171793.png?modi…",
"thumbnail_size": [
533,
300
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/171/171793.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/171/171793.jpg?mo…"
}
],
"promoted": {
@@ -1411,9 +1411,9 @@
"category": "recommended"
},
"ratings": {
- "average": 4.7895,
- "bayesian_average": 4.786580314622787,
- "count": 1805,
+ "average": 4.7917,
+ "bayesian_average": 4.788793121051579,
+ "count": 1834,
"text_count": 369
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/privacy-badger17/reviews/",
@@ -1434,7 +1434,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/privacy-badger17/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/privacy-badger17/versions/",
- "weekly_downloads": 17013
+ "weekly_downloads": 16006
},
"notes": null
},
@@ -1450,7 +1450,7 @@
"picture_url": null
}
],
- "average_daily_users": 4907631,
+ "average_daily_users": 4763009,
"categories": {
"android": [
"security-privacy"
@@ -1634,7 +1634,7 @@
},
"is_disabled": false,
"is_experimental": false,
- "last_updated": "2021-05-04T07:47:26Z",
+ "last_updated": "2021-05-28T12:10:25Z",
"name": {
"ar": "uBlock Origin",
"bg": "uBlock Origin",
@@ -1683,12 +1683,12 @@
1011,
758
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238546.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238546.png?modi…",
"thumbnail_size": [
533,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238546.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238546.jpg?mo…"
},
{
"id": 238548,
@@ -1699,12 +1699,12 @@
1011,
758
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238548.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238548.png?modi…",
"thumbnail_size": [
533,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238548.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238548.jpg?mo…"
},
{
"id": 238547,
@@ -1715,12 +1715,12 @@
1011,
758
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238547.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238547.png?modi…",
"thumbnail_size": [
533,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238547.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238547.jpg?mo…"
},
{
"id": 238549,
@@ -1731,12 +1731,12 @@
1011,
758
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238549.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238549.png?modi…",
"thumbnail_size": [
533,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238549.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238549.jpg?mo…"
},
{
"id": 238552,
@@ -1747,12 +1747,12 @@
970,
1800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238552.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/238/238552.png?modi…",
"thumbnail_size": [
216,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238552.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/238/238552.jpg?mo…"
},
{
"id": 230370,
@@ -1763,12 +1763,12 @@
800,
600
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230370.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230370.png?modi…",
"thumbnail_size": [
533,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230370.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230370.jpg?mo…"
}
],
"promoted": {
@@ -1779,10 +1779,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.767,
- "bayesian_average": 4.766553668766709,
- "count": 11750,
- "text_count": 3228
+ "average": 4.766,
+ "bayesian_average": 4.765555015579055,
+ "count": 11913,
+ "text_count": 3263
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/reviews/",
"requires_payment": false,
@@ -1837,7 +1837,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/versions/",
- "weekly_downloads": 113254
+ "weekly_downloads": 109534
},
"notes": null
},
@@ -1853,7 +1853,7 @@
"picture_url": null
}
],
- "average_daily_users": 59717,
+ "average_daily_users": 55640,
"categories": {
"android": [
"photos-media"
@@ -1973,10 +1973,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.5177,
- "bayesian_average": 4.512746722127399,
- "count": 991,
- "text_count": 375
+ "average": 4.5161,
+ "bayesian_average": 4.5111086978123645,
+ "count": 996,
+ "text_count": 378
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/video-background-play-fix/re…",
"requires_payment": false,
@@ -2004,7 +2004,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/video-background-play-fix/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/video-background-play-fix/ve…",
- "weekly_downloads": 268
+ "weekly_downloads": 241
},
"notes": null
},
@@ -2020,7 +2020,7 @@
"picture_url": null
}
],
- "average_daily_users": 90104,
+ "average_daily_users": 86848,
"categories": {
"android": [
"experimental",
@@ -2143,12 +2143,12 @@
640,
400
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/201/201244.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/201/201244.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/201/201244.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/201/201244.jpg?mo…"
}
],
"promoted": {
@@ -2159,10 +2159,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.4969,
- "bayesian_average": 4.48168428583015,
- "count": 320,
- "text_count": 89
+ "average": 4.4939,
+ "bayesian_average": 4.478785664998499,
+ "count": 326,
+ "text_count": 90
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/privacy-possum/reviews/",
"requires_payment": false,
@@ -2188,7 +2188,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/privacy-possum/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/privacy-possum/versions/",
- "weekly_downloads": 1221
+ "weekly_downloads": 5865
},
"notes": null
},
@@ -2204,7 +2204,7 @@
"picture_url": "https://addons.cdn.mozilla.net/user-media/userpics/12/12929/12929064.png?mo…"
}
],
- "average_daily_users": 171484,
+ "average_daily_users": 167502,
"categories": {
"android": [
"photos-media",
@@ -2326,12 +2326,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230000.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230000.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230000.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230000.jpg?mo…"
},
{
"id": 230001,
@@ -2340,12 +2340,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230001.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230001.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230001.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230001.jpg?mo…"
},
{
"id": 230002,
@@ -2354,12 +2354,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230002.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230002.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230002.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230002.jpg?mo…"
},
{
"id": 230003,
@@ -2368,12 +2368,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230003.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230003.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230003.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230003.jpg?mo…"
},
{
"id": 230004,
@@ -2382,12 +2382,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230004.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230004.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230004.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230004.jpg?mo…"
},
{
"id": 230005,
@@ -2396,12 +2396,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230005.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230005.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230005.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230005.jpg?mo…"
},
{
"id": 230006,
@@ -2410,12 +2410,12 @@
1280,
800
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230006.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/230/230006.png?modi…",
"thumbnail_size": [
533,
333
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230006.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/230/230006.jpg?mo…"
}
],
"promoted": {
@@ -2426,10 +2426,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.6555,
- "bayesian_average": 4.649806788971981,
- "count": 894,
- "text_count": 177
+ "average": 4.6536,
+ "bayesian_average": 4.647972991144215,
+ "count": 915,
+ "text_count": 181
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/search_by_image/reviews/",
"requires_payment": false,
@@ -2465,7 +2465,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/search_by_image/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/search_by_image/versions/",
- "weekly_downloads": 3821
+ "weekly_downloads": 3289
},
"notes": null
},
@@ -2488,7 +2488,7 @@
"picture_url": null
}
],
- "average_daily_users": 39630,
+ "average_daily_users": 39815,
"categories": {
"android": [
"other"
@@ -2770,10 +2770,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.456,
- "bayesian_average": 4.451164313203212,
- "count": 1000,
- "text_count": 272
+ "average": 4.459,
+ "bayesian_average": 4.454167438083744,
+ "count": 1013,
+ "text_count": 277
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/google-search-fixer/reviews/",
"requires_payment": false,
@@ -2793,7 +2793,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/google-search-fixer/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/google-search-fixer/versions/",
- "weekly_downloads": 70
+ "weekly_downloads": 83
},
"notes": null
},
@@ -2809,7 +2809,7 @@
"picture_url": "https://addons.cdn.mozilla.net/user-media/userpics/0/0/143.png?modified=150…"
}
],
- "average_daily_users": 375892,
+ "average_daily_users": 358900,
"categories": {
"android": [
"performance",
@@ -2823,7 +2823,7 @@
"contributions_url": "https://www.paypal.me/NoScript?utm_content=product-page-contribute&utm_medi…",
"created": "2005-05-13T10:51:32Z",
"current_version": {
- "id": 5226253,
+ "id": 5234587,
"compatibility": {
"firefox": {
"min": "59.0",
@@ -2834,19 +2834,19 @@
"max": "*"
}
},
- "edit_url": "https://addons.mozilla.org/en-US/developers/addon/noscript/versions/5226253",
+ "edit_url": "https://addons.mozilla.org/en-US/developers/addon/noscript/versions/5234587",
"files": [
{
- "id": 3770613,
- "created": "2021-05-04T07:27:00Z",
- "hash": "sha256:d089f1db05570fef88b54feb723585a4a52b22e3956bb49d28279fa00f4dfd21",
+ "id": 3778947,
+ "created": "2021-05-19T22:20:26Z",
+ "hash": "sha256:4744f9d99acbe9dec3557765edd9173272b4681c8425228fb6af52493f853467",
"is_restart_required": false,
"is_webextension": true,
"is_mozilla_signed_extension": false,
"platform": "all",
- "size": 622976,
+ "size": 623185,
"status": "public",
- "url": "https://addons.mozilla.org/firefox/downloads/file/3770613/noscript_security…",
+ "url": "https://addons.mozilla.org/firefox/downloads/file/3778947/noscript_security…",
"permissions": [
"contextMenus",
"storage",
@@ -2893,10 +2893,10 @@
"url": "http://www.gnu.org/licenses/gpl-2.0.html"
},
"release_notes": {
- "en-US": "v 11.2.6\n============================================================\nx [nscl] Various webgl blocking enhancements\nx Remove also sticky-positioned elements with click+DEL on\n scriptless pages (thanks skriptimaahinen for RFE)\nx [L10n] Updated bn, br, ca, da, de, el, es, fr, he, is, it,\n ja, lt, mk, ms, nb, nl, pl, pt_BR, ru, sq, sv_SE, tr,\n zh_CN, zh_TW\nx Fixed race condition causing external CSS not to be\n rendered sometimes when unrestricted CSS is disabled\nx Avoid document rewriting for noscript meta refresh\n emulation in most cases\nx [nscl] Fixed XHTML pages broken when served with\n application/xml MIME type and no \"object\" capability\nx [nscl] Switch early content script configuration to use\n /nscl/service/DocStartInjection.js\nx Configurable \"unrestricted CSS\" capability to for sites\n where the CSS PP0 mitigation should be disabled\n (e.g TRUSTED)\nx [nscl] Fix CSS PP0 mitigation still interfering with some\n WebExtensions (tha
nks barbaz for report)\nx [XSS] Increased sensitivity and specificity of risky\n operator pre-checks"
+ "en-US": "v 11.2.8\n============================================================\nx Quiet down unnecessary debug logging (issue #191)\nx [L10n] Updated he, de\nx Fix meta refresh sometimes ignored on Firefox 78 ESR\n (issue #192, thanks hackerncoder for report)\nx Chromium-specific build-time customizations"
},
"reviewed": null,
- "version": "11.2.6"
+ "version": "11.2.8"
},
"default_locale": "en-US",
"description": {
@@ -2946,7 +2946,7 @@
},
"is_disabled": false,
"is_experimental": false,
- "last_updated": "2021-05-04T12:31:44Z",
+ "last_updated": "2021-05-20T07:04:43Z",
"name": {
"de": "NoScript",
"el": "NoScript",
@@ -2970,12 +2970,12 @@
291,
244
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/0/846.png?modified=…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/0/846.png?modified=…",
"thumbnail_size": [
291,
244
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/0/846.jpg?modifie…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/0/846.jpg?modifie…"
},
{
"id": 1060,
@@ -2986,12 +2986,12 @@
423,
447
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/1/1060.png?modified…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/1/1060.png?modified…",
"thumbnail_size": [
379,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/1/1060.jpg?modifi…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/1/1060.jpg?modifi…"
},
{
"id": 1062,
@@ -3002,12 +3002,12 @@
457,
428
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/1/1062.png?modified…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/1/1062.png?modified…",
"thumbnail_size": [
427,
400
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/1/1062.jpg?modifi…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/1/1062.jpg?modifi…"
},
{
"id": 52395,
@@ -3018,12 +3018,12 @@
504,
385
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/52/52395.png?modifi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/52/52395.png?modifi…",
"thumbnail_size": [
504,
385
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/52/52395.jpg?modi…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/52/52395.jpg?modi…"
}
],
"promoted": {
@@ -3034,10 +3034,10 @@
"category": "recommended"
},
"ratings": {
- "average": 4.365,
- "bayesian_average": 4.36234415371495,
- "count": 1778,
- "text_count": 723
+ "average": 4.3668,
+ "bayesian_average": 4.364130623453648,
+ "count": 1791,
+ "text_count": 726
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/noscript/reviews/",
"requires_payment": false,
@@ -3094,7 +3094,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/noscript/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/noscript/versions/",
- "weekly_downloads": 8743
+ "weekly_downloads": 8095
},
"notes": null
},
@@ -3110,7 +3110,7 @@
"picture_url": null
}
],
- "average_daily_users": 119252,
+ "average_daily_users": 113429,
"categories": {
"android": [
"performance",
@@ -3227,12 +3227,12 @@
256,
256
],
- "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/104/104784.png?modi…",
+ "image_url": "https://addons.cdn.mozilla.net/user-media/previews/full/104/104784.png?modi…",
"thumbnail_size": [
256,
256
],
- "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/104/104784.jpg?mo…"
+ "thumbnail_url": "https://addons.cdn.mozilla.net/user-media/previews/thumbs/104/104784.jpg?mo…"
}
],
"promoted": {
@@ -3243,10 +3243,10 @@
"category": "recommended"
},
"ratings": {
- "average": 3.9145,
- "bayesian_average": 3.910179019078069,
- "count": 959,
- "text_count": 346
+ "average": 3.9147,
+ "bayesian_average": 3.9103908462043155,
+ "count": 973,
+ "text_count": 350
},
"ratings_url": "https://addons.mozilla.org/en-US/firefox/addon/youtube-high-definition/revi…",
"requires_payment": false,
@@ -3285,7 +3285,7 @@
"type": "extension",
"url": "https://addons.mozilla.org/en-US/firefox/addon/youtube-high-definition/",
"versions_url": "https://addons.mozilla.org/en-US/firefox/addon/youtube-high-definition/vers…",
- "weekly_downloads": 1671
+ "weekly_downloads": 1691
},
"notes": null
}
diff --git a/projects/tor-browser/config b/projects/tor-browser/config
index c78f71e..65fbc66 100644
--- a/projects/tor-browser/config
+++ b/projects/tor-browser/config
@@ -78,9 +78,9 @@ input_files:
enable: '[% c("var/snowflake") && ! c("var/android") %]'
- filename: Bundle-Data
enable: '[% ! c("var/android") %]'
- - URL: https://addons.cdn.mozilla.net/user-media/addons/722/noscript_security_suit…
+ - URL: https://addons.cdn.mozilla.net/user-media/addons/722/noscript_security_suit…
name: noscript
- sha256sum: d089f1db05570fef88b54feb723585a4a52b22e3956bb49d28279fa00f4dfd21
+ sha256sum: 4744f9d99acbe9dec3557765edd9173272b4681c8425228fb6af52493f853467
- filename: 'RelativeLink/start-tor-browser.desktop'
enable: '[% c("var/linux") %]'
- filename: 'RelativeLink/execdesktop'
diff --git a/projects/tor/config b/projects/tor/config
index a469dd8..c7dd6ef 100644
--- a/projects/tor/config
+++ b/projects/tor/config
@@ -1,6 +1,6 @@
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %]'
-version: 0.4.6.2-alpha
+version: 0.4.6.4-rc
git_hash: 'tor-[% c("version") %]'
git_url: https://git.torproject.org/tor.git
git_submodule: 1
diff --git a/rbm.conf b/rbm.conf
index ec38441..6d2a774 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -57,10 +57,10 @@ buildconf:
git_signtag_opt: '-s'
var:
- torbrowser_version: '10.5a15'
+ torbrowser_version: '10.5a16'
torbrowser_build: 'build1'
torbrowser_incremental_from:
- - 10.5a14
+ - 10.5a15
project_name: tor-browser
multi_lingual: 0
build_mar: 1
1
0

[tor-browser/tor-browser-78.11.0esr-10.5-1] Bug 1673237 - Always allow SVGs on about: pages r=acat, tjr, emilio
by sysrqb@torproject.org 02 Jun '21
by sysrqb@torproject.org 02 Jun '21
02 Jun '21
commit dfac3489196c35a96db5ec6f0a49ce2aae1d9fb5
Author: sanketh <me(a)snkth.com>
Date: Tue Nov 3 17:34:20 2020 +0000
Bug 1673237 - Always allow SVGs on about: pages r=acat,tjr,emilio
- Updated layout/svg/tests/test_disabled.html to ensure that this doesn't allow
rendering SVGs on about:blank and about:srcdoc.
Differential Revision: https://phabricator.services.mozilla.com/D95139
---
dom/base/nsNodeInfoManager.cpp | 18 ++++++++++-------
layout/svg/tests/file_disabled_iframe.html | 31 +++++++++++++++++++++++++++++-
2 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/dom/base/nsNodeInfoManager.cpp b/dom/base/nsNodeInfoManager.cpp
index b0534b661a23..8bc6b0ba2bd6 100644
--- a/dom/base/nsNodeInfoManager.cpp
+++ b/dom/base/nsNodeInfoManager.cpp
@@ -352,9 +352,12 @@ void nsNodeInfoManager::RemoveNodeInfo(NodeInfo* aNodeInfo) {
MOZ_ASSERT(ret, "Can't find mozilla::dom::NodeInfo to remove!!!");
}
-static bool IsSystemOrAddonPrincipal(nsIPrincipal* aPrincipal) {
+static bool IsSystemOrAddonOrAboutPrincipal(nsIPrincipal* aPrincipal) {
return aPrincipal->IsSystemPrincipal() ||
- BasePrincipal::Cast(aPrincipal)->AddonPolicy();
+ BasePrincipal::Cast(aPrincipal)->AddonPolicy() ||
+ // NOTE: about:blank and about:srcdoc inherit the principal of their
+ // parent, so aPrincipal->SchemeIs("about") returns false for them.
+ aPrincipal->SchemeIs("about");
}
bool nsNodeInfoManager::InternalSVGEnabled() {
@@ -375,17 +378,18 @@ bool nsNodeInfoManager::InternalSVGEnabled() {
}
// We allow SVG (regardless of the pref) if this is a system or add-on
- // principal, or if this load was requested for a system or add-on principal
- // (e.g. a remote image being served as part of system or add-on UI)
+ // principal or about: page, or if this load was requested for a system or
+ // add-on principal or about: page (e.g. a remote image being served as part
+ // of system or add-on UI or about: page)
bool conclusion =
- (SVGEnabled || IsSystemOrAddonPrincipal(mPrincipal) ||
+ (SVGEnabled || IsSystemOrAddonOrAboutPrincipal(mPrincipal) ||
(loadInfo &&
(loadInfo->GetExternalContentPolicyType() ==
nsIContentPolicy::TYPE_IMAGE ||
loadInfo->GetExternalContentPolicyType() ==
nsIContentPolicy::TYPE_OTHER) &&
- (IsSystemOrAddonPrincipal(loadInfo->GetLoadingPrincipal()) ||
- IsSystemOrAddonPrincipal(loadInfo->TriggeringPrincipal()))));
+ (IsSystemOrAddonOrAboutPrincipal(loadInfo->GetLoadingPrincipal()) ||
+ IsSystemOrAddonOrAboutPrincipal(loadInfo->TriggeringPrincipal()))));
mSVGEnabled = Some(conclusion);
return conclusion;
}
diff --git a/layout/svg/tests/file_disabled_iframe.html b/layout/svg/tests/file_disabled_iframe.html
index 6feae3024730..55eda75fdefb 100644
--- a/layout/svg/tests/file_disabled_iframe.html
+++ b/layout/svg/tests/file_disabled_iframe.html
@@ -48,5 +48,34 @@
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<svg><style>1&2<3>4 \u003C/style></svg>');
- SimpleTest.finish();
+ //
+ // Tests for Bug 1673237
+ //
+
+ // This test fails if about:blank renders SVGs
+ t.innerHTML = null;
+ var iframe = document.createElement("iframe");
+ iframe.setAttribute("src", "about:blank")
+ t.appendChild(iframe);
+ iframe.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg"));
+ iframe.firstChild.textContent = "<foo>";
+ is(iframe.innerHTML, "<svg:svg><foo></svg:svg>");
+
+ // This test fails if about:blank renders SVGs
+ var win = window.open("about:blank");
+ win.document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg"))
+ win.document.body.firstChild.textContent = "<foo>";
+ is(win.document.body.innerHTML, "<svg:svg><foo></svg:svg>");
+ win.close();
+
+ // This test fails if about:srcdoc renders SVGs
+ t.innerHTML = null;
+ iframe = document.createElement("iframe");
+ iframe.srcdoc = "<svg:svg></svg:svg>";
+ iframe.onload = function() {
+ iframe.contentDocument.body.firstChild.textContent = "<foo>";
+ is(iframe.contentDocument.body.innerHTML, "<svg:svg><foo></svg:svg>");
+ SimpleTest.finish();
+ }
+ t.appendChild(iframe);
</script>
1
0

[tor-browser/tor-browser-78.11.0esr-10.5-1] 40209: Implement Basic Crypto Safety
by sysrqb@torproject.org 02 Jun '21
by sysrqb@torproject.org 02 Jun '21
02 Jun '21
commit 363e84c859fa76ce15e80bfc4eeee52b94022b6b
Author: sanketh <me(a)snkth.com>
Date: Mon Feb 8 20:12:44 2021 -0500
40209: Implement Basic Crypto Safety
Adds a CryptoSafety actor which detects when you've copied a crypto
address from a HTTP webpage and shows a warning.
Closes #40209.
Bug 40428: Fix string attribute names
---
browser/actors/CryptoSafetyChild.jsm | 87 ++++++++++++++++
browser/actors/CryptoSafetyParent.jsm | 142 +++++++++++++++++++++++++++
browser/actors/moz.build | 2 +
browser/base/content/popup-notifications.inc | 14 +++
browser/components/BrowserGlue.jsm | 17 ++++
browser/modules/TorStrings.jsm | 48 +++++++++
browser/themes/shared/browser.inc.css | 5 +
toolkit/content/license.html | 32 ++++++
toolkit/modules/Bech32Decode.jsm | 103 +++++++++++++++++++
toolkit/modules/moz.build | 1 +
10 files changed, 451 insertions(+)
diff --git a/browser/actors/CryptoSafetyChild.jsm b/browser/actors/CryptoSafetyChild.jsm
new file mode 100644
index 000000000000..87ff261d4915
--- /dev/null
+++ b/browser/actors/CryptoSafetyChild.jsm
@@ -0,0 +1,87 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* Copyright (c) 2020, The Tor Project, Inc.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var EXPORTED_SYMBOLS = ["CryptoSafetyChild"];
+
+const { Bech32Decode } = ChromeUtils.import(
+ "resource://gre/modules/Bech32Decode.jsm"
+);
+
+const { XPCOMUtils } = ChromeUtils.import(
+ "resource://gre/modules/XPCOMUtils.jsm"
+);
+
+const kPrefCryptoSafety = "security.cryptoSafety";
+
+XPCOMUtils.defineLazyPreferenceGetter(
+ this,
+ "isCryptoSafetyEnabled",
+ kPrefCryptoSafety,
+ true /* defaults to true */
+);
+
+function looksLikeCryptoAddress(s) {
+ // P2PKH and P2SH addresses
+ // https://stackoverflow.com/a/24205650
+ const bitcoinAddr = /^[13][a-km-zA-HJ-NP-Z1-9]{25,39}$/;
+ if (bitcoinAddr.test(s)) {
+ return true;
+ }
+
+ // Bech32 addresses
+ if (Bech32Decode(s) !== null) {
+ return true;
+ }
+
+ // regular addresses
+ const etherAddr = /^0x[a-fA-F0-9]{40}$/;
+ if (etherAddr.test(s)) {
+ return true;
+ }
+
+ // t-addresses
+ // https://www.reddit.com/r/zec/comments/8mxj6x/simple_regex_to_validate_a_zca…
+ const zcashAddr = /^t1[a-zA-Z0-9]{33}$/;
+ if (zcashAddr.test(s)) {
+ return true;
+ }
+
+ // Standard, Integrated, and 256-bit Integrated addresses
+ // https://monero.stackexchange.com/a/10627
+ const moneroAddr = /^4(?:[0-9AB]|[1-9A-HJ-NP-Za-km-z]{12}(?:[1-9A-HJ-NP-Za-km-z]{30})?)[1-9A-HJ-NP-Za-km-z]{93}$/;
+ if (moneroAddr.test(s)) {
+ return true;
+ }
+
+ return false;
+}
+
+class CryptoSafetyChild extends JSWindowActorChild {
+ handleEvent(event) {
+ if (isCryptoSafetyEnabled) {
+ // Ignore non-HTTP addresses
+ if (!this.document.documentURIObject.schemeIs("http")) {
+ return;
+ }
+ // Ignore onion addresses
+ if (this.document.documentURIObject.host.endsWith(".onion")) {
+ return;
+ }
+
+ if (event.type == "copy" || event.type == "cut") {
+ this.contentWindow.navigator.clipboard.readText().then(clipText => {
+ const selection = clipText.trim();
+ if (looksLikeCryptoAddress(selection)) {
+ this.sendAsyncMessage("CryptoSafety:CopiedText", {
+ selection,
+ });
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/browser/actors/CryptoSafetyParent.jsm b/browser/actors/CryptoSafetyParent.jsm
new file mode 100644
index 000000000000..bac151df5511
--- /dev/null
+++ b/browser/actors/CryptoSafetyParent.jsm
@@ -0,0 +1,142 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* Copyright (c) 2020, The Tor Project, Inc.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var EXPORTED_SYMBOLS = ["CryptoSafetyParent"];
+
+const { XPCOMUtils } = ChromeUtils.import(
+ "resource://gre/modules/XPCOMUtils.jsm"
+);
+
+XPCOMUtils.defineLazyModuleGetters(this, {
+ TorStrings: "resource:///modules/TorStrings.jsm",
+});
+
+const kPrefCryptoSafety = "security.cryptoSafety";
+
+XPCOMUtils.defineLazyPreferenceGetter(
+ this,
+ "isCryptoSafetyEnabled",
+ kPrefCryptoSafety,
+ true /* defaults to true */
+);
+
+class CryptoSafetyParent extends JSWindowActorParent {
+ getBrowser() {
+ return this.browsingContext.top.embedderElement;
+ }
+
+ receiveMessage(aMessage) {
+ if (isCryptoSafetyEnabled) {
+ if (aMessage.name == "CryptoSafety:CopiedText") {
+ showPopup(this.getBrowser(), aMessage.data.selection);
+ }
+ }
+ }
+}
+
+function trimAddress(cryptoAddr) {
+ if (cryptoAddr.length <= 32) {
+ return cryptoAddr;
+ }
+ return cryptoAddr.substring(0, 32) + "...";
+}
+
+function showPopup(aBrowser, cryptoAddr) {
+ const chromeDoc = aBrowser.ownerDocument;
+ if (chromeDoc) {
+ const win = chromeDoc.defaultView;
+ const cryptoSafetyPrompt = new CryptoSafetyPrompt(
+ aBrowser,
+ win,
+ cryptoAddr
+ );
+ cryptoSafetyPrompt.show();
+ }
+}
+
+class CryptoSafetyPrompt {
+ constructor(aBrowser, aWin, cryptoAddr) {
+ this._browser = aBrowser;
+ this._win = aWin;
+ this._cryptoAddr = cryptoAddr;
+ }
+
+ show() {
+ const primaryAction = {
+ label: TorStrings.cryptoSafetyPrompt.primaryAction,
+ accessKey: TorStrings.cryptoSafetyPrompt.primaryActionAccessKey,
+ callback: () => {
+ this._win.torbutton_new_circuit();
+ },
+ };
+
+ const secondaryAction = {
+ label: TorStrings.cryptoSafetyPrompt.secondaryAction,
+ accessKey: TorStrings.cryptoSafetyPrompt.secondaryActionAccessKey,
+ callback: () => {},
+ };
+
+ let _this = this;
+ const options = {
+ popupIconURL: "chrome://browser/skin/cert-error.svg",
+ eventCallback(aTopic) {
+ if (aTopic === "showing") {
+ _this._onPromptShowing();
+ }
+ },
+ };
+
+ const cryptoWarningText = TorStrings.cryptoSafetyPrompt.cryptoWarning.replace(
+ "%S",
+ trimAddress(this._cryptoAddr)
+ );
+
+ if (this._win.PopupNotifications) {
+ this._prompt = this._win.PopupNotifications.show(
+ this._browser,
+ "crypto-safety-warning",
+ cryptoWarningText,
+ null /* anchor ID */,
+ primaryAction,
+ [secondaryAction],
+ options
+ );
+ }
+ }
+
+ _onPromptShowing() {
+ let xulDoc = this._browser.ownerDocument;
+
+ let whatCanHeading = xulDoc.getElementById(
+ "crypto-safety-warning-notification-what-can-heading"
+ );
+ if (whatCanHeading) {
+ whatCanHeading.textContent = TorStrings.cryptoSafetyPrompt.whatCanHeading;
+ }
+
+ let whatCanBody = xulDoc.getElementById(
+ "crypto-safety-warning-notification-what-can-body"
+ );
+ if (whatCanBody) {
+ whatCanBody.textContent = TorStrings.cryptoSafetyPrompt.whatCanBody;
+ }
+
+ let learnMoreElem = xulDoc.getElementById(
+ "crypto-safety-warning-notification-learnmore"
+ );
+ if (learnMoreElem) {
+ learnMoreElem.setAttribute(
+ "value",
+ TorStrings.cryptoSafetyPrompt.learnMore
+ );
+ learnMoreElem.setAttribute(
+ "href",
+ TorStrings.cryptoSafetyPrompt.learnMoreURL
+ );
+ }
+ }
+}
diff --git a/browser/actors/moz.build b/browser/actors/moz.build
index e70f0f09fe3a..9eb5ca397060 100644
--- a/browser/actors/moz.build
+++ b/browser/actors/moz.build
@@ -50,6 +50,8 @@ FINAL_TARGET_FILES.actors += [
'ContentSearchParent.jsm',
'ContextMenuChild.jsm',
'ContextMenuParent.jsm',
+ 'CryptoSafetyChild.jsm',
+ 'CryptoSafetyParent.jsm',
'DOMFullscreenChild.jsm',
'DOMFullscreenParent.jsm',
'FormValidationChild.jsm',
diff --git a/browser/base/content/popup-notifications.inc b/browser/base/content/popup-notifications.inc
index 42e17e90c648..ff6f8cdeca80 100644
--- a/browser/base/content/popup-notifications.inc
+++ b/browser/base/content/popup-notifications.inc
@@ -114,3 +114,17 @@
</vbox>
</popupnotificationfooter>
</popupnotification>
+
+ <popupnotification id="crypto-safety-warning-notification" hidden="true">
+ <popupnotificationcontent orient="vertical">
+ <description id="crypto-safety-warning-notification-desc"/>
+ <html:div id="crypto-safety-warning-notification-what-can">
+ <html:strong id="crypto-safety-warning-notification-what-can-heading" />
+ <html:br/>
+ <html:span id="crypto-safety-warning-notification-what-can-body" />
+ </html:div>
+ <label id="crypto-safety-warning-notification-learnmore"
+ class="popup-notification-learnmore-link"
+ is="text-link"/>
+ </popupnotificationcontent>
+ </popupnotification>
diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm
index 3750230a250b..5f708fca3d5c 100644
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -297,6 +297,23 @@ let JSWINDOWACTORS = {
allFrames: true,
},
+ CryptoSafety: {
+ parent: {
+ moduleURI: "resource:///actors/CryptoSafetyParent.jsm",
+ },
+
+ child: {
+ moduleURI: "resource:///actors/CryptoSafetyChild.jsm",
+ group: "browsers",
+ events: {
+ copy: { mozSystemGroup: true },
+ cut: { mozSystemGroup: true },
+ },
+ },
+
+ allFrames: true,
+ },
+
DOMFullscreen: {
parent: {
moduleURI: "resource:///actors/DOMFullscreenParent.jsm",
diff --git a/browser/modules/TorStrings.jsm b/browser/modules/TorStrings.jsm
index e8a8d37ae373..1e08b168e4af 100644
--- a/browser/modules/TorStrings.jsm
+++ b/browser/modules/TorStrings.jsm
@@ -101,6 +101,54 @@ class TorPropertyStringBundle {
Security Level Strings
*/
var TorStrings = {
+ /*
+ CryptoSafetyPrompt Strings
+ */
+ cryptoSafetyPrompt: (function() {
+ let tsb = new TorPropertyStringBundle(
+ "chrome://torbutton/locale/torbutton.properties",
+ "cryptoSafetyPrompt."
+ );
+ let getString = function(key, fallback) {
+ return tsb.getString(key, fallback);
+ };
+
+ let retval = {
+ cryptoWarning: getString(
+ "cryptoWarning",
+ "A cryptocurrency address (%S) has been copied from an insecure website. It could have been modified."
+ ),
+ whatCanHeading: getString(
+ "whatCanHeading",
+ "What can you do about it?"
+ ),
+ whatCanBody: getString(
+ "whatCanBody",
+ "You can try reconnecting with a new circuit to establish a secure connection, or accept the risk and dismiss this warning."
+ ),
+ learnMore: getString("learnMore", "Learn more"),
+ learnMoreURL: `https://support.torproject.org/${getLocale()}/`,
+ primaryAction: getString(
+ "primaryAction",
+ "Reload Tab with a New Circuit"
+ ),
+ primaryActionAccessKey: getString(
+ "primaryActionAccessKey",
+ "R"
+ ),
+ secondaryAction: getString(
+ "secondaryAction",
+ "Dismiss Warning"
+ ),
+ secondaryActionAccessKey: getString(
+ "secondaryActionAccessKey",
+ "D"
+ ),
+ };
+
+ return retval;
+ })() /* CryptoSafetyPrompt Strings */,
+
/*
Tor Browser Security Level Strings
*/
diff --git a/browser/themes/shared/browser.inc.css b/browser/themes/shared/browser.inc.css
index 0113466e8e56..4ef27d880754 100644
--- a/browser/themes/shared/browser.inc.css
+++ b/browser/themes/shared/browser.inc.css
@@ -620,3 +620,8 @@ menupopup::part(drop-indicator) {
#sharing-warning-proceed-to-tab:hover {
background-color: rgb(0,62,170);
}
+
+#crypto-safety-warning-notification-what-can {
+ display: block;
+ margin: 5px;
+}
diff --git a/toolkit/content/license.html b/toolkit/content/license.html
index e44c31ec6d4e..90995236b41b 100644
--- a/toolkit/content/license.html
+++ b/toolkit/content/license.html
@@ -72,6 +72,7 @@
<li><a href="about:license#arm">ARM License</a></li>
<li><a href="about:license#babel">Babel License</a></li>
<li><a href="about:license#babylon">Babylon License</a></li>
+ <li><a href="about:license#bech32">Bech32 License</a></li>
<li><a href="about:license#bincode">bincode License</a></li>
<li><a href="about:license#bsd2clause">BSD 2-Clause License</a></li>
<li><a href="about:license#bsd3clause">BSD 3-Clause License</a></li>
@@ -2795,6 +2796,37 @@ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+</pre>
+
+
+ <hr>
+
+ <h1><a id="bech32"></a>Bech32 License</h1>
+
+ <p>This license applies to the file
+ <code>toolkit/modules/Bech32Decode.jsm</code>.
+ </p>
+
+<pre>
+Copyright (c) 2017 Pieter Wuille
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
diff --git a/toolkit/modules/Bech32Decode.jsm b/toolkit/modules/Bech32Decode.jsm
new file mode 100644
index 000000000000..3a2bc7ae0a10
--- /dev/null
+++ b/toolkit/modules/Bech32Decode.jsm
@@ -0,0 +1,103 @@
+// Adapted from the reference implementation of Bech32
+// https://github.com/sipa/bech32
+
+// Copyright (c) 2017 Pieter Wuille
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+"use strict";
+
+/**
+ * JS module implementation of Bech32 decoding adapted from the reference
+ * implementation https://github.com/sipa/bech32.
+ */
+
+var EXPORTED_SYMBOLS = ["Bech32Decode"];
+
+var CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
+var GENERATOR = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3];
+
+function polymod(values) {
+ var chk = 1;
+ for (var p = 0; p < values.length; ++p) {
+ var top = chk >> 25;
+ chk = ((chk & 0x1ffffff) << 5) ^ values[p];
+ for (var i = 0; i < 5; ++i) {
+ if ((top >> i) & 1) {
+ chk ^= GENERATOR[i];
+ }
+ }
+ }
+ return chk;
+}
+
+function hrpExpand(hrp) {
+ var ret = [];
+ var p;
+ for (p = 0; p < hrp.length; ++p) {
+ ret.push(hrp.charCodeAt(p) >> 5);
+ }
+ ret.push(0);
+ for (p = 0; p < hrp.length; ++p) {
+ ret.push(hrp.charCodeAt(p) & 31);
+ }
+ return ret;
+}
+
+function verifyChecksum(hrp, data) {
+ return polymod(hrpExpand(hrp).concat(data)) === 1;
+}
+
+function Bech32Decode(bechString) {
+ var p;
+ var has_lower = false;
+ var has_upper = false;
+ for (p = 0; p < bechString.length; ++p) {
+ if (bechString.charCodeAt(p) < 33 || bechString.charCodeAt(p) > 126) {
+ return null;
+ }
+ if (bechString.charCodeAt(p) >= 97 && bechString.charCodeAt(p) <= 122) {
+ has_lower = true;
+ }
+ if (bechString.charCodeAt(p) >= 65 && bechString.charCodeAt(p) <= 90) {
+ has_upper = true;
+ }
+ }
+ if (has_lower && has_upper) {
+ return null;
+ }
+ bechString = bechString.toLowerCase();
+ var pos = bechString.lastIndexOf("1");
+ if (pos < 1 || pos + 7 > bechString.length || bechString.length > 90) {
+ return null;
+ }
+ var hrp = bechString.substring(0, pos);
+ var data = [];
+ for (p = pos + 1; p < bechString.length; ++p) {
+ var d = CHARSET.indexOf(bechString.charAt(p));
+ if (d === -1) {
+ return null;
+ }
+ data.push(d);
+ }
+ if (!verifyChecksum(hrp, data)) {
+ return null;
+ }
+ return { hrp: hrp, data: data.slice(0, data.length - 6) };
+}
diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build
index e1f1eb5759c5..698d2773a7ed 100644
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -160,6 +160,7 @@ EXTRA_JS_MODULES += [
'ActorManagerParent.jsm',
'AppMenuNotifications.jsm',
'AsyncPrefs.jsm',
+ 'Bech32Decode.jsm',
'BinarySearch.jsm',
'BrowserUtils.jsm',
'CanonicalJSON.jsm',
1
0

[tor-browser/tor-browser-78.11.0esr-10.5-1] Bug 40432: Prevent probing installed applications
by sysrqb@torproject.org 02 Jun '21
by sysrqb@torproject.org 02 Jun '21
02 Jun '21
commit eefcc076bae9234dd5e252885b2e9344e0ad0dbe
Author: Matthew Finkel <sysrqb(a)torproject.org>
Date: Mon May 17 18:09:09 2021 +0000
Bug 40432: Prevent probing installed applications
---
.../exthandler/nsExternalHelperAppService.cpp | 30 ++++++++++++++++++----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
index 0dcc1d3ed6ab..7ff9c5b626a3 100644
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1002,8 +1002,33 @@ nsresult nsExternalHelperAppService::GetFileTokenForPath(
//////////////////////////////////////////////////////////////////////////////////////////////////////
// begin external protocol service default implementation...
//////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static const char kExternalProtocolPrefPrefix[] =
+ "network.protocol-handler.external.";
+static const char kExternalProtocolDefaultPref[] =
+ "network.protocol-handler.external-default";
+
NS_IMETHODIMP nsExternalHelperAppService::ExternalProtocolHandlerExists(
const char* aProtocolScheme, bool* aHandlerExists) {
+
+ // Replicate the same check performed in LoadURI.
+ // Deny load if the prefs say to do so
+ nsAutoCString externalPref(kExternalProtocolPrefPrefix);
+ externalPref += aProtocolScheme;
+ bool allowLoad = false;
+ *aHandlerExists = false;
+ if (NS_FAILED(Preferences::GetBool(externalPref.get(), &allowLoad))) {
+ // no scheme-specific value, check the default
+ if (NS_FAILED(
+ Preferences::GetBool(kExternalProtocolDefaultPref, &allowLoad))) {
+ return NS_OK; // missing default pref
+ }
+ }
+
+ if (!allowLoad) {
+ return NS_OK; // explicitly denied
+ }
+
nsCOMPtr<nsIHandlerInfo> handlerInfo;
nsresult rv = GetProtocolHandlerInfo(nsDependentCString(aProtocolScheme),
getter_AddRefs(handlerInfo));
@@ -1046,11 +1071,6 @@ NS_IMETHODIMP nsExternalHelperAppService::IsExposedProtocol(
return NS_OK;
}
-static const char kExternalProtocolPrefPrefix[] =
- "network.protocol-handler.external.";
-static const char kExternalProtocolDefaultPref[] =
- "network.protocol-handler.external-default";
-
NS_IMETHODIMP
nsExternalHelperAppService::LoadURI(nsIURI* aURI,
nsIPrincipal* aTriggeringPrincipal,
1
0

[tor-browser/tor-browser-78.11.0esr-10.5-1] Bug 27476: Implement about:torconnect captive portal within Tor Browser
by sysrqb@torproject.org 02 Jun '21
by sysrqb@torproject.org 02 Jun '21
02 Jun '21
commit 5fecbec542094f0d180e55864ef0f4abe6e7244c
Author: Richard Pospesel <richard(a)torproject.org>
Date: Wed Apr 28 23:09:34 2021 -0500
Bug 27476: Implement about:torconnect captive portal within Tor Browser
- implements new about:torconnect page as tor-launcher replacement
- adds tor connection status to url bar and tweaks UX when not online
- adds new torconnect component to browser
- tor process management functionality remains implemented in tor-launcher through the TorProtocolService module
- the onion pattern from about:tor migrated to an .inc.xhtml file now used by both about:tor and about:torconnect
- various design tweaks and resusability fixes to onion pattern
- adds warning/error box to about:preferences#tor when not connected to tor
- explicitly allows about:torconnect URIs to ignore Resist Fingerprinting (RFP)
- various tweaks to info-pages.inc.css for about:torconnect (also affects other firefox info pages)
---
browser/actors/NetErrorParent.jsm | 8 +
browser/base/content/aboutNetError.js | 8 +-
browser/base/content/browser-siteIdentity.js | 2 +-
browser/base/content/browser.js | 10 +
browser/base/content/browser.xhtml | 2 +
browser/components/BrowserGlue.jsm | 14 +
browser/components/about/AboutRedirector.cpp | 4 +
browser/components/about/components.conf | 1 +
browser/components/moz.build | 1 +
browser/components/torconnect/TorConnectChild.jsm | 9 +
browser/components/torconnect/TorConnectParent.jsm | 117 ++++++++
.../torconnect/content/aboutTorConnect.css | 96 +++++++
.../torconnect/content/aboutTorConnect.js | 299 +++++++++++++++++++++
.../torconnect/content/aboutTorConnect.xhtml | 46 ++++
.../components/torconnect/content/onion-slash.svg | 7 +
browser/components/torconnect/content/onion.svg | 3 +
.../torconnect/content/torBootstrapUrlbar.js | 136 ++++++++++
.../torconnect/content/torconnect-urlbar.css | 55 ++++
.../torconnect/content/torconnect-urlbar.inc.xhtml | 11 +
browser/components/torconnect/jar.mn | 7 +
browser/components/torconnect/moz.build | 6 +
.../components/torpreferences/content/torPane.js | 46 ++++
.../torpreferences/content/torPane.xhtml | 23 ++
.../torpreferences/content/torPreferences.css | 121 +++++++++
browser/modules/TorProcessService.jsm | 12 +
browser/modules/TorProtocolService.jsm | 124 ++++++++-
browser/modules/TorStrings.jsm | 72 +++++
browser/modules/moz.build | 1 +
browser/themes/shared/jar.inc.mn | 1 +
browser/themes/shared/onionPattern.css | 121 +++++++++
browser/themes/shared/onionPattern.inc.xhtml | 207 ++++++++++++++
browser/themes/shared/urlbar-searchbar.inc.css | 2 +
dom/base/Document.cpp | 51 +++-
toolkit/modules/RemotePageAccessManager.jsm | 20 ++
.../themes/shared/in-content/info-pages.inc.css | 15 +-
.../lib/environments/browser-window.js | 4 +
36 files changed, 1650 insertions(+), 12 deletions(-)
diff --git a/browser/actors/NetErrorParent.jsm b/browser/actors/NetErrorParent.jsm
index 035195391554..fa3cbf23fcb7 100644
--- a/browser/actors/NetErrorParent.jsm
+++ b/browser/actors/NetErrorParent.jsm
@@ -17,6 +17,10 @@ const { SessionStore } = ChromeUtils.import(
);
const { HomePage } = ChromeUtils.import("resource:///modules/HomePage.jsm");
+const { TorProtocolService } = ChromeUtils.import(
+ "resource:///modules/TorProtocolService.jsm"
+);
+
const PREF_SSL_IMPACT_ROOTS = [
"security.tls.version.",
"security.ssl3.",
@@ -318,6 +322,10 @@ class NetErrorParent extends JSWindowActorParent {
break;
}
}
+ break;
+ case "ShouldShowTorConnect":
+ return TorProtocolService.shouldShowTorConnect();
}
+ return undefined;
}
}
diff --git a/browser/base/content/aboutNetError.js b/browser/base/content/aboutNetError.js
index 60db17f46eb9..238b4930461c 100644
--- a/browser/base/content/aboutNetError.js
+++ b/browser/base/content/aboutNetError.js
@@ -194,8 +194,14 @@ async function setErrorPageStrings(err) {
document.l10n.setAttributes(titleElement, title);
}
-function initPage() {
+async function initPage() {
var err = getErrorCode();
+ if (
+ err === "proxyConnectFailure" &&
+ (await RPMSendQuery("ShouldShowTorConnect"))
+ ) {
+ document.location.replace("about:torconnect");
+ }
// List of error pages with an illustration.
let illustratedErrors = [
"malformedURI",
diff --git a/browser/base/content/browser-siteIdentity.js b/browser/base/content/browser-siteIdentity.js
index 539d6d4056a3..2a3431172886 100644
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -57,7 +57,7 @@ var gIdentityHandler = {
* RegExp used to decide if an about url should be shown as being part of
* the browser UI.
*/
- _secureInternalUIWhitelist: (AppConstants.TOR_BROWSER_UPDATE ? /^(?:accounts|addons|cache|certificate|config|crashes|downloads|license|logins|preferences|protections|rights|sessionrestore|support|welcomeback|tor|tbupdate)(?:[?#]|$)/i : /^(?:accounts|addons|cache|certificate|config|crashes|downloads|license|logins|preferences|protections|rights|sessionrestore|support|welcomeback|tor)(?:[?#]|$)/i),
+ _secureInternalUIWhitelist: (AppConstants.TOR_BROWSER_UPDATE ? /^(?:accounts|addons|cache|certificate|config|crashes|downloads|license|logins|preferences|protections|rights|sessionrestore|support|welcomeback|tor|torconnect|tbupdate)(?:[?#]|$)/i : /^(?:accounts|addons|cache|certificate|config|crashes|downloads|license|logins|preferences|protections|rights|sessionrestore|support|welcomeback|tor|torconnect)(?:[?#]|$)/i),
/**
* Whether the established HTTPS connection is considered "broken".
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 04f8752b93f4..916cd69320cb 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -77,6 +77,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
TabModalPrompt: "chrome://global/content/tabprompts.jsm",
TabCrashHandler: "resource:///modules/ContentCrashHandlers.jsm",
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.jsm",
+ TorProtocolService: "resource:///modules/TorProtocolService.jsm",
Translation: "resource:///modules/translation/TranslationParent.jsm",
OnionAliasStore: "resource:///modules/OnionAliasStore.jsm",
UITour: "resource:///modules/UITour.jsm",
@@ -633,6 +634,7 @@ var gPageIcons = {
var gInitialPages = [
"about:tor",
+ "about:torconnect",
"about:blank",
"about:newtab",
"about:home",
@@ -1959,6 +1961,8 @@ var gBrowserInit = {
}
this._loadHandled = true;
+
+ TorBootstrapUrlbar.init();
},
_cancelDelayedStartup() {
@@ -2490,6 +2494,10 @@ var gBrowserInit = {
let uri = window.arguments[0];
let defaultArgs = BrowserHandler.defaultArgs;
+ if (TorProtocolService.shouldShowTorConnect()) {
+ return "about:torconnect";
+ }
+
// If the given URI is different from the homepage, we want to load it.
if (uri != defaultArgs) {
AboutNewTab.noteNonDefaultStartup();
@@ -2582,6 +2590,8 @@ var gBrowserInit = {
OnionAuthPrompt.uninit();
+ TorBootstrapUrlbar.uninit();
+
gAccessibilityServiceIndicator.uninit();
AccessibilityRefreshBlocker.uninit();
diff --git a/browser/base/content/browser.xhtml b/browser/base/content/browser.xhtml
index c2caecc1a416..032db1967c69 100644
--- a/browser/base/content/browser.xhtml
+++ b/browser/base/content/browser.xhtml
@@ -112,6 +112,7 @@
Services.scriptloader.loadSubScript("chrome://browser/content/search/searchbar.js", this);
Services.scriptloader.loadSubScript("chrome://torbutton/content/tor-circuit-display.js", this);
Services.scriptloader.loadSubScript("chrome://torbutton/content/torbutton.js", this);
+ Services.scriptloader.loadSubScript("chrome://browser/content/torconnect/torBootstrapUrlbar.js", this);
window.onload = gBrowserInit.onLoad.bind(gBrowserInit);
window.onunload = gBrowserInit.onUnload.bind(gBrowserInit);
@@ -1055,6 +1056,7 @@
data-l10n-id="urlbar-go-button"/>
<hbox id="page-action-buttons" context="pageActionContextMenu">
<toolbartabstop/>
+#include ../../components/torconnect/content/torconnect-urlbar.inc.xhtml
<hbox id="contextual-feature-recommendation" role="button" hidden="true">
<hbox id="cfr-label-container">
<label id="cfr-label"/>
diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm
index 5f708fca3d5c..2bd28ec1b04c 100644
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -503,6 +503,20 @@ let JSWINDOWACTORS = {
allFrames: true,
},
+ TorConnect: {
+ parent: {
+ moduleURI: "resource:///modules/TorConnectParent.jsm",
+ },
+ child: {
+ moduleURI: "resource:///modules/TorConnectChild.jsm",
+ events: {
+ DOMWindowCreated: {},
+ },
+ },
+
+ matches: ["about:torconnect"],
+ },
+
Translation: {
parent: {
moduleURI: "resource:///modules/translation/TranslationParent.jsm",
diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp
index e7c377d655e7..db5f3ead4bb8 100644
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -120,6 +120,10 @@ static const RedirEntry kRedirMap[] = {
nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
#endif
+ {"torconnect", "chrome://browser/content/torconnect/aboutTorConnect.xhtml",
+ nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT},
};
static nsAutoCString GetAboutModuleName(nsIURI* aURI) {
diff --git a/browser/components/about/components.conf b/browser/components/about/components.conf
index 8e04467c05da..01c99ad4ed0c 100644
--- a/browser/components/about/components.conf
+++ b/browser/components/about/components.conf
@@ -26,6 +26,7 @@ pages = [
'robots',
'sessionrestore',
'tabcrashed',
+ 'torconnect',
'welcome',
'welcomeback',
]
diff --git a/browser/components/moz.build b/browser/components/moz.build
index b660be047b14..fb90c499c616 100644
--- a/browser/components/moz.build
+++ b/browser/components/moz.build
@@ -59,6 +59,7 @@ DIRS += [
'syncedtabs',
'uitour',
'urlbar',
+ 'torconnect',
'torpreferences',
'translation',
]
diff --git a/browser/components/torconnect/TorConnectChild.jsm b/browser/components/torconnect/TorConnectChild.jsm
new file mode 100644
index 000000000000..bd6dd549f156
--- /dev/null
+++ b/browser/components/torconnect/TorConnectChild.jsm
@@ -0,0 +1,9 @@
+// Copyright (c) 2021, The Tor Project, Inc.
+
+var EXPORTED_SYMBOLS = ["TorConnectChild"];
+
+const { RemotePageChild } = ChromeUtils.import(
+ "resource://gre/actors/RemotePageChild.jsm"
+);
+
+class TorConnectChild extends RemotePageChild {}
diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm
new file mode 100644
index 000000000000..03b258608b5c
--- /dev/null
+++ b/browser/components/torconnect/TorConnectParent.jsm
@@ -0,0 +1,117 @@
+// Copyright (c) 2021, The Tor Project, Inc.
+
+var EXPORTED_SYMBOLS = ["TorConnectParent"];
+
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { TorProtocolService } = ChromeUtils.import(
+ "resource:///modules/TorProtocolService.jsm"
+);
+const { TorStrings } = ChromeUtils.import("resource:///modules/TorStrings.jsm");
+const { TorLauncherUtil } = ChromeUtils.import(
+ "resource://torlauncher/modules/tl-util.jsm"
+);
+
+const kTorProcessReadyTopic = "TorProcessIsReady";
+const kTorProcessExitedTopic = "TorProcessExited";
+const kTorProcessDidNotStartTopic = "TorProcessDidNotStart";
+const kTorShowProgressPanelTopic = "TorShowProgressPanel";
+const kTorBootstrapStatusTopic = "TorBootstrapStatus";
+const kTorBootstrapErrorTopic = "TorBootstrapError";
+const kTorLogHasWarnOrErrTopic = "TorLogHasWarnOrErr";
+
+const gActiveTopics = [
+ kTorProcessReadyTopic,
+ kTorProcessExitedTopic,
+ kTorProcessDidNotStartTopic,
+ kTorShowProgressPanelTopic,
+ kTorBootstrapStatusTopic,
+ kTorBootstrapErrorTopic,
+ kTorLogHasWarnOrErrTopic,
+];
+
+class TorConnectParent extends JSWindowActorParent {
+ constructor(...args) {
+ super(...args);
+
+ const self = this;
+ this.gObserver = {
+ observe(aSubject, aTopic, aData) {
+ const obj = aSubject?.wrappedJSObject;
+ if (obj) {
+ obj.handled = true;
+ }
+ self.sendAsyncMessage(aTopic, obj);
+ },
+ };
+
+ for (const topic of gActiveTopics) {
+ Services.obs.addObserver(this.gObserver, topic);
+ }
+ }
+
+ willDestroy() {
+ for (const topic of gActiveTopics) {
+ Services.obs.removeObserver(this.gObserver, topic);
+ }
+ }
+
+ get browser() {
+ return this.browsingContext.top.embedderElement;
+ }
+
+ _OpenTorAdvancedPreferences() {
+ const win = this.browsingContext.top.embedderElement.ownerGlobal;
+ win.openTrustedLinkIn("about:preferences#tor", "tab");
+ }
+
+ _TorCopyLog() {
+ // Copy tor log messages to the system clipboard.
+ const chSvc = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(
+ Ci.nsIClipboardHelper
+ );
+ const countObj = { value: 0 };
+ chSvc.copyString(TorProtocolService.getLog(countObj));
+ const count = countObj.value;
+ return TorLauncherUtil.getFormattedLocalizedString(
+ "copiedNLogMessagesShort",
+ [count],
+ 1
+ );
+ }
+
+ _GoToBrowserHome() {
+ const window = this.browser.ownerGlobal;
+ window.BrowserHome();
+ }
+
+ receiveMessage(message) {
+ switch (message.name) {
+ case "TorBootstrapErrorOccurred":
+ return TorProtocolService.torBootstrapErrorOccurred();
+ case "TorRetrieveBootstrapStatus":
+ return TorProtocolService.retrieveBootstrapStatus();
+ case "OpenTorAdvancedPreferences":
+ return this._OpenTorAdvancedPreferences();
+ case "GoToBrowserHome":
+ return this._GoToBrowserHome();
+ case "GetLocalizedBootstrapStatus":
+ const { status, keyword } = message.data;
+ return TorLauncherUtil.getLocalizedBootstrapStatus(status, keyword);
+ case "TorCopyLog":
+ return this._TorCopyLog();
+ case "TorIsNetworkDisabled":
+ return TorProtocolService.isNetworkDisabled();
+ case "TorStopBootstrap":
+ return TorProtocolService.torStopBootstrap();
+ case "TorConnect":
+ return TorProtocolService.connect();
+ case "GetDirection":
+ return Services.locale.isAppLocaleRTL ? "rtl" : "ltr";
+ case "GetTorStrings":
+ return TorStrings;
+ case "TorLogHasWarnOrErr":
+ return TorProtocolService.torLogHasWarnOrErr();
+ }
+ return undefined;
+ }
+}
diff --git a/browser/components/torconnect/content/aboutTorConnect.css b/browser/components/torconnect/content/aboutTorConnect.css
new file mode 100644
index 000000000000..eb4277f2ce5e
--- /dev/null
+++ b/browser/components/torconnect/content/aboutTorConnect.css
@@ -0,0 +1,96 @@
+
+/* Copyright (c) 2021, The Tor Project, Inc. */
+
+
+@import url("chrome://browser/skin/error-pages.css");
+
+:root {
+ --onion-opacity: 1;
+ --onion-color: var(--card-outline-color);
+ --onion-radius: 50px;
+}
+
+#connectButton {
+ background-color: #7D4698;
+}
+
+#connectButton:hover {
+ background-color: #59316B;
+}
+
+#progressBackground {
+ position:fixed;
+ padding:0;
+ margin:0;
+ top:0;
+ left:0;
+ width: 0%;
+ height: 7px;
+ background-image: linear-gradient(90deg, rgb(20, 218, 221) 0%, rgb(128, 109, 236) 100%);
+ border-radius: 0;
+}
+
+#connectPageContainer {
+ margin-top: 10vh;
+ width: 50%;
+}
+
+#copyLogButton {
+ position: relative;
+}
+
+#copyLogTooltip {
+ visibility: hidden;
+ display: inline-block;
+ width: 100%;
+
+ position: absolute;
+ z-index: 1;
+ left: 0px;
+ bottom: calc(100% + 6px);
+}
+
+#copyLogTooltip::after {
+ content: "";
+ position: absolute;
+ top: 100%;
+ left: 50%;
+ margin-left: -4px;
+ border-width: 4px;
+ border-style: solid;
+ border-color: #30E60B transparent transparent transparent;
+}
+
+
+#copyLogTooltipText {
+ display: inline-block;
+ background-color: #30E60B;
+ color: #003706;
+ border-radius: 2px;
+ text-align: center;
+ line-height: 13px;
+ font: 11px Regular;
+ font-weight: 400;
+
+ margin-left: auto;
+ margin-right: auto;
+ padding: 4px;
+}
+
+body {
+ padding: 0px !important;
+ justify-content: space-between;
+ background-color: var(--in-content-page-background);
+}
+
+.title {
+ background-image: url("chrome://browser/content/torconnect/onion.svg");
+ -moz-context-properties: fill, fill-opacity;
+ fill-opacity: 1;
+ fill: var(--onion-color);
+}
+
+.title.error {
+ background-image: url("chrome://browser/content/torconnect/onion-slash.svg");
+}
+
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js
new file mode 100644
index 000000000000..ad398ccd86f9
--- /dev/null
+++ b/browser/components/torconnect/content/aboutTorConnect.js
@@ -0,0 +1,299 @@
+// Copyright (c) 2021, The Tor Project, Inc.
+
+/* eslint-env mozilla/frame-script */
+
+const kTorProcessReadyTopic = "TorProcessIsReady";
+const kTorProcessExitedTopic = "TorProcessExited";
+const kTorProcessDidNotStartTopic = "TorProcessDidNotStart";
+const kTorBootstrapStatusTopic = "TorBootstrapStatus";
+const kTorBootstrapErrorTopic = "TorBootstrapError";
+const kTorLogHasWarnOrErrTopic = "TorLogHasWarnOrErr";
+
+class AboutTorConnect {
+ log(...args) {
+ console.log(...args);
+ }
+
+ logError(...args) {
+ console.error(...args);
+ }
+
+ logDebug(...args) {
+ console.debug(...args);
+ }
+
+ getElem(id) {
+ return document.getElementById(id);
+ }
+ get elemProgressContent() {
+ return this.getElem("progressContent");
+ }
+ get elemProgressDesc() {
+ return this.getElem("connectShortDescText");
+ }
+ get elemProgressMeter() {
+ return this.getElem("progressBackground");
+ }
+ get elemConnectButton() {
+ return this.getElem("connectButton");
+ }
+ get elemCopyLogButton() {
+ return this.getElem("copyLogButton");
+ }
+ get elemCopyLogTooltip() {
+ return this.getElem("copyLogTooltip");
+ }
+ get elemCopyLogTooltipText() {
+ return this.getElem("copyLogTooltipText");
+ }
+ get elemAdvancedButton() {
+ return this.getElem("advancedButton");
+ }
+ get elemCancelButton() {
+ return this.getElem("cancelButton");
+ }
+ get elemTextContainer() {
+ return this.getElem("text-container");
+ }
+ get elemTitle() {
+ return this.elemTextContainer.getElementsByClassName("title")[0];
+ }
+
+ static get STATE_INITIAL() {
+ return "STATE_INITIAL";
+ }
+
+ static get STATE_BOOTSTRAPPING() {
+ return "STATE_BOOTSTRAPPING";
+ }
+
+ static get STATE_BOOTSTRAPPED() {
+ return "STATE_BOOTSTRAPPED";
+ }
+
+ static get STATE_BOOTSTRAP_ERROR() {
+ return "STATE_BOOTSTRAP_ERROR";
+ }
+
+ get state() {
+ return this._state;
+ }
+
+ setInitialUI() {
+ this.setTitle(this.torStrings.torConnect.torConnect);
+ this.elemProgressDesc.textContent =
+ this.torStrings.settings.torPreferencesDescription;
+ this.showElem(this.elemConnectButton);
+ this.showElem(this.elemAdvancedButton);
+ this.hideElem(this.elemCopyLogButton);
+ this.hideElem(this.elemCancelButton);
+ this.hideElem(this.elemProgressContent);
+ this.hideElem(this.elemProgressMeter);
+ this.elemTitle.classList.remove("error");
+ }
+
+ setBootstrappingUI() {
+ this.setTitle(this.torStrings.torConnect.torConnecting);
+ this.hideElem(this.elemConnectButton);
+ this.hideElem(this.elemAdvancedButton);
+ this.hideElem(this.elemCopyLogButton);
+ this.showElem(this.elemCancelButton);
+ this.showElem(this.elemProgressContent);
+ this.showElem(this.elemProgressMeter);
+ this.elemTitle.classList.remove("error");
+ }
+
+ setBootstrapErrorUI() {
+ this.setTitle(this.torStrings.torConnect.torBootstrapFailed);
+ this.elemConnectButton.textContent = this.torStrings.torConnect.tryAgain;
+ this.showElem(this.elemConnectButton);
+ this.hideElem(this.elemCancelButton);
+ this.showElem(this.elemAdvancedButton);
+ this.showElem(this.elemProgressContent);
+ this.hideElem(this.elemProgressMeter);
+ this.elemTitle.classList.add("error");
+
+ this.elem
+ }
+
+ goToBrowserHome() {
+ this.hideElem(this.elemCancelButton);
+ RPMSendAsyncMessage("GoToBrowserHome");
+ }
+
+ set state(state) {
+ const oldState = this.state;
+ if (oldState === state) {
+ return;
+ }
+ this._state = state;
+ switch (this.state) {
+ case AboutTorConnect.STATE_INITIAL:
+ this.setInitialUI();
+ break;
+ case AboutTorConnect.STATE_BOOTSTRAPPING:
+ this.setBootstrappingUI();
+ break;
+ case AboutTorConnect.STATE_BOOTSTRAP_ERROR:
+ this.setBootstrapErrorUI();
+ break;
+ case AboutTorConnect.STATE_BOOTSTRAPPED:
+ this.goToBrowserHome();
+ break;
+ }
+ }
+
+ async showErrorMessage(aErrorObj) {
+ if (aErrorObj && aErrorObj.message) {
+ this.setTitle(aErrorObj.message);
+ if (aErrorObj.details) {
+ this.elemProgressDesc.textContent = aErrorObj.details;
+ }
+ }
+
+ let haveErrorOrWarning =
+ (await RPMSendQuery("TorBootstrapErrorOccurred")) ||
+ (await RPMSendQuery("TorLogHasWarnOrErr"));
+ this.showCopyLogButton(haveErrorOrWarning);
+ this.showElem(this.elemConnectButton);
+ }
+
+ showElem(elem) {
+ elem.removeAttribute("hidden");
+ }
+
+ hideElem(elem) {
+ elem.setAttribute("hidden", "true");
+ }
+
+ async connect() {
+ this.state = AboutTorConnect.STATE_BOOTSTRAPPING;
+ const error = await RPMSendQuery("TorConnect");
+ if (error) {
+ if (error.details) {
+ this.showErrorMessage({ message: error.details }, true);
+ this.showSaveSettingsError(error.details);
+ }
+ }
+ }
+
+ restoreCopyLogVisibility() {
+ this.elemCopyLogButton.setAttribute("hidden", true);
+ }
+
+ showCopyLogButton() {
+ this.elemCopyLogButton.removeAttribute("hidden");
+ }
+
+ async updateBootstrapProgress(status) {
+ let labelText = await RPMSendQuery("GetLocalizedBootstrapStatus", {
+ status,
+ keyword: "TAG",
+ });
+ let percentComplete = status.PROGRESS ? status.PROGRESS : 0;
+ this.elemProgressMeter.style.width = `${percentComplete}%`;
+
+ if (await RPMSendQuery("TorBootstrapErrorOccurred")) {
+ this.state = AboutTorConnect.STATE_BOOTSTRAP_ERROR;
+ return;
+ } else if (await RPMSendQuery("TorIsNetworkDisabled")) {
+ // If tor network is not connected, let's go to the initial state, even
+ // if bootstrap state is greater than 0.
+ this.state = AboutTorConnect.STATE_INITIAL;
+ return;
+ } else if (percentComplete >= 100) {
+ this.state = AboutTorConnect.STATE_BOOTSTRAPPED;
+ } else if (percentComplete > 0) {
+ this.state = AboutTorConnect.STATE_BOOTSTRAPPING;
+ }
+
+ // Due to async, status might have changed. Do not override desc if so.
+ if (this.state === AboutTorConnect.STATE_BOOTSTRAPPING) {
+ this.hideElem(this.elemConnectButton);
+ }
+ }
+
+ stopTorBootstrap() {
+ RPMSendAsyncMessage("TorStopBootstrap");
+ }
+
+ setTitle(title) {
+ const titleElement = document.querySelector(".title-text");
+ titleElement.textContent = title;
+ document.title = title;
+ }
+
+ initButtons() {
+ this.elemAdvancedButton.textContent = this.torStrings.torConnect.torConfigure;
+ this.elemAdvancedButton.addEventListener("click", () => {
+ RPMSendAsyncMessage("OpenTorAdvancedPreferences");
+ });
+
+ this.elemConnectButton.textContent =
+ this.torStrings.torConnect.torConnectButton;
+ this.elemConnectButton.addEventListener("click", () => {
+ this.connect();
+ });
+
+ this.elemCancelButton.textContent = this.torStrings.torConnect.cancel;
+ this.elemCancelButton.addEventListener("click", () => {
+ this.stopTorBootstrap();
+ });
+
+ // sets the text content while keping the child elements intact
+ this.elemCopyLogButton.childNodes[0].nodeValue =
+ this.torStrings.torConnect.copyLog;
+ this.elemCopyLogButton.addEventListener("click", async () => {
+ const copiedMessage = await RPMSendQuery("TorCopyLog");
+ aboutTorConnect.elemCopyLogTooltipText.textContent = copiedMessage;
+ aboutTorConnect.elemCopyLogTooltip.style.visibility = "visible";
+
+ // clear previous timeout if one already exists
+ if (aboutTorConnect.copyLogTimeoutId) {
+ clearTimeout(aboutTorConnect.copyLogTimeoutId);
+ }
+
+ // hide tooltip after X ms
+ const TOOLTIP_TIMEOUT = 2000;
+ aboutTorConnect.copyLogTimeoutId = setTimeout(function() {
+ aboutTorConnect.elemCopyLogTooltip.style.visibility = "hidden";
+ aboutTorConnect.copyLogTimeoutId = 0;
+ }, TOOLTIP_TIMEOUT);
+ });
+ }
+
+ initObservers() {
+ RPMAddMessageListener(kTorBootstrapErrorTopic, ({ data }) => {
+ this.showCopyLogButton(true);
+ this.stopTorBootstrap();
+ this.showErrorMessage(data);
+ });
+ RPMAddMessageListener(kTorLogHasWarnOrErrTopic, () => {
+ this.showCopyLogButton(true);
+ });
+ RPMAddMessageListener(kTorProcessDidNotStartTopic, ({ data }) => {
+ this.showErrorMessage(data);
+ });
+ RPMAddMessageListener(kTorBootstrapStatusTopic, ({ data }) => {
+ this.updateBootstrapProgress(data);
+ });
+ }
+
+ async init() {
+ this.torStrings = await RPMSendQuery("GetTorStrings");
+ document.documentElement.setAttribute(
+ "dir",
+ await RPMSendQuery("GetDirection")
+ );
+ this.initButtons();
+ this.initObservers();
+ this.state = AboutTorConnect.STATE_INITIAL;
+
+ // Request the most recent bootstrap status info so that a
+ // TorBootstrapStatus notification is generated as soon as possible.
+ RPMSendAsyncMessage("TorRetrieveBootstrapStatus");
+ }
+}
+
+const aboutTorConnect = new AboutTorConnect();
+aboutTorConnect.init();
diff --git a/browser/components/torconnect/content/aboutTorConnect.xhtml b/browser/components/torconnect/content/aboutTorConnect.xhtml
new file mode 100644
index 000000000000..e0f813f62d67
--- /dev/null
+++ b/browser/components/torconnect/content/aboutTorConnect.xhtml
@@ -0,0 +1,46 @@
+<!-- Copyright (c) 2021, The Tor Project, Inc. -->
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Security-Policy" content="default-src chrome:; object-src 'none'" />
+ <link rel="stylesheet" href="chrome://browser/skin/onionPattern.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="chrome://browser/content/torconnect/aboutTorConnect.css" type="text/css" media="all" />
+ </head>
+ <body>
+ <div id="progressBackground"></div>
+ <div id="connectPageContainer" class="container">
+ <div id="text-container">
+ <div class="title">
+ <h1 class="title-text"/>
+ </div>
+ <div id="connectLongContent">
+ <div id="connectShortDesc">
+ <p id="connectShortDescText" />
+ </div>
+ </div>
+
+ <div id="progressContent" hidden="true">
+ <div class="tbb-header" pack="center">
+ <image class="tbb-logo"/>
+ </div>
+ <div flex="1">
+ <div id="progressDesc"/>
+ </div>
+ </div>
+
+ <div id="connectButtonContainer" class="button-container">
+ <button id="advancedButton" hidden="true"></button>
+ <button id="copyLogButton" hidden="true">
+ <div id="copyLogTooltip">
+ <div id="copyLogTooltipText"></div>
+ </div>
+ </button>
+ <button id="cancelButton" hidden="true"></button>
+ <button id="connectButton" class="primary try-again" hidden="true"></button>
+ </div>
+ </div>
+ </div>
+#include ../../../themes/shared/onionPattern.inc.xhtml
+ </body>
+ <script src="chrome://browser/content/torconnect/aboutTorConnect.js"/>
+</html>
diff --git a/browser/components/torconnect/content/onion-slash.svg b/browser/components/torconnect/content/onion-slash.svg
new file mode 100644
index 000000000000..efb09700ec0b
--- /dev/null
+++ b/browser/components/torconnect/content/onion-slash.svg
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+ <g fill-opacity="context-fill-opacity" fill="context-fill">
+ <path d="M3.409559 13.112147C3.409559 13.112147 8.200807 8.103115 8.200807 8.103115C8.200807 8.103115 8.200807 6.516403 8.200807 6.516403C8.620819 6.516403 9.009719 6.703075 9.274171 6.998639C9.274171 6.998639 10.160863 6.080835 10.160863 6.080835C9.663071 5.567487 8.978607 5.256367 8.200807 5.256367C8.200807 5.256367 8.200807 4.400787 8.200807 4.400787C9.196391 4.400787 10.098639 4.805243 10.736435 5.458595C10.736435 5.458595 11.623127 4.540791 11.623127 4.540791C10.751991 3.669655 9.538623 3.125195 8.200807 3.125195C8.200807 3.125195 8.200807 2.269615 8.200807 2.269615C9.756407 2.269615 11.172003 2.907411 12.214255 3.918551C12.214255 3.918551 13.100947 3.000747 13.100947 3.000747C11.825355 1.756267 10.098639 0.994023 8.185251 0.994023C4.311807 0.994023 1.185051 4.120779 1.185051 7.994223C1.185051 10.016503 2.040631 11.836555 3.409559 13.112147C3.409559 13.112147 3.409559 13.112147 3.409559 13.112147"/>
+ <path d="M14.205423 4.416343C14.205423 4.416343 13.287619 5.380815 13.287619 5.380815C13.692075 6.158615 13.909859 7.045307 13.909859 7.994223C13.909859 11.152091 11.358675 13.718831 8.200807 13.718831C8.200807 13.718831 8.200807 12.863251 8.200807 12.863251C10.891995 12.863251 13.069835 10.669855 13.069835 7.978667C13.069835 7.278647 12.929831 6.625295 12.665379 6.018611C12.665379 6.018611 11.685351 7.045307 11.685351 7.045307C11.763131 7.340871 11.809799 7.651991 11.809799 7.963111C11.809799 9.954279 10.207531 11.556547 8.216363 11.572103C8.216363 11.572103 8.216363 10.716523 8.216363 10.716523C9.725295 10.700967 10.954219 9.472043 10.954219 7.963111C10.954219 7.916443 10.954219 7.854219 10.954219 7.807551C10.954219 7.807551 4.887379 14.169955 4.887379 14.169955C5.867407 14.698859 6.987439 14.994423 8.185251 14.994423C12.058695 14.994423 15.185451 11.867667 15.185451 7.994223C15.185451 6.687519 14.827663 5.474151 14.205423 4.416343C14.205423 4.416343 14.205423 4.416343 14.20542
3 4.416343"/>
+ <path d="M1.791735 15.461103C1.402835 15.461103 1.045047 15.212207 0.889487 14.838863C0.733927 14.465519 0.827267 14.014395 1.107271 13.734387C1.107271 13.734387 13.458735 0.822907 13.458735 0.822907C13.847635 0.434007 14.454319 0.449563 14.827663 0.838467C15.201007 1.227367 15.216563 1.865163 14.843223 2.269619C14.843223 2.269619 2.491759 15.181099 2.491759 15.181099C2.289531 15.352215 2.040635 15.461107 1.791739 15.461107C1.791739 15.461107 1.791735 15.461103 1.791735 15.461103"/>
+ </g>
+</svg>
diff --git a/browser/components/torconnect/content/onion.svg b/browser/components/torconnect/content/onion.svg
new file mode 100644
index 000000000000..30cd52ba5c51
--- /dev/null
+++ b/browser/components/torconnect/content/onion.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
+ <path fill="context-fill" fill-opacity="context-fill-opacity" d="M12.0246161,21.8174863 L12.0246161,20.3628098 C16.6324777,20.3495038 20.3634751,16.6108555 20.3634751,11.9996673 C20.3634751,7.38881189 16.6324777,3.65016355 12.0246161,3.63685757 L12.0246161,2.18218107 C17.4358264,2.1958197 21.8178189,6.58546322 21.8178189,11.9996673 C21.8178189,17.4142042 17.4358264,21.8041803 12.0246161,21.8174863 L12.0246161,21.8174863 Z M12.0246161,16.7259522 C14.623607,16.7123136 16.7272828,14.6023175 16.7272828,11.9996673 C16.7272828,9.39734991 14.623607,7.28735377 12.0246161,7.27371516 L12.0246161,5.81937131 C15.4272884,5.8326773 18.1819593,8.59400123 18.1819593,11.9996673 C18.1819593,15.4056661 15.4272884,18.1669901 12.0246161,18.1802961 L12.0246161,16.7259522 Z M12.0246161,9.45556355 C13.4187503,9.46886953 14.5454344,10.6022066 14.5454344,11.9996673 C14.5454344,13.3974608 13.4187503,14.5307978 12.0246161,14.5441038 L12.0246161,9.45556355 Z M0,11.9996673 C0,18.6273771 5.37229031,24 12,24 C18
.6273771,24 24,18.6273771 24,11.9996673 C24,5.37229031 18.6273771,0 12,0 C5.37229031,0 0,5.37229031 0,11.9996673 Z"/>
+</svg>
\ No newline at end of file
diff --git a/browser/components/torconnect/content/torBootstrapUrlbar.js b/browser/components/torconnect/content/torBootstrapUrlbar.js
new file mode 100644
index 000000000000..55a595b2dbab
--- /dev/null
+++ b/browser/components/torconnect/content/torBootstrapUrlbar.js
@@ -0,0 +1,136 @@
+// Copyright (c) 2021, The Tor Project, Inc.
+
+"use strict";
+
+ const TorConnectionStatus = {
+ invalid: -1,
+ offline: 0,
+ connecting: 1,
+ connected: 2,
+ failure: 3,
+ };
+var TorBootstrapUrlbar;
+
+{
+ const { TorProtocolService } = ChromeUtils.import(
+ "resource:///modules/TorProtocolService.jsm"
+ );
+ const { TorLauncherUtil } = ChromeUtils.import(
+ "resource://torlauncher/modules/tl-util.jsm"
+ );
+ const { TorStrings } = ChromeUtils.import(
+ "resource:///modules/TorStrings.jsm"
+ );
+
+ const kTorProcessReadyTopic = "TorProcessIsReady";
+ const kTorProcessExitedTopic = "TorProcessExited";
+ const kTorProcessDidNotStartTopic = "TorProcessDidNotStart";
+ const kTorBootstrapStatusTopic = "TorBootstrapStatus";
+ const kTorBootstrapErrorTopic = "TorBootstrapError";
+
+ const gActiveTopics = [
+ kTorProcessReadyTopic,
+ kTorProcessExitedTopic,
+ kTorProcessDidNotStartTopic,
+ kTorBootstrapStatusTopic,
+ kTorBootstrapErrorTopic,
+ ];
+
+ TorBootstrapUrlbar = {
+ _connectionStatus: TorConnectionStatus.invalid,
+ get ConnectionStatus() {
+ return this._connectionStatus;
+ },
+
+ _torConnectBox : null,
+ get TorConnectBox() {
+ if (!this._torConnectBox) {
+ this._torConnectBox =
+ browser.ownerGlobal.document.getElementById("torconnect-box");
+ }
+ return this._torConnectBox;
+ },
+
+ _torConnectLabel : null,
+ get TorConnectLabel() {
+ if (!this._torConnectLabel) {
+ this._torConnectLabel =
+ browser.ownerGlobal.document.getElementById("torconnect-label");
+ }
+ return this._torConnectLabel;
+ },
+
+ _updateConnectionStatus(percentComplete = 0) {
+ if (TorProtocolService.ownsTorDaemon &&
+ !TorLauncherUtil.useLegacyLauncher) {
+ if (TorProtocolService.isNetworkDisabled()) {
+ if (TorProtocolService.torBootstrapErrorOccurred()) {
+ this._connectionStatus = TorConnectionStatus.failure;
+ } else {
+ this._connectionStatus = TorConnectionStatus.offline;
+ }
+ } else if (percentComplete < 100) {
+ this._connectionStatus = TorConnectionStatus.connecting;
+ } else if (percentComplete === 100) {
+ this._connectionStatus = TorConnectionStatus.connected;
+ }
+ }
+ else
+ {
+ this._connectionStatus = TorConnectionStatus.invalid;
+ }
+
+ switch(this._connectionStatus)
+ {
+ case TorConnectionStatus.failure:
+ case TorConnectionStatus.offline:
+ this.TorConnectBox.removeAttribute("hidden");
+ this.TorConnectLabel.textContent = TorStrings.torConnect.offline;
+ gURLBar._inputContainer.setAttribute("torconnect", "offline");
+ break;
+ case TorConnectionStatus.connecting:
+ this.TorConnectLabel.textContent =
+ TorStrings.torConnect.torConnectingConcise;
+ gURLBar._inputContainer.setAttribute("torconnect", "connecting");
+ break;
+ case TorConnectionStatus.connected:
+ this.TorConnectLabel.textContent =
+ TorStrings.torConnect.torConnectedConcise;
+ gURLBar._inputContainer.setAttribute("torconnect", "connected");
+ // hide torconnect box after 5 seconds
+ let self = this;
+ setTimeout(function() {
+ self.TorConnectBox.setAttribute("hidden", "true");
+ }, 5000);
+ break;
+ }
+ },
+
+ observe(aSubject, aTopic, aData) {
+ const obj = aSubject?.wrappedJSObject;
+
+ switch (aTopic) {
+ case kTorProcessReadyTopic:
+ case kTorProcessExitedTopic:
+ case kTorProcessDidNotStartTopic:
+ case kTorBootstrapErrorTopic:
+ this._updateConnectionStatus();
+ break;
+ case kTorBootstrapStatusTopic:
+ let percentComplete = obj.PROGRESS ? obj.PROGRESS : 0;
+ this._updateConnectionStatus(percentComplete);
+ break;
+ }
+ },
+ init() {
+ for (const topic of gActiveTopics) {
+ Services.obs.addObserver(this, topic);
+ }
+ },
+ uninit() {
+ for (const topic of gActiveTopics) {
+ Services.obs.removeObserver(this, topic);
+ }
+ },
+ };
+}
diff --git a/browser/components/torconnect/content/torconnect-urlbar.css b/browser/components/torconnect/content/torconnect-urlbar.css
new file mode 100644
index 000000000000..7331f3cd48df
--- /dev/null
+++ b/browser/components/torconnect/content/torconnect-urlbar.css
@@ -0,0 +1,55 @@
+/*
+ ensure our torconnect button is always visible (same rule as for the bookmark button)
+*/
+hbox.urlbar-page-action#torconnect-box {
+ display: -moz-inline-box!important;
+ height: 28px;
+}
+/* disable the button-like default css */
+hbox.urlbar-page-action#torconnect-box:hover,
+hbox.urlbar-page-action#torconnect-box:active {
+ background-color: inherit!important;
+}
+
+label#torconnect-label {
+ line-height: 28px;
+ margin: 0 0.1em;
+ opacity: 0.6;
+}
+
+/* set appropriate sizes for the non-standard ui densities */
+:root[uidensity=compact] {
+ hbox.urlbar-page-action#torconnect-box {
+ height: 24px;
+ }
+ label#torconnect-label {
+ line-height: 24px;
+ }
+}
+:root[uidensity=touch] {
+ hbox.urlbar-page-action#torconnect-box {
+ height: 30px;
+ }
+ label#torconnect-label {
+ line-height: 30px;
+ }
+}
+
+/* hide when hidden attribute is set */
+hbox.urlbar-page-action#torconnect-box[hidden="true"],
+/* hide when user is typing in URL bar */
+#urlbar[usertyping] > #urlbar-input-container > #page-action-buttons > #torconnect-box {
+ display: none!important;
+}
+
+/* hide urlbar's placeholder text when not connectd to tor */
+hbox#urlbar-input-container[torconnect="offline"] input#urlbar-input::placeholder,
+hbox#urlbar-input-container[torconnect="connecting"] input#urlbar-input::placeholder {
+ opacity: 0;
+}
+
+/* hide search suggestions when not connected to tor */
+hbox#urlbar-input-container[torconnect="offline"] + vbox.urlbarView,
+hbox#urlbar-input-container[torconnect="connecting"] + vbox.urlbarView {
+ display: none!important;
+}
diff --git a/browser/components/torconnect/content/torconnect-urlbar.inc.xhtml b/browser/components/torconnect/content/torconnect-urlbar.inc.xhtml
new file mode 100644
index 000000000000..bdf9d8f0df00
--- /dev/null
+++ b/browser/components/torconnect/content/torconnect-urlbar.inc.xhtml
@@ -0,0 +1,11 @@
+# Copyright (c) 2021, The Tor Project, Inc.
+
+<hbox id="torconnect-box"
+ class="urlbar-icon-wrapper urlbar-page-action"
+ role="status"
+ hidden="true">
+ <image id="torconnect-button" role="presentation"/>
+ <hbox id="torconnect-container">
+ <label id="torconnect-label"/>
+ </hbox>
+</hbox>
\ No newline at end of file
diff --git a/browser/components/torconnect/jar.mn b/browser/components/torconnect/jar.mn
new file mode 100644
index 000000000000..ed8a4de299b2
--- /dev/null
+++ b/browser/components/torconnect/jar.mn
@@ -0,0 +1,7 @@
+browser.jar:
+ content/browser/torconnect/torBootstrapUrlbar.js (content/torBootstrapUrlbar.js)
+ content/browser/torconnect/aboutTorConnect.css (content/aboutTorConnect.css)
+* content/browser/torconnect/aboutTorConnect.xhtml (content/aboutTorConnect.xhtml)
+ content/browser/torconnect/aboutTorConnect.js (content/aboutTorConnect.js)
+ content/browser/torconnect/onion.svg (content/onion.svg)
+ content/browser/torconnect/onion-slash.svg (content/onion-slash.svg)
diff --git a/browser/components/torconnect/moz.build b/browser/components/torconnect/moz.build
new file mode 100644
index 000000000000..eb29c31a4243
--- /dev/null
+++ b/browser/components/torconnect/moz.build
@@ -0,0 +1,6 @@
+JAR_MANIFESTS += ['jar.mn']
+
+EXTRA_JS_MODULES += [
+ 'TorConnectChild.jsm',
+ 'TorConnectParent.jsm',
+]
diff --git a/browser/components/torpreferences/content/torPane.js b/browser/components/torpreferences/content/torPane.js
index 49054b5dac6a..66213ceb7789 100644
--- a/browser/components/torpreferences/content/torPane.js
+++ b/browser/components/torpreferences/content/torPane.js
@@ -1,5 +1,7 @@
"use strict";
+/* global Services */
+
const { TorProtocolService } = ChromeUtils.import(
"resource:///modules/TorProtocolService.jsm"
);
@@ -62,6 +64,11 @@ const gTorPane = (function() {
category: {
title: "label#torPreferences-labelCategory",
},
+ messageBox: {
+ box: "div#torPreferences-connectMessageBox",
+ message: "td#torPreferences-connectMessageBox-message",
+ button: "button#torPreferences-connectMessageBox-button",
+ },
torPreferences: {
header: "h1#torPreferences-header",
description: "span#torPreferences-description",
@@ -112,6 +119,9 @@ const gTorPane = (function() {
let retval = {
// cached frequently accessed DOM elements
+ _messageBox: null,
+ _messageBoxMessage: null,
+ _messageBoxButton: null,
_useBridgeCheckbox: null,
_bridgeSelectionRadiogroup: null,
_builtinBridgeOption: null,
@@ -161,6 +171,42 @@ const gTorPane = (function() {
let prefpane = document.getElementById("mainPrefPane");
+ // 'Connect to Tor' Message Bar
+
+ this._messageBox = prefpane.querySelector(selectors.messageBox.box);
+ this._messageBoxMessage = prefpane.querySelector(selectors.messageBox.message);
+ this._messageBoxButton = prefpane.querySelector(selectors.messageBox.button);
+ // wire up connect button
+ this._messageBoxButton.addEventListener("click", () => {
+ TorProtocolService.connect();
+ let win = Services.wm.getMostRecentWindow("navigator:browser");
+ win.switchToTabHavingURI("about:torconnect");
+ });
+
+ let populateMessagebox = () => {
+ if (TorProtocolService.shouldShowTorConnect()) {
+ // set messagebox style and text
+ if (TorProtocolService.torBootstrapErrorOccurred()) {
+ this._messageBox.className = "error";
+ this._messageBoxMessage.innerText = TorStrings.torConnect.tryAgainMessage;
+ this._messageBoxButton.innerText = TorStrings.torConnect.tryAgain;
+ } else {
+ this._messageBox.className = "warning";
+ this._messageBoxMessage.innerText = TorStrings.torConnect.connectMessage;
+ this._messageBoxButton.innerText = TorStrings.torConnect.torConnectButton;
+ }
+ } else {
+ this._messageBox.className = "hidden";
+ this._messageBoxMessage.innerText = "";
+ this._messageBoxButton.innerText = "";
+ }
+ }
+ populateMessagebox();
+ // update the messagebox whenever we come back to the page
+ window.addEventListener("focus", val => {
+ populateMessagebox();
+ });
+
// Heading
prefpane.querySelector(selectors.torPreferences.header).innerText =
TorStrings.settings.torPreferencesHeading;
diff --git a/browser/components/torpreferences/content/torPane.xhtml b/browser/components/torpreferences/content/torPane.xhtml
index 3c966b2b3726..88f82c37a3c9 100644
--- a/browser/components/torpreferences/content/torPane.xhtml
+++ b/browser/components/torpreferences/content/torPane.xhtml
@@ -3,6 +3,29 @@
<script type="application/javascript"
src="chrome://browser/content/torpreferences/torPane.js"/>
<html:template id="template-paneTor">
+
+<!-- Tor Connect Message Box -->
+<groupbox data-category="paneTor" hidden="true">
+ <html:div id="torPreferences-connectMessageBox"
+ class="subcategory"
+ data-category="paneTor"
+ hidden="true">
+ <html:table >
+ <html:tr>
+ <html:td>
+ <html:div id="torPreferences-connectMessageBox-icon"/>
+ </html:td>
+ <html:td id="torPreferences-connectMessageBox-message">
+ </html:td>
+ <html:td>
+ <html:button id="torPreferences-connectMessageBox-button">
+ </html:button>
+ </html:td>
+ </html:tr>
+ </html:table>
+ </html:div>
+</groupbox>
+
<hbox id="torPreferencesCategory"
class="subcategory"
data-category="paneTor"
diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css
index 4dac2c457823..f125936dac74 100644
--- a/browser/components/torpreferences/content/torPreferences.css
+++ b/browser/components/torpreferences/content/torPreferences.css
@@ -2,6 +2,127 @@
list-style-image: url("chrome://browser/content/torpreferences/torPreferencesIcon.svg");
}
+/* Connect Message Box */
+
+#torPreferences-connectMessageBox {
+ display: block;
+ position: relative;
+
+ width: auto;
+ min-height: 32px;
+ border-radius: 4px;
+ padding: 4px;
+}
+
+#torPreferences-connectMessageBox.hidden {
+ display: none;
+}
+
+#torPreferences-connectMessageBox.error {
+ background-color: var(--red-60);
+ color: white;
+}
+
+#torPreferences-connectMessageBox.warning {
+ background-color: var(--yellow-50);
+ color: var(--yellow-90);
+}
+
+#torPreferences-connectMessageBox table {
+ border-collapse: collapse;
+ width: 100%;
+}
+
+#torPreferences-connectMessageBox td {
+ vertical-align: top;
+ padding: 0px;
+}
+
+#torPreferences-connectMessageBox td:first-child {
+ width: 24px;
+}
+
+#torPreferences-connectMessageBox-icon {
+ display: block;
+ width: 16px;
+ height: 16px;
+ padding: 4px;
+
+ mask-repeat: no-repeat !important;
+ mask-size: 16px !important;
+ mask-position: 4px 4px !important;
+}
+
+#torPreferences-connectMessageBox.error #torPreferences-connectMessageBox-icon
+{
+ mask: url("chrome://browser/skin/onion-slash.svg");
+ background-color: white;
+}
+
+#torPreferences-connectMessageBox.warning #torPreferences-connectMessageBox-icon
+{
+ mask: url("chrome://global/skin/icons/warning.svg");
+ background-color: black;
+}
+
+#torPreferences-connectMessageBox-message {
+ display: block;
+ line-height: 16px;
+ font-size: 13px;
+ margin-right: 8px;
+ padding-left: 4px!important;
+ padding-top: 4px!important;
+}
+
+#torPreferences-connectMessageBox-button {
+ display: block;
+ width: auto;
+ height: 24px;
+ line-height: 24px;
+ min-height: 24px;
+ max-height: 24px;
+ margin: 0px;
+
+ border-radius: 2px;
+ border: 0;
+ padding-left: 8px;
+ padding-right: 8px;
+ margin-left: auto;
+ margin-right: 0px;
+
+ font-size: 11px;
+ font-weight: 400;
+ white-space: nowrap;
+}
+
+#torPreferences-connectMessageBox.error #torPreferences-connectMessageBox-button {
+ background-color: var(--red-70);
+}
+
+#torPreferences-connectMessageBox.error #torPreferences-connectMessageBox-button:hover {
+ background-color: var(--red-80);
+}
+
+#torPreferences-connectMessageBox.error #torPreferences-connectMessageBox-button:active {
+ background-color: var(--red-90);
+}
+
+#torPreferences-connectMessageBox.warning #torPreferences-connectMessageBox-button {
+ background-color: var(--yellow-60);
+}
+
+#torPreferences-connectMessageBox.warning #torPreferences-connectMessageBox-button:hover {
+ background-color: var(--yellow-70);
+ color: white!important;
+}
+
+#torPreferences-connectMessageBox.warning #torPreferences-connectMessageBox-button:active {
+ background-color: var(--yellow-80);
+ color: white!important;
+}
+
+/* Advanced Settings */
+
#torPreferences-advanced-grid {
display: grid;
grid-template-columns: auto 1fr;
diff --git a/browser/modules/TorProcessService.jsm b/browser/modules/TorProcessService.jsm
new file mode 100644
index 000000000000..201e331b2806
--- /dev/null
+++ b/browser/modules/TorProcessService.jsm
@@ -0,0 +1,12 @@
+"use strict";
+
+var EXPORTED_SYMBOLS = ["TorProcessService"];
+
+var TorProcessService = {
+ get isBootstrapDone() {
+ const svc = Cc["@torproject.org/torlauncher-process-service;1"].getService(
+ Ci.nsISupports
+ ).wrappedJSObject;
+ return svc.mIsBootstrapDone;
+ },
+};
diff --git a/browser/modules/TorProtocolService.jsm b/browser/modules/TorProtocolService.jsm
index b4e6ed9a3253..fc7f2c884aa2 100644
--- a/browser/modules/TorProtocolService.jsm
+++ b/browser/modules/TorProtocolService.jsm
@@ -1,3 +1,5 @@
+// Copyright (c) 2021, The Tor Project, Inc.
+
"use strict";
var EXPORTED_SYMBOLS = ["TorProtocolService"];
@@ -11,6 +13,10 @@ var TorProtocolService = {
Ci.nsISupports
).wrappedJSObject,
+ _tlproc: Cc["@torproject.org/torlauncher-process-service;1"].getService(
+ Ci.nsISupports
+ ).wrappedJSObject,
+
// maintain a map of tor settings set by Tor Browser so that we don't
// repeatedly set the same key/values over and over
// this map contains string keys to primitive or array values
@@ -196,11 +202,11 @@ var TorProtocolService = {
// writes current tor settings to disk
flushSettings() {
- this._tlps.TorSendCommand("SAVECONF");
+ this.sendCommand("SAVECONF");
},
- getLog() {
- let countObj = { value: 0 };
+ getLog(countObj) {
+ countObj = countObj || { value: 0 };
let torLog = this._tlps.TorGetLog(countObj);
return torLog;
},
@@ -209,4 +215,116 @@ var TorProtocolService = {
get ownsTorDaemon() {
return TorLauncherUtil.shouldStartAndOwnTor;
},
+
+ // Assumes `ownsTorDaemon` is true
+ isNetworkDisabled() {
+ const reply = TorProtocolService._tlps.TorGetConfBool(
+ "DisableNetwork",
+ true
+ );
+ if (TorProtocolService._tlps.TorCommandSucceeded(reply)) {
+ return reply.retVal;
+ }
+ return true;
+ },
+
+ enableNetwork() {
+ let settings = {};
+ settings.DisableNetwork = false;
+ let errorObject = {};
+ if (!this._tlps.TorSetConfWithReply(settings, errorObject)) {
+ throw new Error(errorObject.details);
+ }
+ },
+
+ sendCommand(cmd) {
+ return this._tlps.TorSendCommand(cmd);
+ },
+
+ retrieveBootstrapStatus() {
+ return this._tlps.TorRetrieveBootstrapStatus();
+ },
+
+ _GetSaveSettingsErrorMessage(aDetails) {
+ try {
+ return TorLauncherUtil.getSaveSettingsErrorMessage(aDetails);
+ } catch (e) {
+ console.log("GetSaveSettingsErrorMessage error", e);
+ return "Unexpected Error";
+ }
+ },
+
+ setConfWithReply(settings) {
+ let result = false;
+ const error = {};
+ try {
+ result = this._tlps.TorSetConfWithReply(settings, error);
+ } catch (e) {
+ console.log("TorSetConfWithReply error", e);
+ error.details = this._GetSaveSettingsErrorMessage(e.message);
+ }
+ return { result, error };
+ },
+
+ isBootstrapDone() {
+ return this._tlproc.mIsBootstrapDone;
+ },
+
+ clearBootstrapError() {
+ return this._tlproc.TorClearBootstrapError();
+ },
+
+ shouldShowTorConnect() {
+ return (
+ this.ownsTorDaemon &&
+ !TorLauncherUtil.useLegacyLauncher &&
+ (this.isNetworkDisabled() || !this.isBootstrapDone())
+ );
+ },
+
+ torBootstrapErrorOccurred() {
+ return this._tlproc.TorBootstrapErrorOccurred;
+ },
+
+ // Resolves to null if ok, or an error otherwise
+ connect() {
+ const kTorConfKeyDisableNetwork = "DisableNetwork";
+ const settings = {};
+ settings[kTorConfKeyDisableNetwork] = false;
+ const { result, error } = this.setConfWithReply(settings);
+ if (!result) {
+ return error;
+ }
+ try {
+ this.sendCommand("SAVECONF");
+ this.clearBootstrapError();
+ this.retrieveBootstrapStatus();
+ } catch (e) {
+ return error;
+ }
+ return null;
+ },
+
+ torLogHasWarnOrErr() {
+ return this._tlps.TorLogHasWarnOrErr;
+ },
+
+ torStopBootstrap() {
+ // Tell tor to disable use of the network; this should stop the bootstrap
+ // process.
+ const kErrorPrefix = "Setting DisableNetwork=1 failed: ";
+ try {
+ let settings = {};
+ settings.DisableNetwork = true;
+ const { result, error } = this.setConfWithReply(settings);
+ if (!result) {
+ console.log(
+ `Error stopping bootstrap ${kErrorPrefix} ${error.details}`
+ );
+ }
+ } catch (e) {
+ console.log(`Error stopping bootstrap ${kErrorPrefix} ${e}`);
+ }
+ this.retrieveBootstrapStatus();
+ },
};
diff --git a/browser/modules/TorStrings.jsm b/browser/modules/TorStrings.jsm
index 1e08b168e4af..407a220278c4 100644
--- a/browser/modules/TorStrings.jsm
+++ b/browser/modules/TorStrings.jsm
@@ -364,6 +364,78 @@ var TorStrings = {
return retval;
})() /* Tor Network Settings Strings */,
+ torConnect: (() => {
+ const tsbNetwork = new TorDTDStringBundle(
+ ["chrome://torlauncher/locale/network-settings.dtd"],
+ ""
+ );
+ const tsbLauncher = new TorPropertyStringBundle(
+ "chrome://torlauncher/locale/torlauncher.properties",
+ "torlauncher."
+ );
+ const tsbCommon = new TorPropertyStringBundle(
+ "chrome://global/locale/commonDialogs.properties",
+ ""
+ );
+
+ const getStringNet = tsbNetwork.getString.bind(tsbNetwork);
+ const getStringLauncher = tsbLauncher.getString.bind(tsbLauncher);
+ const getStringCommon = tsbCommon.getString.bind(tsbCommon);
+
+ return {
+ torConnect: getStringNet(
+ "torsettings.wizard.title.default",
+ "Connect to Tor"
+ ),
+
+ torConnecting: getStringNet(
+ "torsettings.wizard.title.connecting",
+ "Establishing a Connection"
+ ),
+
+ torConnectingConcise: getStringNet(
+ "torConnect.connectingConcise",
+ "Connecting…"
+ ),
+
+ torBootstrapFailed: getStringLauncher(
+ "tor_bootstrap_failed",
+ "Tor failed to establish a Tor network connection."
+ ),
+
+ torConfigure: getStringNet(
+ "torsettings.wizard.title.configure",
+ "Tor Network Settings"
+ ),
+
+ copyLog: getStringNet(
+ "torConnect.copyLog",
+ "Copy Tor Logs"
+ ),
+
+ torConnectButton: getStringNet("torSettings.connect", "Connect"),
+
+ cancel: getStringCommon("Cancel", "Cancel"),
+
+ torConnected: getStringLauncher(
+ "torlauncher.bootstrapStatus.done",
+ "Connected to the Tor network"
+ ),
+
+ torConnectedConcise: getStringLauncher(
+ "torConnect.connectedConcise",
+ "Connected"
+ ),
+
+ tryAgain: getStringNet("torConnect.tryAgain", "Try connecting again"),
+ offline: getStringNet("torConnect.offline", "Offline"),
+
+ // tor connect strings for message box in about:preferences#tor
+ connectMessage: getStringNet("torConnect.connectMessage", "Changes to Tor Settings will not take effect until you connect to the Tor Network"),
+ tryAgainMessage: getStringNet("torConnect.tryAgainMessage", "Tor Browser has failed to establish a connection to the Tor Network"),
+ };
+ })(),
+
/*
Tor Onion Services Strings, e.g., for the authentication prompt.
*/
diff --git a/browser/modules/moz.build b/browser/modules/moz.build
index 5fb78d1c07a8..f2c9dabdddbe 100644
--- a/browser/modules/moz.build
+++ b/browser/modules/moz.build
@@ -155,6 +155,7 @@ EXTRA_JS_MODULES += [
'TabUnloader.jsm',
'ThemeVariableMap.jsm',
'TopSiteAttribution.jsm',
+ 'TorProcessService.jsm',
'TorProtocolService.jsm',
'TorStrings.jsm',
'TransientPrefs.jsm',
diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn
index e4a3c8d2d41c..d38e1001282b 100644
--- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn
@@ -8,6 +8,7 @@
# to the location of the actual manifest.
skin/classic/browser/aboutNetError.css (../shared/aboutNetError.css)
+ skin/classic/browser/onionPattern.css (../shared/onionPattern.css)
skin/classic/browser/blockedSite.css (../shared/blockedSite.css)
skin/classic/browser/error-pages.css (../shared/error-pages.css)
skin/classic/browser/aboutRestartRequired.css (../shared/aboutRestartRequired.css)
diff --git a/browser/themes/shared/onionPattern.css b/browser/themes/shared/onionPattern.css
new file mode 100644
index 000000000000..ac1af7b8d65e
--- /dev/null
+++ b/browser/themes/shared/onionPattern.css
@@ -0,0 +1,121 @@
+/* Onion pattern */
+
+:root {
+ --sqrt3: 1.73205080757;
+}
+
+.onion-pattern-container {
+ opacity: var(--onion-opacity, 1);
+ flex: auto; /* grow to consume remaining space on the page */
+ display: flex;
+ margin: 0 auto;
+ width: 100%;
+ height: calc((2 + var(--sqrt3)) * var(--onion-radius, 50px)); /* room for 2 rows of circles */
+ max-height: calc((2 + var(--sqrt3)) * var(--onion-radius, 50px));
+ direction: ltr;
+}
+
+.onion-pattern-crop {
+ display: flex;
+ justify-content: center;
+ overflow-x: hidden;
+ margin: 0 auto;
+}
+
+/* Centers horizontally within the root container*/
+.onion-pattern-column {
+ width: calc(40 * var(--onion-radius, 50px)); /* room for 20 circles in a row */
+ height: calc((2 + var(--sqrt3)) * var(--onion-radius, 50px)); /* room for 2 rows of circles */
+ flex-shrink: 0;
+ overflow-x: hidden; /* clip extra circles on the sides */
+}
+
+.onion-pattern-row {
+ width: calc(40 * var(--onion-radius, 50px)); /* room for 20 circles in a row */
+ display: flex;
+ flex-direction: row;
+ position: relative;
+}
+
+.onion-pattern-offset-row {
+ left: calc(-1 * var(--onion-radius, 50px));
+ margin-top: calc((var(--sqrt3) - 2.0) * var(--onion-radius, 50px));
+}
+
+/* With borders, circles are 100x100 pixels*/
+.circle {
+ position: relative;
+ min-width: calc(2 * var(--onion-radius, 50px));
+ min-height: calc(2 * var(--onion-radius, 50px));
+ border-radius: 50%;
+ box-sizing: border-box;
+}
+
+.inner {
+ position: absolute;
+ box-sizing: border-box;
+ border-radius: 50%;
+}
+
+.inner:nth-child(1){
+ width: 100%;
+ height: 100%;
+}
+
+.inner:nth-child(2){
+ transform: translate(20%, 20%);
+ width: calc(100% * 5/7);
+ height: calc(100% * 5/7);
+}
+
+.inner:nth-child(3){
+ transform: translate(calc(100% * 2/3), calc(100% * 2/3));
+ width: calc(100% * 3/7);
+ height: calc(100% * 3/7);
+}
+
+.inner:nth-child(4){
+ transform: translate(300%, 300%);
+ width: calc(100% * 1/7);
+ height: calc(100% * 1/7);
+}
+
+.solid {
+ background-color: var(--onion-color, #000);
+}
+
+.border {
+ border: 4px solid var(--onion-color, #000);
+}
+
+.dashed {
+ border: 4px dashed var(--onion-color, #000);
+}
+
+.dotted {
+ border: 4px dotted var(--onion-color, #000);
+}
+
+.bold {
+ border: 8px solid var(--onion-color, #000);
+}
+
+.top-half {
+ width: calc(2 * var(--onion-radius, 50px));
+ height: var(--onion-radius, 50px);
+ border-radius: var(--onion-radius, 50px) var(--onion-radius, 50px) 0 0;
+ box-sizing: border-box;
+}
+
+.bottom-half {
+ width: calc(2 * var(--onion-radius, 50px));
+ height: var(--onion-radius, 50px);
+ border-radius: 0 0 var(--onion-radius, 50px) var(--onion-radius, 50px);
+ box-sizing: border-box;
+}
+
+.scaler {
+ position: absolute;
+ left:0;
+ bottom:0;
+}
\ No newline at end of file
diff --git a/browser/themes/shared/onionPattern.inc.xhtml b/browser/themes/shared/onionPattern.inc.xhtml
new file mode 100644
index 000000000000..95f073e673b4
--- /dev/null
+++ b/browser/themes/shared/onionPattern.inc.xhtml
@@ -0,0 +1,207 @@
+<!--
+ - The abstract onion pattern begins here. There are two
+ - "onion-pattern-row" elements, each containing 14 circles. The width
+ - of "onion-pattern-row" is fixed at a value that is wide enough so the
+ - circles are not distorted by the flex-based layout. The parent
+ - "onion-pattern-container" element has overflow-x: hidden and is designed
+ - to expand to the width of the page, until it reaches a maximum width
+ - that can accommodate all 14 circles. Since the rows are wider than
+ - most browser windows, typically the two rows of onions will fill the
+ - bottom of the page. On really wide pages, the onions are centered at
+ - the bottom of the page.
+-->
+
+<div class="onion-pattern-container">
+ <div class="onion-pattern-crop">
+ <div class="onion-pattern-column">
+ <div class="onion-pattern-row">
+ <div class="circle solid"></div>
+
+ <div class="circle dashed"></div>
+
+ <div class="circle">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle">
+ <div class="bottom-half solid"></div>
+ <div class="bottom-half dotted"></div>
+ </div>
+
+ <div class="circle border"></div>
+
+ <div class="circle">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle solid"></div>
+
+ <div class="circle">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle bold"></div>
+
+ <div class="circle">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle bold"></div>
+
+ <div class="circle">
+ <div class="bottom-half solid"></div>
+ <div class="bottom-half solid"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle dotted"></div>
+
+ <div class="circle">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle solid"></div>
+
+ <div class="circle">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle bold"></div>
+
+ <div class="circle dashed"></div>
+ </div>
+
+ <div class="onion-pattern-row onion-pattern-offset-row">
+ <div class="circle">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle bold"></div>
+
+ <div class="circle solid"></div>
+
+ <div class="circle">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle">
+ <div class="top-half solid"></div>
+ <div class="top-half solid"></div>
+ </div>
+
+ <div class="circle border"></div>
+
+ <div class="circle dotted"></div>
+
+ <div class="circle">
+ <div class="top-half border"></div>
+ <div class="top-half dashed"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle">
+ <div class="top-half dotted"></div>
+ <div class="top-half solid"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle dotted"></div>
+
+ <div class="circle bold"></div>
+
+ <div class="circle solid"></div>
+
+ <div class="circle">
+ <div class="top-half solid"></div>
+ <div class="top-half dotted"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle dotted"></div>
+
+ <div class="circle">
+ <div class="top-half solid"></div>
+ <div class="top-half solid"></div>
+ </div>
+
+ <div class="circle dotted"></div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/browser/themes/shared/urlbar-searchbar.inc.css b/browser/themes/shared/urlbar-searchbar.inc.css
index d3cc6bf7f024..297dbcdf444d 100644
--- a/browser/themes/shared/urlbar-searchbar.inc.css
+++ b/browser/themes/shared/urlbar-searchbar.inc.css
@@ -826,3 +826,5 @@
}
%include ../../components/onionservices/content/onionlocation-urlbar.css
+%include ../../components/torconnect/content/torconnect-urlbar.css
+
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
index afc872569519..e74851a6672c 100644
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -16387,9 +16387,56 @@ void Document::RemoveToplevelLoadingDocument(Document* aDoc) {
StylePrefersColorScheme Document::PrefersColorScheme(
IgnoreRFP aIgnoreRFP) const {
+
+ // tor-browser#27476
+ // should this document ignore resist finger-printing settings with regards to
+ // setting the color scheme
+ // currently only enabled for about:torconnect but we could expand to other non-
+ // SystemPrincipal pages if we wish
+ const auto documentUsesPreferredColorScheme = [](auto const* constDocument) -> bool {
+ if (auto* document = const_cast<Document*>(constDocument); document != nullptr) {
+ auto uri = document->GetDocBaseURI();
+
+ // try and extract out our prepath and filepath portions of the uri to C-strings
+ nsAutoCString prePathStr, filePathStr;
+ if(NS_FAILED(uri->GetPrePath(prePathStr)) ||
+ NS_FAILED(uri->GetFilePath(filePathStr))) {
+ return false;
+ }
+
+ // stick them in string view for easy comparisons
+ std::string_view prePath(prePathStr.get(), prePathStr.Length()),
+ filePath(filePathStr.get(), filePathStr.Length());
+
+ // these about URIs will have the user's preferred color scheme exposed to them
+ // we can place other URIs here in the future if we wish
+ // see nsIURI.idl for URI part definitions
+ constexpr struct {
+ std::string_view prePath;
+ std::string_view filePath;
+ } allowedURIs[] = {
+ { "about:", "torconnect" },
+ };
+
+ // check each uri in the allow list against this document's uri
+ // verify the prepath and the file path match
+ for(auto const& uri : allowedURIs) {
+ if (prePath == uri.prePath &&
+ filePath == uri.filePath) {
+ // positive match means we can apply dark-mode to the page
+ return true;
+ }
+ }
+ }
+
+ // do not allow if no match or other error
+ return false;
+ };
+
if (aIgnoreRFP == IgnoreRFP::No &&
- nsContentUtils::ShouldResistFingerprinting(this)) {
- return StylePrefersColorScheme::Light;
+ nsContentUtils::ShouldResistFingerprinting(this) &&
+ !documentUsesPreferredColorScheme(this)) {
+ return StylePrefersColorScheme::Light;
}
if (nsPresContext* pc = GetPresContext()) {
diff --git a/toolkit/modules/RemotePageAccessManager.jsm b/toolkit/modules/RemotePageAccessManager.jsm
index eceaa7c857de..8a6c0911a060 100644
--- a/toolkit/modules/RemotePageAccessManager.jsm
+++ b/toolkit/modules/RemotePageAccessManager.jsm
@@ -96,6 +96,7 @@ let RemotePageAccessManager = {
RPMPrefIsLocked: ["security.tls.version.min"],
RPMAddToHistogram: ["*"],
RPMGetTorStrings: ["*"],
+ RPMSendQuery: ["ShouldShowTorConnect"],
},
"about:newinstall": {
RPMGetUpdateChannel: ["*"],
@@ -179,6 +180,25 @@ let RemotePageAccessManager = {
RPMAddMessageListener: ["*"],
RPMRemoveMessageListener: ["*"],
},
+ "about:torconnect": {
+ RPMAddMessageListener: ["*"],
+ RPMSendAsyncMessage: [
+ "GoToBrowserHome",
+ "OpenTorAdvancedPreferences",
+ "TorRetrieveBootstrapStatus",
+ "TorStopBootstrap",
+ ],
+ RPMSendQuery: [
+ "GetDirection",
+ "GetLocalizedBootstrapStatus",
+ "GetTorStrings",
+ "TorBootstrapErrorOccurred",
+ "TorConnect",
+ "TorCopyLog",
+ "TorIsNetworkDisabled",
+ "TorLogHasWarnOrErr",
+ ],
+ },
},
/**
diff --git a/toolkit/themes/shared/in-content/info-pages.inc.css b/toolkit/themes/shared/in-content/info-pages.inc.css
index 6943a3340e35..5b3c911a5aab 100644
--- a/toolkit/themes/shared/in-content/info-pages.inc.css
+++ b/toolkit/themes/shared/in-content/info-pages.inc.css
@@ -41,10 +41,11 @@ body.wide-container {
background-image: url("chrome://global/skin/icons/info.svg");
background-position: left 0;
background-repeat: no-repeat;
- background-size: 1.6em;
- margin-inline-start: -2.3em;
- padding-inline-start: 2.3em;
- font-size: 2.2em;
+ background-size: 3.0em;
+ margin-inline-start: -4.5em;
+ padding-inline-start: 4.5em;
+ margin-bottom: -2.0em;
+ font-size: 1.5em;
-moz-context-properties: fill;
fill: currentColor;
}
@@ -56,7 +57,10 @@ body.wide-container {
.title-text {
font-size: inherit;
- padding-bottom: 0.4em;
+ padding-bottom: 2.0em !important;
+ line-height: 1.0em;
+ font-weight: bold;
+ vertical-align: top;
}
@media (max-width: 970px) {
@@ -68,6 +72,7 @@ body.wide-container {
.title-text {
padding-top: 0;
+ vertical-align: middle !important;
}
}
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
index 2ff107b553b2..f8fa83574df7 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
@@ -70,6 +70,10 @@ function getGlobalScriptIncludes(scriptPath) {
let match = line.match(globalScriptsRegExp);
if (match) {
let sourceFile = match[1]
+ .replace(
+ "chrome://browser/content/torconnect/",
+ "browser/components/torconnect/content/"
+ )
.replace(
"chrome://browser/content/search/",
"browser/components/search/content/"
1
0

[tor-browser/tor-browser-78.11.0esr-10.5-1] Bug 1642404 - add an option to show that an update is being downloaded r=bytesized, fluent-reviewers, flod
by sysrqb@torproject.org 02 Jun '21
by sysrqb@torproject.org 02 Jun '21
02 Jun '21
commit 1dbe18de16877745c1641a1ec6876ba67f40b7a5
Author: Mark Smith <mcs(a)pearlcrescent.com>
Date: Mon Jun 22 20:24:46 2020 +0000
Bug 1642404 - add an option to show that an update is being downloaded r=bytesized,fluent-reviewers,flod
Add support for a hidden preference named app.update.notifyDuringDownload
that, when set to true, causes a "Downloading update" message to appear
in the app menu during a MAR download. Clicking the message opens the
about box so the user can see detailed progress information.
Differential Revision: https://phabricator.services.mozilla.com/D77688
---
browser/app/profile/firefox.js | 4 ++
browser/components/BrowserGlue.jsm | 1 +
.../customizableui/content/panelUI.inc.xhtml | 2 +
.../components/customizableui/content/panelUI.js | 5 ++
.../test/browser_panelUINotifications.js | 62 ++++++++++++++++++++++
browser/locales/en-US/browser/appmenu.ftl | 2 +
.../themes/shared/customizableui/panelUI.inc.css | 3 ++
browser/themes/shared/notification-icons.inc.css | 1 +
browser/themes/shared/toolbarbutton-icons.inc.css | 1 +
toolkit/mozapps/update/UpdateListener.jsm | 50 +++++++++++------
toolkit/mozapps/update/UpdateService.jsm | 27 ++++++++++
.../mozapps/update/tests/browser/browser.bits.ini | 1 +
toolkit/mozapps/update/tests/browser/browser.ini | 1 +
.../update/tests/browser/browser.legacy.bits.ini | 1 +
.../update/tests/browser/browser.legacy.ini | 1 +
.../browser/browser_aboutDialog_bc_downloading.js | 17 ++++++
.../browser_aboutDialog_bc_downloading_notify.js | 58 ++++++++++++++++++++
toolkit/mozapps/update/tests/data/shared.js | 1 +
18 files changed, 222 insertions(+), 16 deletions(-)
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index a7e0bd808254..479c68efdd8c 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -131,6 +131,10 @@ pref("app.update.download.promptMaxAttempts", 2);
// download a fresh installer.
pref("app.update.elevation.promptMaxAttempts", 2);
+// If set to true, a message will be displayed in the hamburger menu while
+// an update is being downloaded.
+pref("app.update.notifyDuringDownload", false);
+
// If set to true, the Update Service will automatically download updates if the
// user can apply updates. This pref is no longer used on Windows, except as the
// default value to migrate to the new location that this data is now stored
diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm
index 70f5ad8b85e4..0a3555f26432 100644
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -769,6 +769,7 @@ const global = this;
const listeners = {
observers: {
+ "update-downloading": ["UpdateListener"],
"update-staged": ["UpdateListener"],
"update-downloaded": ["UpdateListener"],
"update-available": ["UpdateListener"],
diff --git a/browser/components/customizableui/content/panelUI.inc.xhtml b/browser/components/customizableui/content/panelUI.inc.xhtml
index e5c9c00c35e4..3a8b74b0a9f3 100644
--- a/browser/components/customizableui/content/panelUI.inc.xhtml
+++ b/browser/components/customizableui/content/panelUI.inc.xhtml
@@ -223,6 +223,8 @@
<vbox class="panel-subview-body">
<vbox id="appMenu-addon-banners"/>
<toolbarbutton id="appMenu-update-banner" class="panel-banner-item"
+ data-l10n-id="appmenuitem-update-banner"
+ data-l10n-attrs="label-update-downloading"
label-update-available="&updateAvailable.panelUI.label;"
label-update-manual="&updateManual.panelUI.label;"
label-update-unsupported="&updateUnsupported.panelUI.label;"
diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js
index 1f6ed5caf839..a81be30f3ec7 100644
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -65,6 +65,7 @@ const PanelUI = {
Services.obs.addObserver(this, "fullscreen-nav-toolbox");
Services.obs.addObserver(this, "appMenu-notifications");
+ Services.obs.addObserver(this, "show-update-progress");
XPCOMUtils.defineLazyPreferenceGetter(
this,
@@ -182,6 +183,7 @@ const PanelUI = {
Services.obs.removeObserver(this, "fullscreen-nav-toolbox");
Services.obs.removeObserver(this, "appMenu-notifications");
+ Services.obs.removeObserver(this, "show-update-progress");
window.removeEventListener("MozDOMFullscreen:Entered", this);
window.removeEventListener("MozDOMFullscreen:Exited", this);
@@ -271,6 +273,9 @@ const PanelUI = {
this._notifications = AppMenuNotifications.notifications;
this._updateNotifications(true);
break;
+ case "show-update-progress":
+ openAboutDialog();
+ break;
}
},
diff --git a/browser/components/customizableui/test/browser_panelUINotifications.js b/browser/components/customizableui/test/browser_panelUINotifications.js
index 39ae5435c453..cab471bc946f 100644
--- a/browser/components/customizableui/test/browser_panelUINotifications.js
+++ b/browser/components/customizableui/test/browser_panelUINotifications.js
@@ -156,6 +156,68 @@ add_task(async function testSecondaryActionWorkflow() {
});
});
+/**
+ * This tests that the PanelUI update downloading badge and banner
+ * notification are correctly displayed and that clicking the banner
+ * item calls the main action.
+ */
+add_task(async function testDownloadingBadge() {
+ let options = {
+ gBrowser: window.gBrowser,
+ url: "about:blank",
+ };
+
+ await BrowserTestUtils.withNewTab(options, async function(browser) {
+ let mainActionCalled = false;
+ let mainAction = {
+ callback: () => {
+ mainActionCalled = true;
+ },
+ };
+ // The downloading notification is always displayed in a dismissed state.
+ AppMenuNotifications.showNotification(
+ "update-downloading",
+ mainAction,
+ undefined,
+ { dismissed: true }
+ );
+ is(PanelUI.notificationPanel.state, "closed", "doorhanger is closed.");
+
+ is(
+ PanelUI.menuButton.getAttribute("badge-status"),
+ "update-downloading",
+ "Downloading badge is displaying on PanelUI button."
+ );
+
+ await gCUITestUtils.openMainMenu();
+ isnot(
+ PanelUI.menuButton.getAttribute("badge-status"),
+ "update-downloading",
+ "Downloading badge is hidden on PanelUI button."
+ );
+ let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
+ is(
+ menuItem.label,
+ menuItem.getAttribute("label-update-downloading"),
+ "Showing correct label (downloading)"
+ );
+ is(menuItem.hidden, false, "update-downloading menu item is showing.");
+
+ await gCUITestUtils.hideMainMenu();
+ is(
+ PanelUI.menuButton.getAttribute("badge-status"),
+ "update-downloading",
+ "Downloading badge is shown on PanelUI button."
+ );
+
+ await gCUITestUtils.openMainMenu();
+ menuItem.click();
+ ok(mainActionCalled, "Main action callback was called");
+
+ AppMenuNotifications.removeNotification(/.*/);
+ });
+});
+
/**
* We want to ensure a few things with this:
* - Adding a doorhanger will make a badge disappear
diff --git a/browser/locales/en-US/browser/appmenu.ftl b/browser/locales/en-US/browser/appmenu.ftl
index 12fd2bec3e6a..3026b2597287 100644
--- a/browser/locales/en-US/browser/appmenu.ftl
+++ b/browser/locales/en-US/browser/appmenu.ftl
@@ -4,6 +4,8 @@
## App Menu
+appmenuitem-update-banner =
+ .label-update-downloading = Downloading { -brand-shorter-name } update
appmenuitem-protection-dashboard-title = Protections Dashboard
appmenuitem-customize-mode =
.label = Customize…
diff --git a/browser/themes/shared/customizableui/panelUI.inc.css b/browser/themes/shared/customizableui/panelUI.inc.css
index 8a24f03c0ad6..c991daee0759 100644
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -67,6 +67,7 @@
}
#PanelUI-menu-button[badge-status="update-available"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
+#PanelUI-menu-button[badge-status="update-downloading"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
#PanelUI-menu-button[badge-status="update-manual"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
#PanelUI-menu-button[badge-status="update-restart"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
#PanelUI-menu-button[badge-status="update-unsupported"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
@@ -80,6 +81,7 @@
}
#PanelUI-menu-button[badge-status="update-available"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
+#PanelUI-menu-button[badge-status="update-downloading"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
#PanelUI-menu-button[badge-status="update-manual"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
#PanelUI-menu-button[badge-status="update-restart"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
background: #74BF43 url(chrome://browser/skin/update-badge.svg) no-repeat center;
@@ -90,6 +92,7 @@
}
.panel-banner-item[notificationid="update-available"]::after,
+.panel-banner-item[notificationid="update-downloading"]::after,
.panel-banner-item[notificationid="update-manual"]::after,
.panel-banner-item[notificationid="update-restart"]::after {
background: #74BF43 url(chrome://browser/skin/update-badge.svg) no-repeat center;
diff --git a/browser/themes/shared/notification-icons.inc.css b/browser/themes/shared/notification-icons.inc.css
index 74d861200f45..f17ddae9dc79 100644
--- a/browser/themes/shared/notification-icons.inc.css
+++ b/browser/themes/shared/notification-icons.inc.css
@@ -401,6 +401,7 @@ html|*#webRTC-previewVideo {
/* UPDATE */
.popup-notification-icon[popupid="update-available"],
+.popup-notification-icon[popupid="update-downloading"],
.popup-notification-icon[popupid="update-manual"],
.popup-notification-icon[popupid="update-restart"] {
background: #74BF43 url(chrome://browser/skin/notification-icons/update.svg) no-repeat center;
diff --git a/browser/themes/shared/toolbarbutton-icons.inc.css b/browser/themes/shared/toolbarbutton-icons.inc.css
index 998537e1f57d..9514eb1d5338 100644
--- a/browser/themes/shared/toolbarbutton-icons.inc.css
+++ b/browser/themes/shared/toolbarbutton-icons.inc.css
@@ -290,6 +290,7 @@ toolbar[brighttext] {
}
#PanelUI-menu-button[badge-status="update-available"],
+#PanelUI-menu-button[badge-status="update-downloading"],
#PanelUI-menu-button[badge-status="update-manual"],
#PanelUI-menu-button[badge-status="update-restart"] {
list-style-image: url("chrome://browser/skin/menu-badged.svg");
diff --git a/toolkit/mozapps/update/UpdateListener.jsm b/toolkit/mozapps/update/UpdateListener.jsm
index 17919e914b11..110640628771 100644
--- a/toolkit/mozapps/update/UpdateListener.jsm
+++ b/toolkit/mozapps/update/UpdateListener.jsm
@@ -113,16 +113,18 @@ var UpdateListener = {
mainAction,
beforeShowDoorhanger
) {
+ const addTelemetry = id => {
+ // No telemetry for the "downloading" state.
+ if (type !== "downloading") {
+ Services.telemetry.getHistogramById(id).add(type);
+ }
+ };
let action = {
callback(win, fromDoorhanger) {
if (fromDoorhanger) {
- Services.telemetry
- .getHistogramById("UPDATE_NOTIFICATION_MAIN_ACTION_DOORHANGER")
- .add(type);
+ addTelemetry("UPDATE_NOTIFICATION_MAIN_ACTION_DOORHANGER");
} else {
- Services.telemetry
- .getHistogramById("UPDATE_NOTIFICATION_MAIN_ACTION_MENU")
- .add(type);
+ addTelemetry("UPDATE_NOTIFICATION_MAIN_ACTION_MENU");
}
mainAction(win);
},
@@ -131,13 +133,10 @@ var UpdateListener = {
let secondaryAction = {
callback() {
- Services.telemetry
- .getHistogramById("UPDATE_NOTIFICATION_DISMISSED")
- .add(type);
+ addTelemetry("UPDATE_NOTIFICATION_DISMISSED");
},
dismiss: true,
};
-
AppMenuNotifications.showNotification(
"update-" + type,
action,
@@ -145,13 +144,9 @@ var UpdateListener = {
{ dismissed, beforeShowDoorhanger }
);
if (dismissed) {
- Services.telemetry
- .getHistogramById("UPDATE_NOTIFICATION_BADGE_SHOWN")
- .add(type);
+ addTelemetry("UPDATE_NOTIFICATION_BADGE_SHOWN");
} else {
- Services.telemetry
- .getHistogramById("UPDATE_NOTIFICATION_SHOWN")
- .add(type);
+ addTelemetry("UPDATE_NOTIFICATION_SHOWN");
}
},
@@ -205,6 +200,15 @@ var UpdateListener = {
}
},
+ showUpdateDownloadingNotification() {
+ this.showUpdateNotification("downloading", true, true, () => {
+ // The user clicked on the "Downloading update" app menu item.
+ // Code in browser/components/customizableui/content/panelUI.js
+ // receives the following notification and opens the about dialog.
+ Services.obs.notifyObservers(null, "show-update-progress");
+ });
+ },
+
handleUpdateError(update, status) {
switch (status) {
case "download-attempt-failed":
@@ -287,6 +291,17 @@ var UpdateListener = {
}
},
+ handleUpdateDownloading(status) {
+ switch (status) {
+ case "downloading":
+ this.showUpdateDownloadingNotification();
+ break;
+ case "idle":
+ this.reset();
+ break;
+ }
+ },
+
observe(subject, topic, status) {
let update = subject && subject.QueryInterface(Ci.nsIUpdate);
@@ -299,6 +314,9 @@ var UpdateListener = {
}
this.handleUpdateAvailable(update, status);
break;
+ case "update-downloading":
+ this.handleUpdateDownloading(status);
+ break;
case "update-staged":
case "update-downloaded":
// An update check has found an update and downloaded / staged the
diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/UpdateService.jsm
index 0cc26f683078..8dd397f628f5 100644
--- a/toolkit/mozapps/update/UpdateService.jsm
+++ b/toolkit/mozapps/update/UpdateService.jsm
@@ -59,6 +59,7 @@ const PREF_APP_UPDATE_ELEVATE_ATTEMPTS = "app.update.elevate.attempts";
const PREF_APP_UPDATE_ELEVATE_MAXATTEMPTS = "app.update.elevate.maxAttempts";
const PREF_APP_UPDATE_LOG = "app.update.log";
const PREF_APP_UPDATE_LOG_FILE = "app.update.log.file";
+const PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD = "app.update.notifyDuringDownload";
const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime";
const PREF_APP_UPDATE_SERVICE_ENABLED = "app.update.service.enabled";
const PREF_APP_UPDATE_SERVICE_ERRORS = "app.update.service.errors";
@@ -4446,6 +4447,24 @@ Downloader.prototype = {
return selectedPatch;
},
+ /**
+ * Whether or not the user wants to be notified that an update is being
+ * downloaded.
+ */
+ get _notifyDuringDownload() {
+ return Services.prefs.getBoolPref(
+ PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD,
+ false
+ );
+ },
+
+ _notifyDownloadStatusObservers: function Downloader_notifyDownloadStatusObservers() {
+ if (this._notifyDuringDownload) {
+ let status = this.updateService.isDownloading ? "downloading" : "idle";
+ Services.obs.notifyObservers(this._update, "update-downloading", status);
+ }
+ },
+
/**
* Whether or not we are currently downloading something.
*/
@@ -4687,6 +4706,9 @@ Downloader.prototype = {
.getService(Ci.nsIUpdateManager)
.saveUpdates();
}
+
+ this._notifyDownloadStatusObservers();
+
return STATE_DOWNLOADING;
},
@@ -5193,6 +5215,11 @@ Downloader.prototype = {
this._request = null;
+ // This notification must happen after _request is set to null so that
+ // the correct this.updateService.isDownloading value is available in
+ // _notifyDownloadStatusObservers().
+ this._notifyDownloadStatusObservers();
+
if (state == STATE_DOWNLOAD_FAILED) {
var allFailed = true;
// If we haven't already, attempt to download without BITS
diff --git a/toolkit/mozapps/update/tests/browser/browser.bits.ini b/toolkit/mozapps/update/tests/browser/browser.bits.ini
index 9355e22550f2..5a44d1e0f6bf 100644
--- a/toolkit/mozapps/update/tests/browser/browser.bits.ini
+++ b/toolkit/mozapps/update/tests/browser/browser.bits.ini
@@ -21,6 +21,7 @@ prefs =
# About Dialog Application Update Tests
[browser_aboutDialog_bc_downloading.js]
[browser_aboutDialog_bc_downloading_staging.js]
+[browser_aboutDialog_bc_downloading_notify.js]
[browser_aboutDialog_bc_downloaded.js]
[browser_aboutDialog_bc_downloaded_staging.js]
[browser_aboutDialog_bc_downloaded_staged.js]
diff --git a/toolkit/mozapps/update/tests/browser/browser.ini b/toolkit/mozapps/update/tests/browser/browser.ini
index 5ce14c9c2633..c4f3fd055bbf 100644
--- a/toolkit/mozapps/update/tests/browser/browser.ini
+++ b/toolkit/mozapps/update/tests/browser/browser.ini
@@ -15,6 +15,7 @@ prefs =
# About Dialog Application Update Tests
[browser_aboutDialog_bc_downloading.js]
[browser_aboutDialog_bc_downloading_staging.js]
+[browser_aboutDialog_bc_downloading_notify.js]
[browser_aboutDialog_bc_downloaded.js]
[browser_aboutDialog_bc_downloaded_staging.js]
[browser_aboutDialog_bc_downloaded_stagingFailure.js]
diff --git a/toolkit/mozapps/update/tests/browser/browser.legacy.bits.ini b/toolkit/mozapps/update/tests/browser/browser.legacy.bits.ini
index 7bf1f706a5b7..555eaea82cd6 100644
--- a/toolkit/mozapps/update/tests/browser/browser.legacy.bits.ini
+++ b/toolkit/mozapps/update/tests/browser/browser.legacy.bits.ini
@@ -20,6 +20,7 @@ prefs =
# About Dialog Application Update Tests
[browser_aboutDialog_bc_downloading.js]
[browser_aboutDialog_bc_downloading_staging.js]
+[browser_aboutDialog_bc_downloading_notify.js]
[browser_aboutDialog_bc_downloaded.js]
[browser_aboutDialog_bc_downloaded_staging.js]
[browser_aboutDialog_bc_downloaded_staged.js]
diff --git a/toolkit/mozapps/update/tests/browser/browser.legacy.ini b/toolkit/mozapps/update/tests/browser/browser.legacy.ini
index 0cf61d64f42e..e3f681f53236 100644
--- a/toolkit/mozapps/update/tests/browser/browser.legacy.ini
+++ b/toolkit/mozapps/update/tests/browser/browser.legacy.ini
@@ -14,6 +14,7 @@ prefs =
# About Dialog Application Update Tests
[browser_aboutDialog_bc_downloading.js]
[browser_aboutDialog_bc_downloading_staging.js]
+[browser_aboutDialog_bc_downloading_notify.js]
[browser_aboutDialog_bc_downloaded.js]
[browser_aboutDialog_bc_downloaded_staging.js]
[browser_aboutDialog_bc_downloaded_stagingFailure.js]
diff --git a/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloading.js b/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloading.js
index 776d637512ad..67ddd65205da 100644
--- a/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloading.js
+++ b/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloading.js
@@ -6,6 +6,10 @@
// Test for About Dialog background check for updates
// with the About Dialog opened during downloading.
add_task(async function aboutDialog_backgroundCheck_downloading() {
+ await SpecialPowers.pushPrefEnv({
+ set: [[PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD, false]],
+ });
+
let downloadInfo = [];
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_BITS_ENABLED)) {
downloadInfo[0] = { patchType: "partial", bitsResult: "0" };
@@ -21,6 +25,17 @@ add_task(async function aboutDialog_backgroundCheck_downloading() {
waitForUpdateState: STATE_DOWNLOADING,
};
await runAboutDialogUpdateTest(params, [
+ async function aboutDialog_downloading() {
+ is(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "The window's doorhanger is closed."
+ );
+ ok(
+ !PanelUI.menuButton.hasAttribute("badge-status"),
+ "The window does not have a badge."
+ );
+ },
{
panelId: "downloading",
checkActiveUpdate: { state: STATE_DOWNLOADING },
@@ -33,4 +48,6 @@ add_task(async function aboutDialog_backgroundCheck_downloading() {
continueFile: null,
},
]);
+
+ await SpecialPowers.popPrefEnv();
});
diff --git a/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloading_notify.js b/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloading_notify.js
new file mode 100644
index 000000000000..cf427b149a54
--- /dev/null
+++ b/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloading_notify.js
@@ -0,0 +1,58 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test for About Dialog background check for updates with the
+// "notify during download" feature turned on.
+add_task(async function aboutDialog_backgroundCheck_downloading_notify() {
+ await SpecialPowers.pushPrefEnv({
+ set: [[PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD, true]],
+ });
+
+ let downloadInfo = [];
+ if (Services.prefs.getBoolPref(PREF_APP_UPDATE_BITS_ENABLED)) {
+ downloadInfo[0] = { patchType: "partial", bitsResult: "0" };
+ } else {
+ downloadInfo[0] = { patchType: "partial", internalResult: "0" };
+ }
+
+ // Since the partial should be successful specify an invalid size for the
+ // complete update.
+ let params = {
+ queryString: "&useSlowDownloadMar=1&invalidCompleteSize=1",
+ backgroundUpdate: true,
+ waitForUpdateState: STATE_DOWNLOADING,
+ };
+ await runAboutDialogUpdateTest(params, [
+ async function aboutDialog_downloading_notification() {
+ is(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "The window's doorhanger is closed."
+ );
+ ok(
+ PanelUI.menuButton.hasAttribute("badge-status"),
+ "The window has a badge."
+ );
+ is(
+ PanelUI.menuButton.getAttribute("badge-status"),
+ "update-downloading",
+ "The downloading badge is showing for the background window"
+ );
+ },
+ {
+ panelId: "downloading",
+ checkActiveUpdate: { state: STATE_DOWNLOADING },
+ continueFile: CONTINUE_DOWNLOAD,
+ downloadInfo,
+ },
+ {
+ panelId: "apply",
+ checkActiveUpdate: { state: STATE_PENDING },
+ continueFile: null,
+ },
+ ]);
+
+ await SpecialPowers.popPrefEnv();
+});
diff --git a/toolkit/mozapps/update/tests/data/shared.js b/toolkit/mozapps/update/tests/data/shared.js
index 51d9de99d7f2..5106aa5fc7a2 100644
--- a/toolkit/mozapps/update/tests/data/shared.js
+++ b/toolkit/mozapps/update/tests/data/shared.js
@@ -40,6 +40,7 @@ const PREF_APP_UPDATE_INTERVAL = "app.update.interval";
const PREF_APP_UPDATE_LASTUPDATETIME =
"app.update.lastUpdateTime.background-update-timer";
const PREF_APP_UPDATE_LOG = "app.update.log";
+const PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD = "app.update.notifyDuringDownload";
const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime";
const PREF_APP_UPDATE_RETRYTIMEOUT = "app.update.socket.retryTimeout";
const PREF_APP_UPDATE_SERVICE_ENABLED = "app.update.service.enabled";
1
0

[tor-browser/tor-browser-78.11.0esr-10.5-1] Bug 1642754 - Update prompts should not depend on how update was initiated r=bytesized
by sysrqb@torproject.org 02 Jun '21
by sysrqb@torproject.org 02 Jun '21
02 Jun '21
commit 5c8798442de78d7b65535f31973c66670bb6bc95
Author: Mark Smith <mcs(a)pearlcrescent.com>
Date: Wed Jun 17 19:24:09 2020 +0000
Bug 1642754 - Update prompts should not depend on how update was initiated r=bytesized
Show update badge and doorhanger when entering the "pending"
state for foreground updates.
Differential Revision: https://phabricator.services.mozilla.com/D79903
---
toolkit/mozapps/update/UpdateService.jsm | 10 ++--------
.../browser/browser_aboutDialog_fc_downloadAuto.js | 18 +++++++++++++++++-
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/UpdateService.jsm
index 8dd397f628f5..1dc86a073646 100644
--- a/toolkit/mozapps/update/UpdateService.jsm
+++ b/toolkit/mozapps/update/UpdateService.jsm
@@ -5002,8 +5002,6 @@ Downloader.prototype = {
}
}
- // XXX ehsan shouldShowPrompt should always be false here.
- // But what happens when there is already a UI showing?
var state = this._patch.state;
var shouldShowPrompt = false;
var shouldRegisterOnlineObserver = false;
@@ -5044,9 +5042,7 @@ Downloader.prototype = {
} else {
state = STATE_PENDING;
}
- if (this.background) {
- shouldShowPrompt = !getCanStageUpdates();
- }
+ shouldShowPrompt = !getCanStageUpdates();
AUSTLMY.pingDownloadCode(this.isCompleteUpdate, AUSTLMY.DWNLD_SUCCESS);
// Tell the updater.exe we're ready to apply.
@@ -5329,9 +5325,7 @@ Downloader.prototype = {
LOG(
"Downloader:onStopRequest - failed to stage update. Exception: " + e
);
- if (this.background) {
- shouldShowPrompt = true;
- }
+ shouldShowPrompt = true;
}
}
}
diff --git a/toolkit/mozapps/update/tests/browser/browser_aboutDialog_fc_downloadAuto.js b/toolkit/mozapps/update/tests/browser/browser_aboutDialog_fc_downloadAuto.js
index 6a8835251dec..be65ce8ddef1 100644
--- a/toolkit/mozapps/update/tests/browser/browser_aboutDialog_fc_downloadAuto.js
+++ b/toolkit/mozapps/update/tests/browser/browser_aboutDialog_fc_downloadAuto.js
@@ -15,7 +15,7 @@ add_task(async function aboutDialog_foregroundCheck_downloadAuto() {
// Since the partial should be successful specify an invalid size for the
// complete update.
- let params = { queryString: "&invalidCompleteSize=1" };
+ let params = { queryString: "&invalidCompleteSize=1&promptWaitTime=0" };
await runAboutDialogUpdateTest(params, [
{
panelId: "checkingForUpdates",
@@ -28,6 +28,22 @@ add_task(async function aboutDialog_foregroundCheck_downloadAuto() {
continueFile: CONTINUE_DOWNLOAD,
downloadInfo,
},
+ async function aboutDialog_restart_notification() {
+ is(
+ PanelUI.notificationPanel.state,
+ "closed",
+ "The window's doorhanger is closed."
+ );
+ ok(
+ PanelUI.menuButton.hasAttribute("badge-status"),
+ "The window has a badge."
+ );
+ is(
+ PanelUI.menuButton.getAttribute("badge-status"),
+ "update-restart",
+ "The restart badge is showing for the background window"
+ );
+ },
{
panelId: "apply",
checkActiveUpdate: { state: STATE_PENDING },
1
0