Commits:
-
13864ce2
by hackademix at 2024-03-12T11:39:34+01:00
fixup! Bug 21952: Implement Onion-Location
Bug 42440: Remove the "Prioritize .onion sites when known" option
-
cc1d2cd0
by hackademix at 2024-03-12T17:14:18+01:00
fixup! Add TorStrings module for localization
Bug 42440: Remove the "Prioritize .onion sites when known" option
12 changed files:
Changes:
browser/components/onionservices/OnionLocationParent.sys.mjs
... |
... |
@@ -3,8 +3,10 @@ |
3
|
3
|
import { TorStrings } from "resource://gre/modules/TorStrings.sys.mjs";
|
4
|
4
|
|
5
|
5
|
// Prefs
|
|
6
|
+
|
|
7
|
+// We keep the "prioritizeonions" name, even if obsolete, in order to
|
|
8
|
+// prevent the notification from being shown again to upgrading users.
|
6
|
9
|
const NOTIFICATION_PREF = "privacy.prioritizeonions.showNotification";
|
7
|
|
-const PRIORITIZE_ONIONS_PREF = "privacy.prioritizeonions.enabled";
|
8
|
10
|
|
9
|
11
|
// Element IDs
|
10
|
12
|
const ONIONLOCATION_BOX_ID = "onion-location-box";
|
... |
... |
@@ -18,9 +20,8 @@ const NOTIFICATION_ANCHOR_ID = "onion-location-box"; |
18
|
20
|
const STRING_ONION_AVAILABLE = TorStrings.onionLocation.onionAvailable;
|
19
|
21
|
const NOTIFICATION_CANCEL_LABEL = TorStrings.onionLocation.notNow;
|
20
|
22
|
const NOTIFICATION_CANCEL_ACCESSKEY = TorStrings.onionLocation.notNowAccessKey;
|
21
|
|
-const NOTIFICATION_OK_LABEL = TorStrings.onionLocation.alwaysPrioritize;
|
22
|
|
-const NOTIFICATION_OK_ACCESSKEY =
|
23
|
|
- TorStrings.onionLocation.alwaysPrioritizeAccessKey;
|
|
23
|
+const NOTIFICATION_OK_LABEL = TorStrings.onionLocation.loadOnion;
|
|
24
|
+const NOTIFICATION_OK_ACCESSKEY = TorStrings.onionLocation.loadOnionAccessKey;
|
24
|
25
|
const NOTIFICATION_TITLE = TorStrings.onionLocation.tryThis;
|
25
|
26
|
const NOTIFICATION_DESCRIPTION = TorStrings.onionLocation.description;
|
26
|
27
|
const NOTIFICATION_LEARN_MORE_URL =
|
... |
... |
@@ -90,9 +91,7 @@ export class OnionLocationParent extends JSWindowActorParent { |
90
|
91
|
label: NOTIFICATION_OK_LABEL,
|
91
|
92
|
accessKey: NOTIFICATION_OK_ACCESSKEY,
|
92
|
93
|
callback() {
|
93
|
|
- Services.prefs.setBoolPref(PRIORITIZE_ONIONS_PREF, true);
|
94
|
94
|
OnionLocationParent.redirect(browser);
|
95
|
|
- win.openPreferences("privacy-onionservices");
|
96
|
95
|
},
|
97
|
96
|
};
|
98
|
97
|
|
browser/components/onionservices/content/onionlocationPreferences.inc.xhtml
deleted
1
|
|
-# Copyright (c) 2020, The Tor Project, Inc.
|
2
|
|
-
|
3
|
|
-<groupbox id="onionServicesGroup" data-category="panePrivacy" data-subcategory="onionservices" hidden="true">
|
4
|
|
- <label><html:h2 id="onionServicesTitle"></html:h2></label>
|
5
|
|
- <label><label class="tail-with-learn-more" id="prioritizeOnionsDesc"></label><label
|
6
|
|
- class="learnMore" is="text-link" id="onionServicesLearnMore"></label></label>
|
7
|
|
- <radiogroup id="prioritizeOnionsRadioGroup" aria-labelledby="prioritizeOnionsDesc" preference="privacy.prioritizeonions.enabled">
|
8
|
|
- <radio id="onionServicesRadioAlways" value="true"/>
|
9
|
|
- <radio id="onionServicesRadioAsk" value="false"/>
|
10
|
|
- </radiogroup>
|
11
|
|
-</groupbox> |
browser/components/onionservices/content/onionlocationPreferences.js
deleted
1
|
|
-// Copyright (c) 2020, The Tor Project, Inc.
|
2
|
|
-
|
3
|
|
-"use strict";
|
4
|
|
-
|
5
|
|
-ChromeUtils.defineESModuleGetters(this, {
|
6
|
|
- TorStrings: "resource://gre/modules/TorStrings.sys.mjs",
|
7
|
|
-});
|
8
|
|
-
|
9
|
|
-const OnionLocationPreferences = {
|
10
|
|
- init() {
|
11
|
|
- document.getElementById("onionServicesTitle").textContent =
|
12
|
|
- TorStrings.onionLocation.onionServicesTitle;
|
13
|
|
- document.getElementById("prioritizeOnionsDesc").textContent =
|
14
|
|
- TorStrings.onionLocation.prioritizeOnionsDescription;
|
15
|
|
- const learnMore = document.getElementById("onionServicesLearnMore");
|
16
|
|
- learnMore.textContent = TorStrings.onionLocation.learnMore;
|
17
|
|
- learnMore.href = TorStrings.onionLocation.learnMoreURL;
|
18
|
|
- if (TorStrings.onionLocation.learnMoreURL.startsWith("about:")) {
|
19
|
|
- learnMore.setAttribute("useoriginprincipal", "true");
|
20
|
|
- }
|
21
|
|
- document.getElementById("onionServicesRadioAlways").label =
|
22
|
|
- TorStrings.onionLocation.always;
|
23
|
|
- document.getElementById("onionServicesRadioAsk").label =
|
24
|
|
- TorStrings.onionLocation.askEverytime;
|
25
|
|
- },
|
26
|
|
-};
|
27
|
|
-
|
28
|
|
-Object.defineProperty(this, "OnionLocationPreferences", {
|
29
|
|
- value: OnionLocationPreferences,
|
30
|
|
- enumerable: true,
|
31
|
|
- writable: false,
|
32
|
|
-}); |
browser/components/onionservices/jar.mn
... |
... |
@@ -6,5 +6,4 @@ browser.jar: |
6
|
6
|
content/browser/onionservices/onionservices.css (content/onionservices.css)
|
7
|
7
|
content/browser/onionservices/savedKeysDialog.js (content/savedKeysDialog.js)
|
8
|
8
|
content/browser/onionservices/savedKeysDialog.xhtml (content/savedKeysDialog.xhtml)
|
9
|
|
- content/browser/onionservices/onionlocationPreferences.js (content/onionlocationPreferences.js)
|
10
|
9
|
skin/classic/browser/onionlocation.css (content/onionlocation.css) |
browser/components/preferences/privacy.inc.xhtml
... |
... |
@@ -14,8 +14,6 @@ |
14
|
14
|
<html:h1 data-l10n-id="privacy-header"/>
|
15
|
15
|
</hbox>
|
16
|
16
|
|
17
|
|
-#include ../onionservices/content/onionlocationPreferences.inc.xhtml
|
18
|
|
-
|
19
|
17
|
<!-- Tracking / Content Blocking -->
|
20
|
18
|
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true" aria-describedby="contentBlockingDescription" class="highlighting-group">
|
21
|
19
|
<label id="contentBlockingHeader"><html:h2 data-l10n-id="content-blocking-enhanced-tracking-protection"/></label>
|
browser/components/preferences/privacy.js
... |
... |
@@ -75,12 +75,6 @@ XPCOMUtils.defineLazyScriptGetter( |
75
|
75
|
"chrome://browser/content/securitylevel/securityLevel.js"
|
76
|
76
|
);
|
77
|
77
|
|
78
|
|
-XPCOMUtils.defineLazyScriptGetter(
|
79
|
|
- this,
|
80
|
|
- ["OnionLocationPreferences"],
|
81
|
|
- "chrome://browser/content/onionservices/onionlocationPreferences.js"
|
82
|
|
-);
|
83
|
|
-
|
84
|
78
|
XPCOMUtils.defineLazyPreferenceGetter(
|
85
|
79
|
this,
|
86
|
80
|
"OS_AUTH_ENABLED",
|
... |
... |
@@ -167,9 +161,6 @@ Preferences.addAll([ |
167
|
161
|
// Do not track
|
168
|
162
|
{ id: "privacy.donottrackheader.enabled", type: "bool" },
|
169
|
163
|
|
170
|
|
- // Onion Location
|
171
|
|
- { id: "privacy.prioritizeonions.enabled", type: "bool" },
|
172
|
|
-
|
173
|
164
|
// Media
|
174
|
165
|
{ id: "media.autoplay.default", type: "int" },
|
175
|
166
|
|
... |
... |
@@ -349,13 +340,6 @@ var gPrivacyPane = { |
349
|
340
|
});
|
350
|
341
|
},
|
351
|
342
|
|
352
|
|
- /**
|
353
|
|
- * Show the OnionLocation preferences UI
|
354
|
|
- */
|
355
|
|
- _initOnionLocation() {
|
356
|
|
- OnionLocationPreferences.init();
|
357
|
|
- },
|
358
|
|
-
|
359
|
343
|
/**
|
360
|
344
|
* Whether the prompt to restart Firefox should appear when changing the autostart pref.
|
361
|
345
|
*/
|
... |
... |
@@ -899,7 +883,6 @@ var gPrivacyPane = { |
899
|
883
|
this._initTrackingProtectionExtensionControl();
|
900
|
884
|
OnionServicesAuthPreferences.init();
|
901
|
885
|
this._initSecurityLevel();
|
902
|
|
- this._initOnionLocation();
|
903
|
886
|
|
904
|
887
|
Services.telemetry.setEventRecordingEnabled("pwmgr", true);
|
905
|
888
|
|
dom/base/Document.cpp
... |
... |
@@ -6976,14 +6976,7 @@ void Document::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData) { |
6976
|
6976
|
nsCOMPtr<nsIURI> onionURI;
|
6977
|
6977
|
if (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(onionURI), aData)) &&
|
6978
|
6978
|
IsValidOnionLocation(Document::GetDocumentURI(), onionURI)) {
|
6979
|
|
- if (StaticPrefs::privacy_prioritizeonions_enabled()) {
|
6980
|
|
- nsCOMPtr<nsIRefreshURI> refresher(mDocumentContainer);
|
6981
|
|
- if (refresher) {
|
6982
|
|
- refresher->RefreshURI(onionURI, NodePrincipal(), 0);
|
6983
|
|
- }
|
6984
|
|
- } else {
|
6985
|
|
- mOnionLocationURI = onionURI;
|
6986
|
|
- }
|
|
6979
|
+ mOnionLocationURI = onionURI;
|
6987
|
6980
|
}
|
6988
|
6981
|
}
|
6989
|
6982
|
}
|
mobile/android/geckoview/api.txt
... |
... |
@@ -801,7 +801,6 @@ package org.mozilla.geckoview { |
801
|
801
|
method public boolean getLoginAutofillEnabled();
|
802
|
802
|
method public boolean getPauseForDebuggerEnabled();
|
803
|
803
|
method public int getPreferredColorScheme();
|
804
|
|
- method public boolean getPrioritizeOnions();
|
805
|
804
|
method public boolean getRemoteDebuggingEnabled();
|
806
|
805
|
method @Nullable public GeckoRuntime getRuntime();
|
807
|
806
|
method @Nullable public Rect getScreenSizeOverride();
|
... |
... |
@@ -827,7 +826,6 @@ package org.mozilla.geckoview { |
827
|
826
|
method public void setLocales(@Nullable String[]);
|
828
|
827
|
method @NonNull public GeckoRuntimeSettings setLoginAutofillEnabled(boolean);
|
829
|
828
|
method @NonNull public GeckoRuntimeSettings setPreferredColorScheme(int);
|
830
|
|
- method @NonNull public GeckoRuntimeSettings setPrioritizeOnions(boolean);
|
831
|
829
|
method @NonNull public GeckoRuntimeSettings setRemoteDebuggingEnabled(boolean);
|
832
|
830
|
method @NonNull public GeckoRuntimeSettings setSpoofEnglish(boolean);
|
833
|
831
|
method @NonNull public GeckoRuntimeSettings setTorSecurityLevel(int);
|
... |
... |
@@ -867,7 +865,6 @@ package org.mozilla.geckoview { |
867
|
865
|
method @NonNull public GeckoRuntimeSettings.Builder locales(@Nullable String[]);
|
868
|
866
|
method @NonNull public GeckoRuntimeSettings.Builder loginAutofillEnabled(boolean);
|
869
|
867
|
method @NonNull public GeckoRuntimeSettings.Builder pauseForDebugger(boolean);
|
870
|
|
- method @NonNull public GeckoRuntimeSettings.Builder prioritizeOnions(boolean);
|
871
|
868
|
method @NonNull public GeckoRuntimeSettings.Builder preferredColorScheme(int);
|
872
|
869
|
method @NonNull public GeckoRuntimeSettings.Builder remoteDebuggingEnabled(boolean);
|
873
|
870
|
method @NonNull public GeckoRuntimeSettings.Builder screenSizeOverride(int, int);
|
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
... |
... |
@@ -477,17 +477,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { |
477
|
477
|
return this;
|
478
|
478
|
}
|
479
|
479
|
|
480
|
|
- /**
|
481
|
|
- * Sets whether the browser should prioritize .onion sites when available.
|
482
|
|
- *
|
483
|
|
- * @param flag True if we should prioritize .onion sites, false otherwise
|
484
|
|
- * @return This Builder instance.
|
485
|
|
- */
|
486
|
|
- public @NonNull Builder prioritizeOnions(final boolean flag) {
|
487
|
|
- getSettings().mPrioritizeOnions.set(flag);
|
488
|
|
- return this;
|
489
|
|
- }
|
490
|
|
-
|
491
|
480
|
public @NonNull Builder useNewBootstrap(final boolean flag) {
|
492
|
481
|
getSettings().mUseNewBootstrap.set(flag);
|
493
|
482
|
return this;
|
... |
... |
@@ -543,8 +532,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { |
543
|
532
|
/* package */ final Pref<Integer> mSpoofEnglish = new Pref<>("privacy.spoof_english", 0);
|
544
|
533
|
/* package */ final Pref<Integer> mSecurityLevel =
|
545
|
534
|
new Pref<>("browser.security_level.security_slider", 4);
|
546
|
|
- /* package */ final Pref<Boolean> mPrioritizeOnions =
|
547
|
|
- new Pref<>("privacy.prioritizeonions.enabled", false);
|
548
|
535
|
/* package */ final Pref<Boolean> mUseNewBootstrap =
|
549
|
536
|
new Pref<>("browser.tor_android.use_new_bootstrap", false);
|
550
|
537
|
|
... |
... |
@@ -1339,26 +1326,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { |
1339
|
1326
|
return this;
|
1340
|
1327
|
}
|
1341
|
1328
|
|
1342
|
|
- /**
|
1343
|
|
- * Gets whether we should prioritize .onion sites.
|
1344
|
|
- *
|
1345
|
|
- * @return Whether we should prioritize .onion sites.
|
1346
|
|
- */
|
1347
|
|
- public boolean getPrioritizeOnions() {
|
1348
|
|
- return mPrioritizeOnions.get();
|
1349
|
|
- }
|
1350
|
|
-
|
1351
|
|
- /**
|
1352
|
|
- * Sets whether we should prioritize .onion sites.
|
1353
|
|
- *
|
1354
|
|
- * @param flag Whether we should prioritize .onion sites.
|
1355
|
|
- * @return This GeckoRuntimeSettings instance.
|
1356
|
|
- */
|
1357
|
|
- public @NonNull GeckoRuntimeSettings setPrioritizeOnions(final boolean flag) {
|
1358
|
|
- mPrioritizeOnions.commit(flag);
|
1359
|
|
- return this;
|
1360
|
|
- }
|
1361
|
|
-
|
1362
|
1329
|
public boolean getUseNewBootstrap() {
|
1363
|
1330
|
return mUseNewBootstrap.get();
|
1364
|
1331
|
}
|
modules/libpref/init/StaticPrefList.yaml
... |
... |
@@ -13578,11 +13578,6 @@ |
13578
|
13578
|
value: ""
|
13579
|
13579
|
mirror: never
|
13580
|
13580
|
|
13581
|
|
-- name: privacy.prioritizeonions.enabled
|
13582
|
|
- type: RelaxedAtomicBool
|
13583
|
|
- value: false
|
13584
|
|
- mirror: always
|
13585
|
|
-
|
13586
|
13581
|
#---------------------------------------------------------------------------
|
13587
|
13582
|
# Prefs starting with "prompts."
|
13588
|
13583
|
#---------------------------------------------------------------------------
|
toolkit/modules/TorStrings.sys.mjs
... |
... |
@@ -439,20 +439,15 @@ const Loader = { |
439
|
439
|
*/
|
440
|
440
|
onionLocation() {
|
441
|
441
|
const strings = {
|
442
|
|
- alwaysPrioritize: "Always Prioritize Onionsites",
|
443
|
|
- alwaysPrioritizeAccessKey: "a",
|
|
442
|
+ learnMore: "Learn more…",
|
|
443
|
+ loadOnion: "Visit the .onion",
|
|
444
|
+ loadOnionAccessKey: "V",
|
444
|
445
|
notNow: "Not Now",
|
445
|
446
|
notNowAccessKey: "n",
|
446
|
447
|
description:
|
447
|
|
- "Website publishers can protect users by adding a security layer. This prevents eavesdroppers from knowing that you are the one visiting that website.",
|
448
|
|
- tryThis: "Try this: Onionsite",
|
449
|
|
- onionAvailable: "Onionsite available",
|
450
|
|
- learnMore: "Learn more",
|
451
|
|
- always: "Always",
|
452
|
|
- askEverytime: "Ask you every time",
|
453
|
|
- prioritizeOnionsDescription:
|
454
|
|
- "Prioritize onionsites when they are available.",
|
455
|
|
- onionServicesTitle: "Onion Services",
|
|
448
|
+ "There's a more private and secure version of this site available over the Tor network via onion services. Onion services help website publishers and their visitors defeat surveillance and censorship.",
|
|
449
|
+ tryThis: "Try Onion Services",
|
|
450
|
+ onionAvailable: ".onion available",
|
456
|
451
|
};
|
457
|
452
|
|
458
|
453
|
const tsb = new TorPropertyStringBundle(
|
toolkit/torbutton/chrome/locale/en-US/onionLocation.properties
... |
... |
@@ -4,10 +4,10 @@ |
4
|
4
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
5
|
5
|
|
6
|
6
|
# Onion-Location strings.
|
7
|
|
-onionLocation.alwaysPrioritize=Always Prioritize Onions
|
8
|
|
-# Localization note: this is the access key for "Always Prioritize Onions".
|
|
7
|
+onionLocation.loadOnion=Visit the .onion
|
|
8
|
+# Localization note: this is the access key for "Visit the .onion".
|
9
|
9
|
# It should be a character that appears in that string.
|
10
|
|
-onionLocation.alwaysPrioritizeAccessKey=a
|
|
10
|
+onionLocation.loadOnionAccessKey=V
|
11
|
11
|
onionLocation.notNow=Not Now
|
12
|
12
|
# Localization note: this is the access key for "Not now".
|
13
|
13
|
# It should be a character that appears in that string.
|
... |
... |
@@ -16,7 +16,3 @@ onionLocation.description=There's a more private and secure version of this site |
16
|
16
|
onionLocation.tryThis=Try Onion Services
|
17
|
17
|
onionLocation.onionAvailable=.onion available
|
18
|
18
|
onionLocation.learnMore=Learn more… |
19
|
|
-onionLocation.always=Always
|
20
|
|
-onionLocation.askEverytime=Ask every time
|
21
|
|
-onionLocation.prioritizeOnionsDescription=Prioritize .onion sites when known.
|
22
|
|
-onionLocation.onionServicesTitle=Onion Services |
|