Richard Pospesel pushed to branch tor-browser-102.5.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
683baff6
by Pier Angelo Vendrame at 2022-12-15T15:01:28+00:00
-
c7a1ca3c
by Pier Angelo Vendrame at 2022-12-15T15:01:28+00:00
5 changed files:
- − toolkit/torbutton/chrome/content/preferences-mobile.js
- − toolkit/torbutton/chrome/content/preferences.xhtml
- toolkit/torbutton/chrome/content/torbutton.js
- toolkit/torbutton/chrome/locale/en-US/torbutton.dtd
- toolkit/torbutton/jar.mn
Changes:
1 | -// # Security Settings User Interface for Mobile
|
|
2 | - |
|
3 | -// Utilities
|
|
4 | -const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
5 | -const {
|
|
6 | - getBoolPref,
|
|
7 | - getIntPref,
|
|
8 | - setBoolPref,
|
|
9 | - setIntPref,
|
|
10 | - getCharPref,
|
|
11 | -} = Services.prefs;
|
|
12 | - |
|
13 | -// Description elements have the follow names.
|
|
14 | -const descNames = ["", "desc_standard", "desc_safer", "desc_safest"];
|
|
15 | -// "Learn-more"-elements have the follow names.
|
|
16 | -const linkNames = ["", "link_standard", "link_safer", "link_safest"];
|
|
17 | -// A single `state` object that reflects the user settings in this UI.
|
|
18 | - |
|
19 | -let state = { slider: 0, custom: false };
|
|
20 | - |
|
21 | -// Utility functions to convert between the legacy 4-value pref index
|
|
22 | -// and the 3-valued security slider.
|
|
23 | -let sliderPositionToPrefSetting = pos => [0, 4, 2, 1][pos];
|
|
24 | -let prefSettingToSliderPosition = pref => [0, 3, 2, 2, 1][pref];
|
|
25 | - |
|
26 | -// Set the desired slider value and update UI.
|
|
27 | -function torbutton_set_slider(sliderValue) {
|
|
28 | - state.slider = sliderValue;
|
|
29 | - let slider = document.getElementById("torbutton_sec_slider");
|
|
30 | - slider.value = sliderValue.toString();
|
|
31 | - let descs = descNames.map(name => document.getElementById(name));
|
|
32 | - descs.forEach((desc, i) => {
|
|
33 | - if (state.slider !== i) {
|
|
34 | - desc.style.display = "none";
|
|
35 | - } else {
|
|
36 | - desc.style.display = "block";
|
|
37 | - }
|
|
38 | - });
|
|
39 | - torbutton_save_security_settings();
|
|
40 | -}
|
|
41 | - |
|
42 | -// Read prefs 'browser.security_level.security_slider' and
|
|
43 | -// 'browser.security_level.security_custom', and initialize the UI.
|
|
44 | -function torbutton_init_security_ui() {
|
|
45 | - torbutton_set_slider(
|
|
46 | - prefSettingToSliderPosition(
|
|
47 | - getIntPref("browser.security_level.security_slider")
|
|
48 | - )
|
|
49 | - );
|
|
50 | -}
|
|
51 | - |
|
52 | -// Write the two prefs from the current settings.
|
|
53 | -function torbutton_save_security_settings() {
|
|
54 | - setIntPref(
|
|
55 | - "browser.security_level.security_slider",
|
|
56 | - sliderPositionToPrefSetting(state.slider)
|
|
57 | - );
|
|
58 | - setBoolPref("browser.security_level.security_custom", state.custom);
|
|
59 | -} |
1 | -<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
|
|
2 | -<html xmlns="http://www.w3.org/1999/xhtml">
|
|
3 | - <meta charset="UTF-8"/>
|
|
4 | - <meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
5 | - <head>
|
|
6 | - <title>&torbutton.prefs.security_settings;</title>
|
|
7 | - <link type="text/css" rel="stylesheet" charset="UTF-8" href="chrome://torbutton/skin/preferences.css"/>
|
|
8 | - <link type="text/css" rel="stylesheet" charset="UTF-8" href="chrome://torbutton/skin/preferences-mobile.css"/>
|
|
9 | - <script type="text/javascript" src="preferences-mobile.js"></script>
|
|
10 | - <style>
|
|
11 | - </style>
|
|
12 | - </head>
|
|
13 | - <body onload="torbutton_init_security_ui()">
|
|
14 | - <div class="wrapper outer-wrapper">
|
|
15 | - <div class="title">
|
|
16 | - &torbutton.prefs.sec_caption;
|
|
17 | - </div>
|
|
18 | - <div class="wrapper inner-wrapper">
|
|
19 | - <input id="torbutton_sec_slider" type="range" min="1" max="3" list="datalist" onchange="torbutton_set_slider(parseInt(this.value, 10))"/>
|
|
20 | - <datalist id="datalist">
|
|
21 | - <option onclick="torbutton_set_slider(1)">
|
|
22 | - &torbutton.prefs.sec_standard_label;
|
|
23 | - </option>
|
|
24 | - <option onclick="torbutton_set_slider(2)">
|
|
25 | - &torbutton.prefs.sec_safer_label;
|
|
26 | - </option>
|
|
27 | - <option onclick="torbutton_set_slider(3)">
|
|
28 | - &torbutton.prefs.sec_safest_label;
|
|
29 | - </option>
|
|
30 | - </datalist>
|
|
31 | - <div class="description-wrapper">
|
|
32 | - <div id="desc_safest" class="description">
|
|
33 | - <p class="slider-text-size slider-text-weight">
|
|
34 | - &torbutton.prefs.sec_safest_description;
|
|
35 | - </p>
|
|
36 | - <p class="slider-text-size slider-text-weight">
|
|
37 | - &torbutton.prefs.sec_safest_list_label;
|
|
38 | - </p>
|
|
39 | - <p class="slider-text-size">
|
|
40 | - &torbutton.prefs.sec_js_disabled;
|
|
41 | - </p>
|
|
42 | - <p class="slider-text-size">
|
|
43 | - &torbutton.prefs.sec_limit_graphics_and_typography;
|
|
44 | - </p>
|
|
45 | - <p class="slider-text-size">
|
|
46 | - &torbutton.prefs.sec_click_to_play_media;
|
|
47 | - </p>
|
|
48 | - <a id="link_safest" class="text-link">
|
|
49 | - &torbutton.prefs.sec_learn_more_label;
|
|
50 | - </a>
|
|
51 | - </div>
|
|
52 | - <div id="desc_safer" class="description">
|
|
53 | - <p class="slider-text-size slider-text-weight">
|
|
54 | - &torbutton.prefs.sec_safer_description;
|
|
55 | - </p>
|
|
56 | - <p class="slider-text-size slider-text-weight">
|
|
57 | - &torbutton.prefs.sec_safer_list_label;
|
|
58 | - </p>
|
|
59 | - <p class="slider-text-size">
|
|
60 | - &torbutton.prefs.sec_js_on_https_sites_only;
|
|
61 | - </p>
|
|
62 | - <p class="slider-text-size">
|
|
63 | - &torbutton.prefs.sec_limit_typography;
|
|
64 | - </p>
|
|
65 | - <p class="slider-text-size">
|
|
66 | - &torbutton.prefs.sec_click_to_play_media;
|
|
67 | - </p>
|
|
68 | - <a id="link_safer" class="text-link">
|
|
69 | - &torbutton.prefs.sec_learn_more_label;
|
|
70 | - </a>
|
|
71 | - </div>
|
|
72 | - <div id="desc_standard" class="description">
|
|
73 | - <p class="slider-text-size slider-text-weight">
|
|
74 | - &torbutton.prefs.sec_standard_description;
|
|
75 | - </p>
|
|
76 | - <a id="link_standard" class="text-link">
|
|
77 | - &torbutton.prefs.sec_learn_more_label;
|
|
78 | - </a>
|
|
79 | - </div>
|
|
80 | - </div>
|
|
81 | - </div>
|
|
82 | - </div>
|
|
83 | - </body>
|
|
84 | -</html> |
... | ... | @@ -20,7 +20,6 @@ var torbutton_new_circuit; |
20 | 20 | |
21 | 21 | let {
|
22 | 22 | unescapeTorString,
|
23 | - bindPrefAndInit,
|
|
24 | 23 | getDomainForBrowser,
|
25 | 24 | torbutton_log,
|
26 | 25 | torbutton_get_property_string,
|
... | ... | @@ -185,10 +184,6 @@ var torbutton_new_circuit; |
185 | 184 | },
|
186 | 185 | };
|
187 | 186 | |
188 | - function torbutton_is_mobile() {
|
|
189 | - return Services.appinfo.OS === "Android";
|
|
190 | - }
|
|
191 | - |
|
192 | 187 | // Bug 1506 P2-P4: This code sets some version variables that are irrelevant.
|
193 | 188 | // It does read out some important environment variables, though. It is
|
194 | 189 | // called once per browser window.. This might belong in a component.
|
... | ... | @@ -269,8 +264,6 @@ var torbutton_new_circuit; |
269 | 264 | torbutton_abouttor_message_handler
|
270 | 265 | );
|
271 | 266 | |
272 | - setupPreferencesForMobile();
|
|
273 | - |
|
274 | 267 | torbutton_log(1, "registering Tor check observer");
|
275 | 268 | torbutton_tor_check_observer.register();
|
276 | 269 | |
... | ... | @@ -323,7 +316,7 @@ var torbutton_new_circuit; |
323 | 316 | // not working.
|
324 | 317 | async getChromeData(aIsRespondingToPageLoad) {
|
325 | 318 | let dataObj = {
|
326 | - mobile: torbutton_is_mobile(),
|
|
319 | + mobile: Services.appinfo.OS === "Android",
|
|
327 | 320 | updateChannel: AppConstants.MOZ_UPDATE_CHANNEL,
|
328 | 321 | torOn: await torbutton_tor_check_ok(),
|
329 | 322 | };
|
... | ... | @@ -788,53 +781,6 @@ var torbutton_new_circuit; |
788 | 781 | return true;
|
789 | 782 | }
|
790 | 783 | |
791 | - function showSecurityPreferencesPanel(chromeWindow) {
|
|
792 | - const tabBrowser = chromeWindow.BrowserApp;
|
|
793 | - let settingsTab = null;
|
|
794 | - |
|
795 | - const SECURITY_PREFERENCES_URI =
|
|
796 | - "chrome://torbutton/content/preferences.xhtml";
|
|
797 | - |
|
798 | - tabBrowser.tabs.some(function(tab) {
|
|
799 | - // If the security prefs tab is opened, send the user to it
|
|
800 | - if (tab.browser.currentURI.spec === SECURITY_PREFERENCES_URI) {
|
|
801 | - settingsTab = tab;
|
|
802 | - return true;
|
|
803 | - }
|
|
804 | - return false;
|
|
805 | - });
|
|
806 | - |
|
807 | - if (settingsTab === null) {
|
|
808 | - // Open up the settings panel in a new tab.
|
|
809 | - tabBrowser.addTab(SECURITY_PREFERENCES_URI, {
|
|
810 | - selected: true,
|
|
811 | - parentId: tabBrowser.selectedTab.id,
|
|
812 | - triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
|
813 | - });
|
|
814 | - } else {
|
|
815 | - // Activate an existing settings panel tab.
|
|
816 | - tabBrowser.selectTab(settingsTab);
|
|
817 | - }
|
|
818 | - }
|
|
819 | - |
|
820 | - function setupPreferencesForMobile() {
|
|
821 | - if (!torbutton_is_mobile()) {
|
|
822 | - return;
|
|
823 | - }
|
|
824 | - |
|
825 | - torbutton_log(4, "Setting up settings preferences for Android.");
|
|
826 | - |
|
827 | - const chromeWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
|
828 | - |
|
829 | - // Add the extension's chrome menu item to the main browser menu.
|
|
830 | - chromeWindow.NativeWindow.menu.add({
|
|
831 | - name: torbutton_get_property_string(
|
|
832 | - "torbutton.security_settings.menu.title"
|
|
833 | - ),
|
|
834 | - callback: showSecurityPreferencesPanel.bind(this, chromeWindow),
|
|
835 | - });
|
|
836 | - }
|
|
837 | - |
|
838 | 784 | // Bug 1506 P3: This is needed pretty much only for the window resizing.
|
839 | 785 | // See comments for individual functions for details
|
840 | 786 | function torbutton_new_window(event) {
|
... | ... | @@ -13,30 +13,3 @@ |
13 | 13 | <!-- Onion services strings. Strings are kept here for ease of translation. -->
|
14 | 14 | <!ENTITY torbutton.onionServices.authPrompt.tooltip "Open onion service client authentication prompt">
|
15 | 15 | <!ENTITY torbutton.onionServices.authPrompt.persistCheckboxLabel "Remember this key"> |
16 | - |
|
17 | -<!ENTITY torbutton.prefs.security_settings "Tor Browser Security Settings">
|
|
18 | -<!ENTITY torbutton.prefs.sec_caption "Security Level">
|
|
19 | -<!ENTITY torbutton.prefs.sec_caption_tooltip "The Security Slider lets you disable certain browser features that may make your browser more vulnerable to hacking attempts.">
|
|
20 | -<!ENTITY torbutton.prefs.sec_standard_label "Standard">
|
|
21 | -<!ENTITY torbutton.prefs.sec_standard_description "All Tor Browser and website features are enabled.">
|
|
22 | -<!ENTITY torbutton.prefs.sec_safer_label "Safer">
|
|
23 | -<!ENTITY torbutton.prefs.sec_safer_description "Disables website features that are often dangerous, causing some sites to lose functionality.">
|
|
24 | -<!ENTITY torbutton.prefs.sec_safer_list_label "At the safer setting:">
|
|
25 | -<!ENTITY torbutton.prefs.sec_safest_label "Safest">
|
|
26 | -<!ENTITY torbutton.prefs.sec_safest_description "Only allows website features required for static sites and basic services. These changes affect images, media, and scripts.">
|
|
27 | -<!ENTITY torbutton.prefs.sec_safest_list_label "At the safest setting:">
|
|
28 | -<!ENTITY torbutton.prefs.sec_learn_more_label "Learn more">
|
|
29 | -<!ENTITY torbutton.prefs.sec_js_on_https_sites_only "JavaScript is disabled on non-HTTPS sites.">
|
|
30 | -<!ENTITY torbutton.prefs.sec_js_disabled "JavaScript is disabled by default on all sites.">
|
|
31 | -<!ENTITY torbutton.prefs.sec_limit_typography "Some fonts and math symbols are disabled.">
|
|
32 | -<!ENTITY torbutton.prefs.sec_limit_graphics_and_typography "Some fonts, icons, math symbols, and images are disabled.">
|
|
33 | -<!ENTITY torbutton.prefs.sec_click_to_play_media "Audio and video (HTML5 media), and WebGL are click-to-play.">
|
|
34 | -<!ENTITY torbutton.prefs.sec_custom_warning "Custom">
|
|
35 | -<!ENTITY torbutton.prefs.sec_overview "Disable certain web features that can be used to attack your security and anonymity.">
|
|
36 | -<!ENTITY torbutton.prefs.sec_standard_tooltip "Security Level : Standard">
|
|
37 | -<!ENTITY torbutton.prefs.sec_safer_tooltip "Security Level : Safer">
|
|
38 | -<!ENTITY torbutton.prefs.sec_safest_tooltip "Security Level : Safest">
|
|
39 | -<!ENTITY torbutton.prefs.sec_custom_summary "Your custom browser preferences have resulted in unusual security settings. For security and privacy reasons, we recommend you choose one of the default security levels.">
|
|
40 | -<!ENTITY torbutton.prefs.sec_restore_defaults "Restore Defaults">
|
|
41 | -<!ENTITY torbutton.prefs.sec_advanced_security_settings "Advanced Security Settings…">
|
|
42 | -<!ENTITY torbutton.prefs.sec_change "Change…"> |
... | ... | @@ -6,11 +6,9 @@ torbutton.jar: |
6 | 6 | |
7 | 7 | content/torbutton.js (chrome/content/torbutton.js)
|
8 | 8 | content/tor-circuit-display.js (chrome/content/tor-circuit-display.js)
|
9 | - content/preferences.xhtml (chrome/content/preferences.xhtml)
|
|
10 | 9 | content/aboutTor/aboutTor-content.js (chrome/content/aboutTor/aboutTor-content.js)
|
11 | 10 | * content/aboutTor/aboutTor.xhtml (chrome/content/aboutTor/aboutTor.xhtml)
|
12 | 11 | content/aboutTor/resources/aboutTor.js (chrome/content/aboutTor/resources/aboutTor.js)
|
13 | - content/preferences-mobile.js (chrome/content/preferences-mobile.js)
|
|
14 | 12 | |
15 | 13 | components/ (components/*)
|
16 | 14 | modules/ (modules/*)
|