mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-09 19:10:42 +00:00
Closes #24407: Allow query parameters in AMO installation URLs
This commit is contained in:
parent
600541efb6
commit
8b595fa30c
@ -92,7 +92,7 @@ class AppRequestInterceptor(
|
||||
if (hasUserGesture && isSameDomain && uri.startsWith(AMO_BASE_URL)) {
|
||||
|
||||
// Check if this is a request to install an add-on.
|
||||
val matchResult = AMO_INSTALL_URL_REGEX.toRegex().matchEntire(uri)
|
||||
val matchResult = AMO_INSTALL_URL_REGEX.toRegex().find(uri)
|
||||
if (matchResult != null) {
|
||||
|
||||
// Navigate and trigger add-on installation.
|
||||
|
@ -64,6 +64,24 @@ class AppRequestInterceptorTest {
|
||||
assertEquals(RequestInterceptor.InterceptionResponse.Deny, result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN valid request to install add-on WHEN url is provided with query parameters THEN start add-on installation`() {
|
||||
val addonId = "12345678"
|
||||
val result = interceptor.onLoadRequest(
|
||||
engineSession = mockk(),
|
||||
uri = "https://addons.mozilla.org/android/downloads/file/$addonId/test.xpi?queryParam=test",
|
||||
lastUri = "https://addons.mozilla.org/en-US/firefox/",
|
||||
hasUserGesture = true,
|
||||
isSameDomain = true,
|
||||
isDirectNavigation = false,
|
||||
isRedirect = false,
|
||||
isSubframeRequest = false
|
||||
)
|
||||
|
||||
verify { navigationController.navigate(NavGraphDirections.actionGlobalAddonsManagementFragment(addonId)) }
|
||||
assertEquals(RequestInterceptor.InterceptionResponse.Deny, result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN request to install add-on WHEN on a different domain THEN no add-on installation is started`() {
|
||||
every { testContext.components.services } returns Services(testContext, mockk(relaxed = true))
|
||||
|
Loading…
Reference in New Issue
Block a user