richard pushed to branch tor-browser-115.5.0esr-13.0-1 at The Tor Project / 
Applications / Tor Browser


Commits:
d8eacc7e by Henry Wilkes at 2023-11-16T00:28:11+00:00
fixup! Bug 21952: Implement Onion-Location

Bug 41341: Make the body text of onion-location-notification non-bold,
and anchor the popup to the bottom right corner of the ".onion
available" button.

- - - - -


3 changed files:

- browser/base/content/popup-notifications.inc
- browser/components/onionservices/OnionLocationParent.jsm
- browser/components/onionservices/content/onionlocation.css


Changes:

=====================================
browser/base/content/popup-notifications.inc
=====================================
@@ -8,6 +8,15 @@
            noautofocus="true"
            role="alert"/>
 
+    <!-- Shown when visiting first web page with an onion-available header.
+       - This allows us to add some extra content to the popup.
+       - See tor-browser#21952 and tor-browser#41341 -->
+    <popupnotification id="onion-location-notification" hidden="true">
+      <popupnotificationcontent orient="vertical">
+        <description id="onion-location-body-text"/>
+      </popupnotificationcontent>
+    </popupnotification>
+
     <popupnotification id="webRTC-shareDevices-notification" hidden="true"
                        
descriptionid="webRTC-shareDevices-notification-description">
       <popupnotificationcontent id="webRTC-selectCamera" orient="vertical">


=====================================
browser/components/onionservices/OnionLocationParent.jsm
=====================================
@@ -13,12 +13,11 @@ const PRIORITIZE_ONIONS_PREF = 
"privacy.prioritizeonions.enabled";
 
 // Element IDs
 const ONIONLOCATION_BOX_ID = "onion-location-box";
-const ONIONLOCATION_BUTTON_ID = "onion-location-button";
 const ONIONLOCATION_LABEL_ID = "onion-label";
 
 // Notification IDs
 const NOTIFICATION_ID = "onion-location";
-const NOTIFICATION_ANCHOR_ID = "onionlocation";
+const NOTIFICATION_ANCHOR_ID = "onion-location-box";
 
 // Strings
 const STRING_ONION_AVAILABLE = TorStrings.onionLocation.onionAvailable;
@@ -108,6 +107,9 @@ class OnionLocationParent extends JSWindowActorParent {
       callback: () => {},
     };
 
+    win.document.getElementById("onion-location-body-text").textContent =
+      NOTIFICATION_DESCRIPTION;
+
     const options = {
       autofocus: true,
       persistent: true,
@@ -115,28 +117,25 @@ class OnionLocationParent extends JSWindowActorParent {
       eventCallback(aTopic) {
         if (aTopic === "removed") {
           delete browser._onionLocationPrompt;
-          delete browser.onionpopupnotificationanchor;
         }
       },
       learnMoreURL: NOTIFICATION_LEARN_MORE_URL,
-      displayURI: {
-        hostPort: NOTIFICATION_TITLE, // This is hacky, but allows us to have 
a title without extra markup/css.
-      },
       hideClose: true,
-      popupIconClass: "onionlocation-notification-icon",
+      popupOptions: {
+        position: "bottomright topright",
+      },
     };
 
-    // A hacky way of setting the popup anchor outside the usual url bar icon 
box
-    // onionlocationpopupnotificationanchor comes from 
`${ANCHOR_ID}popupnotificationanchor`
-    // From 
https://searchfox.org/mozilla-esr68/rev/080f9ed47742644d2ff84f7aa0b10aea5c44301a/browser/components/newtab/lib/CFRPageActions.jsm#488
-    browser.onionlocationpopupnotificationanchor = win.document.getElementById(
-      ONIONLOCATION_BUTTON_ID
-    );
+    // A hacky way of setting the popup anchor outside the usual url bar icon
+    // box, similar to CRF and addons.
+    // See: 
https://searchfox.org/mozilla-esr115/rev/7962d6b7b17ee105ad64ab7906af2b9179f6e3d2/toolkit/modules/PopupNotifications.sys.mjs#46
+    browser[NOTIFICATION_ANCHOR_ID + "popupnotificationanchor"] =
+      win.document.getElementById(NOTIFICATION_ANCHOR_ID);
 
     browser._onionLocationPrompt = win.PopupNotifications.show(
       browser,
       NOTIFICATION_ID,
-      NOTIFICATION_DESCRIPTION,
+      NOTIFICATION_TITLE,
       NOTIFICATION_ANCHOR_ID,
       mainAction,
       [cancelAction],


=====================================
browser/components/onionservices/content/onionlocation.css
=====================================
@@ -5,7 +5,3 @@
   -moz-context-properties: fill;
   fill: currentColor;
 }
-
-.onionlocation-notification-icon {
-  display: none;
-}



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d8eacc7ee07c76a586db0e074be6a56248cb5cee

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d8eacc7ee07c76a586db0e074be6a56248cb5cee
You're receiving this email because of your account on gitlab.torproject.org.


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

Reply via email to