Bug 1850006 - conservative flag limits to mozilla services only

fenix/124.1.0
jackyzy823 10 months ago committed by mergify[bot]
parent 0251620c54
commit e58d0ae973

@ -21,7 +21,7 @@ suspend fun Client.bitmapForUrl(url: String): Bitmap? = withContext(Dispatchers.
// Code below will cache it in Gecko's cache, which ensures that as long as we've fetched it once,
// we will be able to display this avatar as long as the cache isn't purged (e.g. via 'clear user data').
val body = try {
fetch(Request(url, useCaches = true)).body
fetch(Request(url, useCaches = true, conservative = true)).body
} catch (e: IOException) {
return@withContext null
}

@ -133,6 +133,7 @@ object ProfilerUtils {
"Accept" to PROFILER_SERVER_HEADER,
),
body = Request.Body.fromFile(outputFile),
conservative = true,
)
return context.components.core.client.fetch(request)
}

@ -73,6 +73,7 @@ class WallpaperDownloader(
val request = Request(
url = "$remoteHost/$remotePath",
method = Request.Method.GET,
conservative = true,
)
return@withContext Result.runCatching {

@ -32,7 +32,7 @@ class WallpaperMetadataFetcher(
*/
suspend fun downloadWallpaperList(): List<Wallpaper> = withContext(Dispatchers.IO) {
Result.runCatching {
val request = Request(url = metadataUrl, method = Request.Method.GET)
val request = Request(url = metadataUrl, method = Request.Method.GET, conservative = true)
val response = client.fetch(request)
response.body.useBufferedReader {
val json = it.readText()

@ -141,5 +141,6 @@ class WallpaperDownloaderTest {
private fun Wallpaper.generateRequest(type: String) = Request(
url = "$remoteHost/${collection.name}/$name/$type.png",
method = Request.Method.GET,
conservative = true,
)
}

@ -29,6 +29,7 @@ class WallpaperMetadataFetcherTest {
url = BuildConfig.WALLPAPER_URL.substringBefore("android") +
"metadata/v$currentJsonVersion/wallpapers.json",
method = Request.Method.GET,
conservative = true,
)
private val mockResponse = mockk<Response>()
private val mockClient = mockk<Client> {

Loading…
Cancel
Save