[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torbutton/master] Bug 26100: Update about:tor code after changes in the resource and js



commit e37b97e4af14fdbccfcb485f6b4ecf136aeb2e18
Author: Igor Oliveira <igt0@xxxxxxxxxxxxxx>
Date:   Thu May 17 16:13:47 2018 -0300

    Bug 26100: Update about:tor code after changes in the resource and js
    code
    
    - Move all the resource files to the same directory and change the chrome.manifest
    file to allow them to be accessible by the chrome.[1]
    
    - jsversion.h was removed, we don't need to specify the JS version anymore.[2]
    
    - Since Torbutton has now logic to load the default preferences and we don't
    know when a string is a complex data, for the sake of simplicity, we are
    now retiring non-localized.properties and hard coding the about:tor in the
    preferences file.
    
    - Use tabbrowser-initialBrowser instead of content
    
    [1] https://bugzilla.mozilla.org/show_bug.cgi?id=863246
    [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1440043
---
 src/chrome.manifest                                       |   1 +
 src/chrome/content/aboutTor/aboutTor.xhtml                |   4 ++--
 src/chrome/content/locale/non-localized.properties        |   6 ------
 src/chrome/content/torbutton.js                           |   2 +-
 src/chrome/skin/aboutTor.css                              |  14 +++++++-------
 .../{content/aboutTor => skin}/onionArrow-extension.png   | Bin
 .../{content/aboutTor => skin}/onionArrow-leftBend.png    | Bin
 .../{content/aboutTor => skin}/onionArrow-rightBend.png   | Bin
 .../{content/aboutTor => skin}/onionArrow-short.png       | Bin
 src/chrome/{content/aboutTor => skin}/search.png          | Bin
 src/chrome/{content/aboutTor => skin}/tor-off.png         | Bin
 src/chrome/{content/aboutTor => skin}/tor-on.png          | Bin
 src/defaults/preferences/preferences.js                   |   2 +-
 13 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/src/chrome.manifest b/src/chrome.manifest
index 230a1e6..7b57d39 100644
--- a/src/chrome.manifest
+++ b/src/chrome.manifest
@@ -6,6 +6,7 @@ overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome:
 overlay about:addons chrome://torbutton/content/torbutton-extensions.xul
 overlay chrome://mozapps/content/extensions/extensions.xul chrome://torbutton/content/torbutton-extensions.xul
 resource torbutton ./
+resource torbutton-assets resource://torbutton/chrome/skin/ contentaccessible=yes
 
 # browser branding
 override chrome://branding/locale/brand.dtd chrome://torbutton/locale/brand.dtd
diff --git a/src/chrome/content/aboutTor/aboutTor.xhtml b/src/chrome/content/aboutTor/aboutTor.xhtml
index 0d8f680..5cb2a60 100644
--- a/src/chrome/content/aboutTor/aboutTor.xhtml
+++ b/src/chrome/content/aboutTor/aboutTor.xhtml
@@ -20,8 +20,8 @@
 <head>
   <title>&aboutTor.title;</title>
   <link rel="stylesheet" type="text/css" media="all"
-        href="resource://torbutton/chrome/skin/aboutTor.css"/>
-<script type="text/javascript;version=1.7">
+        href="resource://torbutton-assets/aboutTor.css"/>
+<script type="text/javascript">
  <![CDATA[
 window.addEventListener("pageshow", function() {
   let evt = new CustomEvent("AboutTorLoad", { bubbles: true });
diff --git a/src/chrome/content/locale/non-localized.properties b/src/chrome/content/locale/non-localized.properties
deleted file mode 100644
index dca7863..0000000
--- a/src/chrome/content/locale/non-localized.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file must be located in a subdirectory named "locale" so that
-# about:config will display the correct value for browser.startup.homepage.
-# See fetchPref() inside toolkit/components/viewconfig/content/config.js
-
-# Default home page
-browser.startup.homepage=about:tor
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 40d63fd..7f750bc 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -664,7 +664,7 @@ function torbutton_get_toolbarbutton_xpos() {
     let tbItem = torbutton_get_toolbutton();
     if (tbItem) {
       let tbItemRect = tbItem.getBoundingClientRect();
-      let contentElem = document.getElementById("content");
+      let contentElem = document.getElementById("tabbrowser-initialBrowser");
       let contentRect = contentElem.getBoundingClientRect();
       if (tbItemRect.top < contentRect.top) {
         tbXpos = tbItemRect.left + (tbItemRect.width / 2.0) - contentRect.left;
diff --git a/src/chrome/skin/aboutTor.css b/src/chrome/skin/aboutTor.css
index 873f6d0..62c9256 100644
--- a/src/chrome/skin/aboutTor.css
+++ b/src/chrome/skin/aboutTor.css
@@ -59,7 +59,7 @@ body:not([initialized]) {
 }
 
 body[toron] #torstatus-image {
-  background-image: url('chrome://torbutton/content/aboutTor/tor-on.png');
+  background-image: url('chrome://torbutton/skin/tor-on.png');
 }
 
 #torstatus-image {
@@ -68,7 +68,7 @@ body[toron] #torstatus-image {
   left: 85px;
   height: 128px;
   width: 128px;
-  background-image: url('chrome://torbutton/content/aboutTor/tor-off.png');
+  background-image: url('chrome://torbutton/skin/tor-off.png');
   background-repeat: no-repeat;
   background-position: center;
   z-index: -1;
@@ -84,23 +84,23 @@ body[toron] #torstatus-image {
   top: 4px;
   width: 30px;
   height: 36px;
-  background-image: url('chrome://torbutton/content/aboutTor/onionArrow-short.png');
+  background-image: url('chrome://torbutton/skin/onionArrow-short.png');
 }
 
 #toolbarIconArrowVertExtension, #toolbarIconArrowHorzExtension {
   width: 11px;
   height: 11px;
-  background-image: url('chrome://torbutton/content/aboutTor/onionArrow-extension.png');
+  background-image: url('chrome://torbutton/skin/onionArrow-extension.png');
 }
 
 #toolbarIconArrowBend {
   width: 22px;
   height: 22px;
-  background-image: url('chrome://torbutton/content/aboutTor/onionArrow-leftBend.png');
+  background-image: url('chrome://torbutton/skin/onionArrow-leftBend.png');
 }
 
 #toolbarIconArrowBend[pos="right"] {
-  background-image: url('chrome://torbutton/content/aboutTor/onionArrow-rightBend.png');
+  background-image: url('chrome://torbutton/skin/onionArrow-rightBend.png');
 }
 
 a {
@@ -288,7 +288,7 @@ body .top div.hideIfTorIsUpToDate h1 {
   height: 34px;
   width: 33px;
   border: 0;
-  background: url('chrome://torbutton/content/aboutTor/search.png') no-repeat top left;
+  background: url('chrome://torbutton/skin/search.png') no-repeat top left;
   cursor: pointer;
 }
 
diff --git a/src/chrome/content/aboutTor/onionArrow-extension.png b/src/chrome/skin/onionArrow-extension.png
similarity index 100%
rename from src/chrome/content/aboutTor/onionArrow-extension.png
rename to src/chrome/skin/onionArrow-extension.png
diff --git a/src/chrome/content/aboutTor/onionArrow-leftBend.png b/src/chrome/skin/onionArrow-leftBend.png
similarity index 100%
rename from src/chrome/content/aboutTor/onionArrow-leftBend.png
rename to src/chrome/skin/onionArrow-leftBend.png
diff --git a/src/chrome/content/aboutTor/onionArrow-rightBend.png b/src/chrome/skin/onionArrow-rightBend.png
similarity index 100%
rename from src/chrome/content/aboutTor/onionArrow-rightBend.png
rename to src/chrome/skin/onionArrow-rightBend.png
diff --git a/src/chrome/content/aboutTor/onionArrow-short.png b/src/chrome/skin/onionArrow-short.png
similarity index 100%
rename from src/chrome/content/aboutTor/onionArrow-short.png
rename to src/chrome/skin/onionArrow-short.png
diff --git a/src/chrome/content/aboutTor/search.png b/src/chrome/skin/search.png
similarity index 100%
rename from src/chrome/content/aboutTor/search.png
rename to src/chrome/skin/search.png
diff --git a/src/chrome/content/aboutTor/tor-off.png b/src/chrome/skin/tor-off.png
similarity index 100%
rename from src/chrome/content/aboutTor/tor-off.png
rename to src/chrome/skin/tor-off.png
diff --git a/src/chrome/content/aboutTor/tor-on.png b/src/chrome/skin/tor-on.png
similarity index 100%
rename from src/chrome/content/aboutTor/tor-on.png
rename to src/chrome/skin/tor-on.png
diff --git a/src/defaults/preferences/preferences.js b/src/defaults/preferences/preferences.js
index f61cb89..f51c7db 100644
--- a/src/defaults/preferences/preferences.js
+++ b/src/defaults/preferences/preferences.js
@@ -53,7 +53,7 @@ pref("extensions.torbutton.confirm_plugins", true);
 pref("extensions.torbutton.confirm_newnym", true);
 
 // Browser home page:
-pref("browser.startup.homepage", "chrome://torbutton/content/locale/non-localized.properties");
+pref("browser.startup.homepage", "about:tor");
 
 // This pref specifies an ad-hoc "version" for various pref update hacks we need to do
 pref("extensions.torbutton.pref_fixup_version", 0);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits