Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 12565
Browse files Browse the repository at this point in the history
  • Loading branch information
iorgamgabriel committed Aug 1, 2022
2 parents fe57dda + 7688e58 commit 3696994
Show file tree
Hide file tree
Showing 42 changed files with 598 additions and 100 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ object Versions {
const val disklrucache = "2.0.2"
const val leakcanary = "2.8.1"

const val mozilla_appservices = "93.7.0"
const val mozilla_appservices = "93.7.1"

const val mozilla_glean = "50.1.2"
const val mozilla_glean = "50.1.3"

const val material = "1.2.1"

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Gecko.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object Gecko {
/**
* GeckoView Version.
*/
const val version = "105.0.20220726094428"
const val version = "105.0.20220801034014"

/**
* GeckoView channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class GeckoEngineSession(
internal var currentUrl: String? = null
internal var lastLoadRequestUri: String? = null
internal var pageLoadingUrl: String? = null
internal var appRedirectUrl: String? = null
internal var scrollY: Int = 0
// The Gecko site permissions for the loaded site.
internal var geckoPermissions: List<ContentPermission> = emptyList()
Expand Down Expand Up @@ -474,6 +475,13 @@ class GeckoEngineSession(
return
}

appRedirectUrl?.let {
if (url == appRedirectUrl) {
goBack(false)
return
}
}

currentUrl = url
initialLoad = false
initialLoadRequest = null
Expand Down Expand Up @@ -590,6 +598,7 @@ class GeckoEngineSession(
is InterceptionResponse.Content -> loadData(data, mimeType, encoding)
is InterceptionResponse.Url -> loadUrl(url)
is InterceptionResponse.AppIntent -> {
appRedirectUrl = lastLoadRequestUri
notifyObservers {
onLaunchIntentRequest(url = url, appIntent = appIntent)
}
Expand All @@ -604,6 +613,7 @@ class GeckoEngineSession(
}

if (interceptionResponse !is InterceptionResponse.AppIntent) {
appRedirectUrl = ""
lastLoadRequestUri = request.uri
}
return interceptionResponse
Expand Down Expand Up @@ -697,6 +707,12 @@ class GeckoEngineSession(
return GeckoResult.fromValue(false)
}

appRedirectUrl?.let {
if (url == appRedirectUrl) {
return GeckoResult.fromValue(false)
}
}

val delegate = settings.historyTrackingDelegate ?: return GeckoResult.fromValue(false)

// Check if the delegate wants this type of url.
Expand Down Expand Up @@ -851,22 +867,24 @@ class GeckoEngineSession(
}

override fun onTitleChange(session: GeckoSession, title: String?) {
if (!privateMode) {
currentUrl?.let { url ->
settings.historyTrackingDelegate?.let { delegate ->
if (delegate.shouldStoreUri(url)) {
// NB: There's no guarantee that the title change will be processed by the
// delegate before the session is closed (and the corresponding coroutine
// job is cancelled). Observers will always be notified of the title
// change though.
launch(coroutineContext) {
delegate.onTitleChanged(url, title ?: "")
if (appRedirectUrl.isNullOrEmpty()) {
if (!privateMode) {
currentUrl?.let { url ->
settings.historyTrackingDelegate?.let { delegate ->
if (delegate.shouldStoreUri(url)) {
// NB: There's no guarantee that the title change will be processed by the
// delegate before the session is closed (and the corresponding coroutine
// job is cancelled). Observers will always be notified of the title
// change though.
launch(coroutineContext) {
delegate.onTitleChanged(url, title ?: "")
}
}
}
}
}
notifyObservers { onTitleChange(title ?: "") }
}
notifyObservers { onTitleChange(title ?: "") }
}

override fun onPreviewImage(session: GeckoSession, previewImageUrl: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,69 @@ class GeckoEngineSessionTest {
verify(observer).onTitleChange("Mozilla")
}

@Test
fun `GIVEN an app initiated request WHEN the user swipe back or launches the browser THEN the tab should display the correct page`() = runTestOnMain {
val engineSession = GeckoEngineSession(
mock(),
geckoSessionProvider = geckoSessionProvider,
context = coroutineContext,
)

captureDelegates()

val historyTrackingDelegate: HistoryTrackingDelegate = mock()

var observedUrl = "https://www.google.com"
var observedTitle = "Google Search"
val emptyPageUrl = "https://example.com"

engineSession.register(object : EngineSession.Observer {
override fun onLocationChange(url: String) { observedUrl = url }
override fun onTitleChange(title: String) { observedTitle = title }
})
engineSession.settings.historyTrackingDelegate = historyTrackingDelegate
engineSession.appRedirectUrl = emptyPageUrl

class MockHistoryList(
items: List<GeckoSession.HistoryDelegate.HistoryItem>,
private val currentIndex: Int
) : ArrayList<GeckoSession.HistoryDelegate.HistoryItem>(items), GeckoSession.HistoryDelegate.HistoryList {
override fun getCurrentIndex() = currentIndex
}

fun mockHistoryItem(title: String?, uri: String): GeckoSession.HistoryDelegate.HistoryItem {
val item = mock<GeckoSession.HistoryDelegate.HistoryItem>()
whenever(item.title).thenReturn(title)
whenever(item.uri).thenReturn(uri)
return item
}

historyDelegate.value.onHistoryStateChange(mock(), MockHistoryList(emptyList(), 0))

historyDelegate.value.onHistoryStateChange(
mock(),
MockHistoryList(
listOf(
mockHistoryItem("Google Search", observedUrl),
mockHistoryItem("Moved", emptyPageUrl),
),
1
)
)

navigationDelegate.value.onLocationChange(geckoSession, emptyPageUrl, emptyList())
contentDelegate.value.onTitleChange(geckoSession, emptyPageUrl)

historyDelegate.value.onVisited(
geckoSession, emptyPageUrl, null,
9
)

verify(historyTrackingDelegate, never()).onVisited(eq(emptyPageUrl), any())
assertEquals("https://www.google.com", observedUrl)
assertEquals("Google Search", observedTitle)
}

@Test
fun `notifies configured history delegate of preview image URL changes`() = runTestOnMain {
val engineSession = GeckoEngineSession(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Text for the title of an alert dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_alert_title">La páxina en %1$s diz:</string>
<string name="mozac_browser_engine_system_alert_title">La páxina en «%1$s» diz:</string>
<!-- Text for the message of an auth dialog displayed by a web page.
%1$s will be replaced by the hostname or a description of the protected area/site, %2$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_message">«%2$s» solicita un nome d\'usuariu y una contraseña. El sitiu diz «%1$s»</string>
Expand Down
45 changes: 28 additions & 17 deletions components/browser/errorpages/src/main/res/values-ast/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:moz="http://mozac.org/tools">

<!-- The button that appears at the bottom of an error page. -->
<string name="mozac_browser_errorpages_page_refresh">Retentar</string>
Expand All @@ -15,8 +15,8 @@

<!-- The error message shown when a website sends back unusual and incorrect credentials for an SSL certificate. -->
<string name="mozac_browser_errorpages_security_ssl_message"><![CDATA[<ul>
<li>La páxina que tas tentando de ver nun pue amosase porque nun se pudo verificar l\'autenticidá de los datos recibíos.</li>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema, por favor.</li>
<li>Nun se pue amosar la páxina que tas tentando de ver porque nun se pudo verificar l\'autenticidá de los datos recibíos.</li>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema.</li>
</ul>]]></string>

<!-- The document title and heading of the error page shown when a website sends has an invalid or expired SSL certificate. -->
Expand All @@ -25,7 +25,7 @@
<!-- The error message shown when a website sends has an invalid or expired SSL certificate. -->
<string name="mozac_browser_errorpages_security_bad_cert_message"><![CDATA[<ul>
<li>Esto podría ser un problema cola configuración del sirvidor o que daquién tea tentando de suplantalu.</li>
<li>Si nel pasáu te conectesti con ésitu al sirvidor, el fallu quiciabes seya temporal polo que refresca la páxina dempués.</li>
<li>Si nel pasáu te conectesti correutamente al sirvidor, el fallu quiciabes seya temporal polo qu\'anueva la páxina dempués.</li>
</ul>]]></string>

<!-- The text shown inside the advanced button used to expand the advanced options. It's only shown when a website has an invalid SSL certificate. -->
Expand All @@ -39,13 +39,22 @@
<!-- The text shown inside the advanced options button used to bypass the invalid SSL certificate. It's only shown if the user has expanded the advanced options. -->
<string name="mozac_browser_errorpages_security_bad_cert_accept_temporary">Aceutar el riesgu y siguir</string>

<!-- The error message shown when a website uses HSTS. -->
<string name="mozac_browser_errorpages_security_bad_hsts_cert_message"><![CDATA[
<ul>
<li>Nun se pue amosar la páxina que tas tentando de ver porque esti sitiu web rique una conexón segura.</li>
<li>Ye mui probable que\'l problema seya del sitiu web y nun puedas facer nada pa igualu.</li>
<li>Pues avisar a l\'alministración del sitiu web pa informar del problema.</li>
</ul>
]]></string>

<!-- The document title and heading of the error page shown when the user's network connection is interrupted while connecting to a website. -->
<string name="mozac_browser_errorpages_net_interrupt_title">Torgóse la conexón</string>

<!-- The error message shown when the user's network connection is interrupted while connecting to a website. -->
<string name="mozac_browser_errorpages_net_interrupt_message"><![CDATA[<p>El restolador conectóse con ésitu mas la conexón torgóse mentanto se tresfería información. Volvi tentalo, por favor.</p>
<string name="mozac_browser_errorpages_net_interrupt_message"><![CDATA[<p>El restolador conectóse correutamente mas la conexón torgóse mentanto se tresfería información. Volvi tentalo.</p>
<ul>
<li>Seique\'l sitiu ta temporalmente non disponible o perocupáu. Volvi tentalo nun momentu.</li>
<li>Seique\'l sitiu ta temporalmente non disponible o perocupáu. Volvi probar nun momentu.</li>
<li>Si nun yes a cargar nenguna páxina, comprueba la conexón Wi-Fi o móvil del preséu.</li>
</ul>]]></string>

Expand Down Expand Up @@ -104,7 +113,7 @@
<string name="mozac_browser_errorpages_net_reset_title">Reanicióse la conexón</string>

<!-- The error message shown when the Internet connection is disrupted while loading a website. -->
<string name="mozac_browser_errorpages_net_reset_message"><![CDATA[<p>Torgóse l\'enllaz a la rede mentanto se negociaba una conexón. Volvi tentalo, por favor.</p>
<string name="mozac_browser_errorpages_net_reset_message"><![CDATA[<p>Torgóse l\'enllaz a la rede mentanto se negociaba una conexón. Volvi probar.</p>
<ul>
<li>Seique\'l sitiu tea temporalmente non disponible o perocupáu. Volvi tentalo nun momentu.</li>
<li>Si nun yes a cargar nenguna páxina, comprueba la conexón Wi-Fi o móvil del preséu.</li>
Expand All @@ -114,31 +123,31 @@
<string name="mozac_browser_errorpages_unsafe_content_type_title">El tipu de ficheru ye inseguru</string>
<!-- The error message shown when the browser refuses to load a type of file that is considered unsafe. -->
<string name="mozac_browser_errorpages_unsafe_content_type_message"><![CDATA[<ul>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema, por favor.</li>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema.</li>
</ul>]]></string>

<!-- The document title and heading of the error page shown when a file cannot be loaded because of a detected data corruption. -->
<string name="mozac_browser_errorpages_corrupted_content_title">Fallu de conteníu toyíu</string>
<!-- The error message shown when shown when a file cannot be loaded because of a detected data corruption. -->
<string name="mozac_browser_errorpages_corrupted_content_message"><![CDATA[<p>La páxina que tas tentando de ver nun pue amosase porque detectóse un fallu na tresmisión de los datos.</p>
<string name="mozac_browser_errorpages_corrupted_content_message"><![CDATA[<p>Nun se pue amosar la páxina que tas tentando de ver porque se detectó un fallu na tresmisión de los datos.</p>
<ul>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema, por favor.</li>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema.</li>
</ul>]]></string>

<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_content_crashed_title">Cascó\'l conteníu</string>

<string name="mozac_browser_errorpages_content_crashed_message"><![CDATA[<p>La páxina que tas tentando de ver nun pue amosase porque detectóse un fallu na tresmisión de los datos.</p>
<string name="mozac_browser_errorpages_content_crashed_message"><![CDATA[<p>Nun se pue amosar la páxina que tas tentando de ver porque se detectó un fallu na tresmisión de los datos.</p>
<ul>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema, por favor.</li>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema.</li>
</ul>]]></string>

<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_invalid_content_encoding_title">Fallu de la codificación del conteníu</string>

<string name="mozac_browser_errorpages_invalid_content_encoding_message"><![CDATA[<p>La páxina que tas tentando de ver nun pue amosase porque usa una forma de compresión que nun ye válida o nun se sofita.</p>
<string name="mozac_browser_errorpages_invalid_content_encoding_message"><![CDATA[<p>Nun se pue amosar la páxina que tas tentando de ver porque usa un tipu de compresión que nun ye válidu o compatible.</p>
<ul>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema, por favor.</li>
<li>Ponte en contautu colos propietarios del sitiu web pa informalos d\'esti problema.</li>
</ul>]]></string>

<!-- The document title and heading of an error page. -->
Expand All @@ -164,7 +173,7 @@

<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_malformed_uri_title">La direición nun ye válida</string>
<string name="mozac_browser_errorpages_malformed_uri_message"><![CDATA[<p>La direición apurrida nun ta nun formatu reconocíu. Comprueba si hai fallos na barra de direiciones y volvi a tentalo, por favor.</p>]]></string>
<string name="mozac_browser_errorpages_malformed_uri_message"><![CDATA[<p>La direición apurrida nun ta nun formatu reconocíu. Comprueba si hai fallos na barra de direiciones y volvi a tentalo.</p>]]></string>
<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_malformed_uri_title_alternative">La direición nun ye válida</string>

Expand Down Expand Up @@ -212,7 +221,7 @@
<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_unknown_proxy_host_title">Nun s\'atopó\'l sirvidor del proxy</string>

<string name="mozac_browser_errorpages_unknown_proxy_host_message"><![CDATA[<p>El restolador ta configuráu pa usar un sirvidor proxy mas nun pudo atopase.</p>
<string name="mozac_browser_errorpages_unknown_proxy_host_message"><![CDATA[<p>El restolador ta configuráu pa usar un sirvidor proxy mas nun se pudo atopar.</p>
<ul>
<li>¿La configuración del proxy del restolador ye correuta? Comprueba los axustes y volvi tentalo.</li>
<li>¿El preséu ta conectáu a una rede activa?</li>
Expand Down Expand Up @@ -241,4 +250,6 @@

<!-- The title of the error page for websites that do not support HTTPS when HTTPS-Only is turned on -->
<string name="mozac_browser_errorpages_httpsonly_title">El sitiu seguru nun ta disponible</string>
</resources>
<!-- Button on error page for websites that do not support HTTPS when HTTPS-Only is turned on. Clicking the button allows the user to nevertheless load the website using HTTP. -->
<string name="mozac_browser_errorpages_httpsonly_button">Siguir col sitiu HTTP</string>
</resources>
Loading

0 comments on commit 3696994

Please sign in to comment.