richard pushed to branch tor-browser-115.4.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits: 18023383 by Henry Wilkes at 2023-10-17T21:14:41+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/080f9ed47742644d2ff84f7aa0b10aea5c44... - 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/7962d6b7b17ee105ad64ab7906af2b9179f... + 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/18023383...
tor-commits@lists.torproject.org