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

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-115.4.0esr-13.5-1] fixup! Bug 21952: Implement Onion-Location



Title: GitLab

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:

Changes:

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

  • browser/components/onionservices/OnionLocationParent.jsm
    ... ... @@ -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],
    

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

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