... |
... |
@@ -13,12 +13,11 @@ const PRIORITIZE_ONIONS_PREF = "privacy.prioritizeonions.enabled"; |
13
|
13
|
|
14
|
14
|
// Element IDs
|
15
|
15
|
const ONIONLOCATION_BOX_ID = "onion-location-box";
|
16
|
|
-const ONIONLOCATION_BUTTON_ID = "onion-location-button";
|
17
|
16
|
const ONIONLOCATION_LABEL_ID = "onion-label";
|
18
|
17
|
|
19
|
18
|
// Notification IDs
|
20
|
19
|
const NOTIFICATION_ID = "onion-location";
|
21
|
|
-const NOTIFICATION_ANCHOR_ID = "onionlocation";
|
|
20
|
+const NOTIFICATION_ANCHOR_ID = "onion-location-box";
|
22
|
21
|
|
23
|
22
|
// Strings
|
24
|
23
|
const STRING_ONION_AVAILABLE = TorStrings.onionLocation.onionAvailable;
|
... |
... |
@@ -108,6 +107,9 @@ class OnionLocationParent extends JSWindowActorParent { |
108
|
107
|
callback: () => {},
|
109
|
108
|
};
|
110
|
109
|
|
|
110
|
+ win.document.getElementById("onion-location-body-text").textContent =
|
|
111
|
+ NOTIFICATION_DESCRIPTION;
|
|
112
|
+
|
111
|
113
|
const options = {
|
112
|
114
|
autofocus: true,
|
113
|
115
|
persistent: true,
|
... |
... |
@@ -115,28 +117,25 @@ class OnionLocationParent extends JSWindowActorParent { |
115
|
117
|
eventCallback(aTopic) {
|
116
|
118
|
if (aTopic === "removed") {
|
117
|
119
|
delete browser._onionLocationPrompt;
|
118
|
|
- delete browser.onionpopupnotificationanchor;
|
119
|
120
|
}
|
120
|
121
|
},
|
121
|
122
|
learnMoreURL: NOTIFICATION_LEARN_MORE_URL,
|
122
|
|
- displayURI: {
|
123
|
|
- hostPort: NOTIFICATION_TITLE, // This is hacky, but allows us to have a title without extra markup/css.
|
124
|
|
- },
|
125
|
123
|
hideClose: true,
|
126
|
|
- popupIconClass: "onionlocation-notification-icon",
|
|
124
|
+ popupOptions: {
|
|
125
|
+ position: "bottomright topright",
|
|
126
|
+ },
|
127
|
127
|
};
|
128
|
128
|
|
129
|
|
- // A hacky way of setting the popup anchor outside the usual url bar icon box
|
130
|
|
- // onionlocationpopupnotificationanchor comes from `${ANCHOR_ID}popupnotificationanchor`
|
131
|
|
- // From https://searchfox.org/mozilla-esr68/rev/080f9ed47742644d2ff84f7aa0b10aea5c44301a/browser/components/newtab/lib/CFRPageActions.jsm#488
|
132
|
|
- browser.onionlocationpopupnotificationanchor = win.document.getElementById(
|
133
|
|
- ONIONLOCATION_BUTTON_ID
|
134
|
|
- );
|
|
129
|
+ // A hacky way of setting the popup anchor outside the usual url bar icon
|
|
130
|
+ // box, similar to CRF and addons.
|
|
131
|
+ // See: https://searchfox.org/mozilla-esr115/rev/7962d6b7b17ee105ad64ab7906af2b9179f6e3d2/toolkit/modules/PopupNotifications.sys.mjs#46
|
|
132
|
+ browser[NOTIFICATION_ANCHOR_ID + "popupnotificationanchor"] =
|
|
133
|
+ win.document.getElementById(NOTIFICATION_ANCHOR_ID);
|
135
|
134
|
|
136
|
135
|
browser._onionLocationPrompt = win.PopupNotifications.show(
|
137
|
136
|
browser,
|
138
|
137
|
NOTIFICATION_ID,
|
139
|
|
- NOTIFICATION_DESCRIPTION,
|
|
138
|
+ NOTIFICATION_TITLE,
|
140
|
139
|
NOTIFICATION_ANCHOR_ID,
|
141
|
140
|
mainAction,
|
142
|
141
|
[cancelAction],
|