Skip to content
Snippets Groups Projects
Verified Commit fcc2e7ea authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

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.
parent 9d845807
No related branches found
No related tags found
1 merge request!849Bug 42276: Rebase alpha onto 115.5.0esr
......@@ -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">
......
......@@ -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],
......
......@@ -5,7 +5,3 @@
-moz-context-properties: fill;
fill: currentColor;
}
.onionlocation-notification-icon {
display: none;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment