[tbb-commits] [tor-browser] 73/74: fixup! Bug 21952: Implement Onion-Location

gitolite role git at cupani.torproject.org
Wed Apr 27 20:17:59 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.9.0esr-11.0-1
in repository tor-browser.

commit 43429bcea122d9e9dd86f195104237f2d3e1b01d
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Fri Mar 11 17:58:13 2022 +0100

    fixup! Bug 21952: Implement Onion-Location
    
    Keep fragments in redirects, to fix #34366
---
 browser/components/onionservices/OnionLocationChild.jsm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/browser/components/onionservices/OnionLocationChild.jsm b/browser/components/onionservices/OnionLocationChild.jsm
index 9e00054ac56cb..23e1823f5a09a 100644
--- a/browser/components/onionservices/OnionLocationChild.jsm
+++ b/browser/components/onionservices/OnionLocationChild.jsm
@@ -4,6 +4,8 @@
 
 var EXPORTED_SYMBOLS = ["OnionLocationChild"];
 
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
 class OnionLocationChild extends JSWindowActorChild {
   handleEvent(event) {
     this.onPageShow(event);
@@ -23,9 +25,16 @@ class OnionLocationChild extends JSWindowActorChild {
     if (aMessage.name == "OnionLocation:Refresh") {
       const doc = this.document;
       const docShell = this.docShell;
-      const onionLocationURI = doc.onionLocationURI;
+      let onionLocationURI = doc.onionLocationURI;
       const refreshURI = docShell.QueryInterface(Ci.nsIRefreshURI);
       if (onionLocationURI && refreshURI) {
+        const docUrl = new URL(doc.URL);
+        let onionUrl = new URL(onionLocationURI.asciiSpec);
+        // Keep consistent with Location
+        if (!onionUrl.hash && docUrl.hash) {
+          onionUrl.hash = docUrl.hash;
+          onionLocationURI = Services.io.newURI(onionUrl.toString());
+        }
         refreshURI.refreshURI(
           onionLocationURI,
           doc.nodePrincipal,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list