Pier Angelo Vendrame pushed to branch tor-browser-128.8.0esr-14.5-1 at The Tor 
Project / Applications / Tor Browser


Commits:
1e1e4147 by clairehurst at 2025-03-31T10:55:30-06:00
fixup! [android] Implement Android-native Connection Assist UI

Bug 43576: Connection Assist on Android Fast Follows (Bug 41188)
Fix domain Fronting issues: !1426 (comment 3175104)

- - - - -


1 changed file:

- 
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt


Changes:

=====================================
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt
=====================================
@@ -10,6 +10,7 @@ import androidx.lifecycle.AndroidViewModel
 import androidx.lifecycle.MutableLiveData
 import kotlinx.coroutines.flow.MutableStateFlow
 import kotlinx.coroutines.flow.StateFlow
+import mozilla.components.browser.state.ext.getUrl
 import org.mozilla.fenix.HomeActivity
 import org.mozilla.fenix.R
 import org.mozilla.fenix.ext.components
@@ -23,11 +24,27 @@ class TorConnectionAssistViewModel(
 ) : AndroidViewModel(application), BootstrapStateChangeListener {
 
     private val TAG = "torConnectionAssistVM"
+    private val components = application.components
     private val torAndroidIntegration =
-        application.components.core.geckoRuntime.torIntegrationController
+        components.core.geckoRuntime.torIntegrationController
 
     init {
         torAndroidIntegration.registerBootstrapStateChangeListener(this)
+        loadDummyPage()
+    }
+
+    private fun loadDummyPage() {
+        // Load local url (it just needs to begin with "about:" to get past 
filter) to initialize the browser,
+        // Domain fronting needs Services.io.getProtocolHandler("http")... to 
actually work, and it
+        // does not till the browser/engine is initialized, and this is so far 
the easiest way to do that.
+        // Load early here so that it is ready when needed if we get to the 
step where DF is invoked
+        // Then later remove it in onCleared so it doesn't show for the user
+        components.useCases.tabsUseCases.addTab.invoke("about:")
+    }
+
+    private fun clearDummyPage() {
+        // Remove loaded URL so it doesn't show up
+        
components.useCases.tabsUseCases.removeTab.invoke(components.core.store.state.tabs.find
 {it.getUrl() == "about:"}?.id ?: "")
     }
 
     fun fetchCountryNamesGet() {
@@ -45,6 +62,7 @@ class TorConnectionAssistViewModel(
 
     override fun onCleared() {
         torAndroidIntegration.unregisterBootstrapStateChangeListener(this)
+        clearDummyPage()
         super.onCleared()
     }
 



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1e1e4147025abaf8c77570e5c531bb588014ea9a

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1e1e4147025abaf8c77570e5c531bb588014ea9a
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to