Skip to content

Commit

Permalink
Always prefer known-good browsers for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Dec 4, 2020
1 parent 161559b commit 8fcff3b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app/src/main/java/tech/httptoolkit/android/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,11 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
this.currentProxyConfig!! // Safe!! because you can only run tests while connected
) == "system"

val testBrowser = if (certIsSystemTrusted) {
null // If we have a system cert, we can safely always use the system browser
} else {
// If not, and there is a supported browser available, we use it. This prioritises
// the default browser, and only returns null if no known supported browser exists.
getTestBrowserPackage(this)
}
// If we have a system cert, in theory we could use any browser. In practice though, some
// (i.e. Firefox) ignore system certs to use their own settings. It's best to try and ensure
// for testing, we always use a supported browser. This will prioritize the default, if it
// is supported, so only matters if the default browser is not on our known-good list.
val testBrowser = getTestBrowserPackage(this)

val canUseHttps = testBrowser != null || certIsSystemTrusted

Expand Down

0 comments on commit 8fcff3b

Please sign in to comment.