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

[tor-commits] [tor-browser/tor-browser-91.2.0esr-11.0-1] fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser



commit 9049bf031e938af4dfc3b09c729cacd9bcc1b11b
Author: Richard Pospesel <richard@xxxxxxxxxxxxxx>
Date:   Wed Sep 8 12:06:57 2021 -0500

    fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser
---
 browser/components/torconnect/TorConnectParent.jsm     |  8 +-------
 .../components/torconnect/content/aboutTorConnect.js   | 18 ++++++++----------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/browser/components/torconnect/TorConnectParent.jsm b/browser/components/torconnect/TorConnectParent.jsm
index b735d75c1a72..2fbc2a5c7c7c 100644
--- a/browser/components/torconnect/TorConnectParent.jsm
+++ b/browser/components/torconnect/TorConnectParent.jsm
@@ -25,7 +25,6 @@ class TorConnectParent extends JSWindowActorParent {
     this.state = {
       State: TorConnect.state,
       StateChanged: false,
-      Exit: false,
       ErrorMessage: TorConnect.errorMessage,
       ErrorDetails: TorConnect.errorDetails,
       BootstrapProgress: TorConnect.bootstrapProgress,
@@ -65,12 +64,7 @@ class TorConnectParent extends JSWindowActorParent {
             break;
           }
           case TorConnectTopics.BootstrapComplete: {
-            // tells about:torconnect pages to close or redirect themselves
-            // this flag will only be set if an about:torconnect page
-            // reaches the Bootstrapped state, so if a user
-            // navigates to about:torconnect manually after bootstrap, the page
-            // will not auto-close on them
-            self.state.Exit = true;
+            // noop
             break;
           }
           case TorConnectTopics.BootstrapError: {
diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js
index 4eed3cf6a5c3..b53f8b13cb80 100644
--- a/browser/components/torconnect/content/aboutTorConnect.js
+++ b/browser/components/torconnect/content/aboutTorConnect.js
@@ -194,16 +194,10 @@ class AboutTorConnect {
     this.hide(this.elements.advancedButton);
     this.hide(this.elements.cancelButton);
 
-    // only exit about:torconnect if TorConnectParent directs us to
-    if (state.Exit) {
-      if (this.redirect) {
-        // first try to forward to final destination
-        document.location = this.redirect;
-      } else {
-        // or else close the window
-        window.close();
-      }
-    }
+    // redirects page to the requested redirect url, removes about:torconnect
+    // from the page stack, so users cannot accidentally go 'back' to the
+    // now unresponsive page
+    window.location.replace(this.redirect);
   }
 
   update_Disabled(state) {
@@ -283,6 +277,10 @@ class AboutTorConnect {
     if (params.has("redirect")) {
       const encodedRedirect = params.get("redirect");
       this.redirect = decodeURIComponent(encodedRedirect);
+    } else {
+      // if the user gets here manually or via the button in the urlbar
+      // then we will redirect to about:tor
+      this.redirect = "about:tor";
     }
 
     let args = await RPMSendQuery("torconnect:get-init-args");



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