[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-102.5.0esr-12.5-1] 2 commits: fixup! Bug 10760: Integrate TorButton to TorBrowser core
Richard Pospesel (@richard)
git at gitlab.torproject.org
Thu Dec 15 15:03:54 UTC 2022
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
fixup! Bug 10760: Integrate TorButton to TorBrowser core
Bug 41001: Removed the old security preferences code from torbutton.
- - - - -
c7a1ca3c by Pier Angelo Vendrame at 2022-12-15T15:01:28+00:00
fixup! Add TorStrings module for localization
Bug 41001: Removed strings used only by preferences.xhtml
- - - - -
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:
=====================================
toolkit/torbutton/chrome/content/preferences-mobile.js deleted
=====================================
@@ -1,59 +0,0 @@
-// # Security Settings User Interface for Mobile
-
-// Utilities
-const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {
- getBoolPref,
- getIntPref,
- setBoolPref,
- setIntPref,
- getCharPref,
-} = Services.prefs;
-
-// Description elements have the follow names.
-const descNames = ["", "desc_standard", "desc_safer", "desc_safest"];
-// "Learn-more"-elements have the follow names.
-const linkNames = ["", "link_standard", "link_safer", "link_safest"];
-// A single `state` object that reflects the user settings in this UI.
-
-let state = { slider: 0, custom: false };
-
-// Utility functions to convert between the legacy 4-value pref index
-// and the 3-valued security slider.
-let sliderPositionToPrefSetting = pos => [0, 4, 2, 1][pos];
-let prefSettingToSliderPosition = pref => [0, 3, 2, 2, 1][pref];
-
-// Set the desired slider value and update UI.
-function torbutton_set_slider(sliderValue) {
- state.slider = sliderValue;
- let slider = document.getElementById("torbutton_sec_slider");
- slider.value = sliderValue.toString();
- let descs = descNames.map(name => document.getElementById(name));
- descs.forEach((desc, i) => {
- if (state.slider !== i) {
- desc.style.display = "none";
- } else {
- desc.style.display = "block";
- }
- });
- torbutton_save_security_settings();
-}
-
-// Read prefs 'browser.security_level.security_slider' and
-// 'browser.security_level.security_custom', and initialize the UI.
-function torbutton_init_security_ui() {
- torbutton_set_slider(
- prefSettingToSliderPosition(
- getIntPref("browser.security_level.security_slider")
- )
- );
-}
-
-// Write the two prefs from the current settings.
-function torbutton_save_security_settings() {
- setIntPref(
- "browser.security_level.security_slider",
- sliderPositionToPrefSetting(state.slider)
- );
- setBoolPref("browser.security_level.security_custom", state.custom);
-}
=====================================
toolkit/torbutton/chrome/content/preferences.xhtml deleted
=====================================
@@ -1,84 +0,0 @@
-<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <meta charset="UTF-8"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <head>
- <title>&torbutton.prefs.security_settings;</title>
- <link type="text/css" rel="stylesheet" charset="UTF-8" href="chrome://torbutton/skin/preferences.css"/>
- <link type="text/css" rel="stylesheet" charset="UTF-8" href="chrome://torbutton/skin/preferences-mobile.css"/>
- <script type="text/javascript" src="preferences-mobile.js"></script>
- <style>
- </style>
- </head>
- <body onload="torbutton_init_security_ui()">
- <div class="wrapper outer-wrapper">
- <div class="title">
- &torbutton.prefs.sec_caption;
- </div>
- <div class="wrapper inner-wrapper">
- <input id="torbutton_sec_slider" type="range" min="1" max="3" list="datalist" onchange="torbutton_set_slider(parseInt(this.value, 10))"/>
- <datalist id="datalist">
- <option onclick="torbutton_set_slider(1)">
- &torbutton.prefs.sec_standard_label;
- </option>
- <option onclick="torbutton_set_slider(2)">
- &torbutton.prefs.sec_safer_label;
- </option>
- <option onclick="torbutton_set_slider(3)">
- &torbutton.prefs.sec_safest_label;
- </option>
- </datalist>
- <div class="description-wrapper">
- <div id="desc_safest" class="description">
- <p class="slider-text-size slider-text-weight">
- &torbutton.prefs.sec_safest_description;
- </p>
- <p class="slider-text-size slider-text-weight">
- &torbutton.prefs.sec_safest_list_label;
- </p>
- <p class="slider-text-size">
- &torbutton.prefs.sec_js_disabled;
- </p>
- <p class="slider-text-size">
- &torbutton.prefs.sec_limit_graphics_and_typography;
- </p>
- <p class="slider-text-size">
- &torbutton.prefs.sec_click_to_play_media;
- </p>
- <a id="link_safest" class="text-link">
- &torbutton.prefs.sec_learn_more_label;
- </a>
- </div>
- <div id="desc_safer" class="description">
- <p class="slider-text-size slider-text-weight">
- &torbutton.prefs.sec_safer_description;
- </p>
- <p class="slider-text-size slider-text-weight">
- &torbutton.prefs.sec_safer_list_label;
- </p>
- <p class="slider-text-size">
- &torbutton.prefs.sec_js_on_https_sites_only;
- </p>
- <p class="slider-text-size">
- &torbutton.prefs.sec_limit_typography;
- </p>
- <p class="slider-text-size">
- &torbutton.prefs.sec_click_to_play_media;
- </p>
- <a id="link_safer" class="text-link">
- &torbutton.prefs.sec_learn_more_label;
- </a>
- </div>
- <div id="desc_standard" class="description">
- <p class="slider-text-size slider-text-weight">
- &torbutton.prefs.sec_standard_description;
- </p>
- <a id="link_standard" class="text-link">
- &torbutton.prefs.sec_learn_more_label;
- </a>
- </div>
- </div>
- </div>
- </div>
- </body>
-</html>
=====================================
toolkit/torbutton/chrome/content/torbutton.js
=====================================
@@ -20,7 +20,6 @@ var torbutton_new_circuit;
let {
unescapeTorString,
- bindPrefAndInit,
getDomainForBrowser,
torbutton_log,
torbutton_get_property_string,
@@ -185,10 +184,6 @@ var torbutton_new_circuit;
},
};
- function torbutton_is_mobile() {
- return Services.appinfo.OS === "Android";
- }
-
// Bug 1506 P2-P4: This code sets some version variables that are irrelevant.
// It does read out some important environment variables, though. It is
// called once per browser window.. This might belong in a component.
@@ -269,8 +264,6 @@ var torbutton_new_circuit;
torbutton_abouttor_message_handler
);
- setupPreferencesForMobile();
-
torbutton_log(1, "registering Tor check observer");
torbutton_tor_check_observer.register();
@@ -323,7 +316,7 @@ var torbutton_new_circuit;
// not working.
async getChromeData(aIsRespondingToPageLoad) {
let dataObj = {
- mobile: torbutton_is_mobile(),
+ mobile: Services.appinfo.OS === "Android",
updateChannel: AppConstants.MOZ_UPDATE_CHANNEL,
torOn: await torbutton_tor_check_ok(),
};
@@ -788,53 +781,6 @@ var torbutton_new_circuit;
return true;
}
- function showSecurityPreferencesPanel(chromeWindow) {
- const tabBrowser = chromeWindow.BrowserApp;
- let settingsTab = null;
-
- const SECURITY_PREFERENCES_URI =
- "chrome://torbutton/content/preferences.xhtml";
-
- tabBrowser.tabs.some(function(tab) {
- // If the security prefs tab is opened, send the user to it
- if (tab.browser.currentURI.spec === SECURITY_PREFERENCES_URI) {
- settingsTab = tab;
- return true;
- }
- return false;
- });
-
- if (settingsTab === null) {
- // Open up the settings panel in a new tab.
- tabBrowser.addTab(SECURITY_PREFERENCES_URI, {
- selected: true,
- parentId: tabBrowser.selectedTab.id,
- triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
- });
- } else {
- // Activate an existing settings panel tab.
- tabBrowser.selectTab(settingsTab);
- }
- }
-
- function setupPreferencesForMobile() {
- if (!torbutton_is_mobile()) {
- return;
- }
-
- torbutton_log(4, "Setting up settings preferences for Android.");
-
- const chromeWindow = Services.wm.getMostRecentWindow("navigator:browser");
-
- // Add the extension's chrome menu item to the main browser menu.
- chromeWindow.NativeWindow.menu.add({
- name: torbutton_get_property_string(
- "torbutton.security_settings.menu.title"
- ),
- callback: showSecurityPreferencesPanel.bind(this, chromeWindow),
- });
- }
-
// Bug 1506 P3: This is needed pretty much only for the window resizing.
// See comments for individual functions for details
function torbutton_new_window(event) {
=====================================
toolkit/torbutton/chrome/locale/en-US/torbutton.dtd
=====================================
@@ -13,30 +13,3 @@
<!-- Onion services strings. Strings are kept here for ease of translation. -->
<!ENTITY torbutton.onionServices.authPrompt.tooltip "Open onion service client authentication prompt">
<!ENTITY torbutton.onionServices.authPrompt.persistCheckboxLabel "Remember this key">
-
-<!ENTITY torbutton.prefs.security_settings "Tor Browser Security Settings">
-<!ENTITY torbutton.prefs.sec_caption "Security Level">
-<!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.">
-<!ENTITY torbutton.prefs.sec_standard_label "Standard">
-<!ENTITY torbutton.prefs.sec_standard_description "All Tor Browser and website features are enabled.">
-<!ENTITY torbutton.prefs.sec_safer_label "Safer">
-<!ENTITY torbutton.prefs.sec_safer_description "Disables website features that are often dangerous, causing some sites to lose functionality.">
-<!ENTITY torbutton.prefs.sec_safer_list_label "At the safer setting:">
-<!ENTITY torbutton.prefs.sec_safest_label "Safest">
-<!ENTITY torbutton.prefs.sec_safest_description "Only allows website features required for static sites and basic services. These changes affect images, media, and scripts.">
-<!ENTITY torbutton.prefs.sec_safest_list_label "At the safest setting:">
-<!ENTITY torbutton.prefs.sec_learn_more_label "Learn more">
-<!ENTITY torbutton.prefs.sec_js_on_https_sites_only "JavaScript is disabled on non-HTTPS sites.">
-<!ENTITY torbutton.prefs.sec_js_disabled "JavaScript is disabled by default on all sites.">
-<!ENTITY torbutton.prefs.sec_limit_typography "Some fonts and math symbols are disabled.">
-<!ENTITY torbutton.prefs.sec_limit_graphics_and_typography "Some fonts, icons, math symbols, and images are disabled.">
-<!ENTITY torbutton.prefs.sec_click_to_play_media "Audio and video (HTML5 media), and WebGL are click-to-play.">
-<!ENTITY torbutton.prefs.sec_custom_warning "Custom">
-<!ENTITY torbutton.prefs.sec_overview "Disable certain web features that can be used to attack your security and anonymity.">
-<!ENTITY torbutton.prefs.sec_standard_tooltip "Security Level : Standard">
-<!ENTITY torbutton.prefs.sec_safer_tooltip "Security Level : Safer">
-<!ENTITY torbutton.prefs.sec_safest_tooltip "Security Level : Safest">
-<!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.">
-<!ENTITY torbutton.prefs.sec_restore_defaults "Restore Defaults">
-<!ENTITY torbutton.prefs.sec_advanced_security_settings "Advanced Security Settings…">
-<!ENTITY torbutton.prefs.sec_change "Change…">
=====================================
toolkit/torbutton/jar.mn
=====================================
@@ -6,11 +6,9 @@ torbutton.jar:
content/torbutton.js (chrome/content/torbutton.js)
content/tor-circuit-display.js (chrome/content/tor-circuit-display.js)
- content/preferences.xhtml (chrome/content/preferences.xhtml)
content/aboutTor/aboutTor-content.js (chrome/content/aboutTor/aboutTor-content.js)
* content/aboutTor/aboutTor.xhtml (chrome/content/aboutTor/aboutTor.xhtml)
content/aboutTor/resources/aboutTor.js (chrome/content/aboutTor/resources/aboutTor.js)
- content/preferences-mobile.js (chrome/content/preferences-mobile.js)
components/ (components/*)
modules/ (modules/*)
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/81c5119bad40f5cb6b9b4cdccadeec229c5a0798...c7a1ca3c77921f744386391daba99a9f3894c2dd
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/81c5119bad40f5cb6b9b4cdccadeec229c5a0798...c7a1ca3c77921f744386391daba99a9f3894c2dd
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20221215/07d5cdbb/attachment-0001.htm>
More information about the tbb-commits
mailing list