web: stop re-doing load work on every recomposition and request (#speed)
- Commit
e94141f6d9394dd5c414d484738314b2f091a0f4- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-16 17:23 UTC (19 days ago)
- Parents
bf24ba0
Pages paid for the same work many times per load. AndroidView's update block re-applied every WebView setting (default-UA lookup, cookie manager, geolocation path, reflective Safe Browsing probe) and rebuilt the ~10 KB farbling document-start script just to find it unchanged, on every progress/title/URL recomposition. Settings and farbling are now applied only when a WebViewSettingsSpec / FarblingConfig actually changes, the default UA and the Safe Browsing support check are cached process-wide, and the duplicate settings application after pool registration is gone. On the request path, every subresource resolved EffectiveShields and, while the engine was still loading, classified its resource type and copied its headers for a ShieldsEngine.check that could only return null. RequestGate (new, pure domain) pins the skip conditions, HostShieldsCache memoises the per-host shields for a page load, and the type/header work now happens only when the engine can actually block. Blocking semantics are unchanged. onPageFinished drew the whole WebView into a thumbnail bitmap on the main thread at the moment the page became usable, and ran two evaluateJavascript probes (one walking all of localStorage) on every finish including reloads. The thumbnail draw is removed from the finish path (thumbnails are already captured when a tab leaves the foreground or the switcher opens, the only moments a tile is visible), and OriginProbeGate probes once per origin change per tab. Pooled WebViews are now onPause()d when their composition leaves, so background tabs stop competing with the foreground load, and resumed on reuse. Tests: RequestGateTest pins the gate matrix, the single-entry host cache and the probe gate; WebViewClientsAndPwaTest pins that the settings spec only moves when an applied input does. Verified: :web:testDevUnitTest (RequestGateTest, WebViewClientsAndPwaTest) green.
Diff
web/src/main/java/com/vayunmathur/web/domain/shields/RequestGate.kt
diff --git a/web/src/main/java/com/vayunmathur/web/domain/shields/RequestGate.kt b/web/src/main/java/com/vayunmathur/web/domain/shields/RequestGate.ktnew file mode 100644index 0000000000..44eeaf475b--- /dev/null+++ b/web/src/main/java/com/vayunmathur/web/domain/shields/RequestGate.kt@@ -0,0 +1,86 @@+package com.vayunmathur.web.domain.shields++import com.vayunmathur.web.domain.EffectiveShields++/**+ * Pure decisions on the subresource request path, kept free of `android.*`+ * so the hot-path policy is unit-testable on the JVM.+ *+ * `shouldInterceptRequest` fires once per subresource (tens to hundreds+ * per page) on a WebView background thread. Everything reachable from it+ * either blocks the request's network fetch or stalls that thread, so+ * the cheap exits must come first and in this order.+ */+object RequestGate {++ /** Only web schemes can be tracker requests; `data:`/`blob:`/`file:` etc. never reach the engine. */+ fun isWebScheme(scheme: String?): Boolean = scheme == "http" || scheme == "https"++ /**+ * Whether the shields engine must be consulted for one request.+ *+ * Main-frame documents are never shield-blocked (only rewritten), a+ * site with tracker blocking off has nothing to ask, and a not-yet-+ * loaded engine answers null ("allow") anyway โ asking it would pay+ * the host-resolution, resource-type and header work for a guaranteed+ * null. All three conditions are exactly the cases in which the+ * engine call cannot change the outcome.+ */+ fun shouldShieldCheck(+ scheme: String?,+ isMainFrame: Boolean,+ engineReady: Boolean,+ blockTrackers: Boolean,+ ): Boolean = isWebScheme(scheme) && !isMainFrame && engineReady && blockTrackers+}++/**+ * Single-entry memo of the resolved shields for the page being loaded.+ *+ * Resolving [EffectiveShields] allocates and reads a concurrent map;+ * doing it per subresource repeats the same answer hundreds of times+ * for one page. Keyed by page host only: a new host re-resolves, and+ * [invalidate] drops the entry when the owner knows settings changed+ * (the shields panel reloads the page after any edit, which re-enters+ * through a fresh page host or an explicit invalidate).+ */+class HostShieldsCache(+ private val resolve: (host: String) -> EffectiveShields,+) {+ private var cachedHost: String? = null+ private var cached: EffectiveShields? = null++ fun forHost(host: String): EffectiveShields {+ cached?.let { if (cachedHost == host) return it }+ val resolved = resolve(host)+ cachedHost = host+ cached = resolved+ return resolved+ }++ fun invalidate() {+ cachedHost = null+ cached = null+ }+}++/**+ * Gates the two JavaScript probes (storage footprint, PWA manifest)+ * that run when a page finishes loading.+ *+ * Each probe is a full `evaluateJavascript` round trip that walks the+ * page's storage, and `onPageFinished` also fires for reloads and+ * redirect-chain finishes of the same origin, where the answer cannot+ * have changed enough to matter. Probing once per origin change keeps+ * the first visit to each site exact and drops the repeats.+ */+class OriginProbeGate {+ private var lastProbedOrigin: String? = null++ /** True the first time [origin] is seen, and again only after a different origin was probed. */+ fun shouldProbe(origin: String): Boolean {+ if (origin.isBlank() || origin == lastProbedOrigin) return false+ lastProbedOrigin = origin+ return true+ }+}
web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsRequestFilter.kt
diff --git a/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsRequestFilter.kt b/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsRequestFilter.ktindex 83bc85ece1..f6b4aede8d 100644--- a/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsRequestFilter.kt+++ b/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsRequestFilter.kt@@ -10,6 +10,7 @@ import com.vayunmathur.web.R import com.vayunmathur.web.domain.EffectiveShields import com.vayunmathur.web.domain.LanPolicy import com.vayunmathur.web.domain.LocalNetwork+import com.vayunmathur.web.domain.shields.RequestGate import com.vayunmathur.web.domain.shields.ResourceTypes import java.io.ByteArrayInputStream import java.util.Base64@@ -57,7 +58,7 @@ object ShieldsRequestFilter { cleartextBlockResponse(context, request, scheme)?.let { return it } if (request.isForMainFrame) return null- return shieldBlockResponse(request, url, pageUrl, shieldsFor, onBlocked)+ return shieldBlockResponse(request, url, pageUrl, shieldsFor, onBlocked, scheme) } /** Non-null when a cleartext request targets a host the LAN policy forbids. */@@ -88,10 +89,16 @@ object ShieldsRequestFilter { pageUrl: String, shieldsFor: (host: String) -> EffectiveShields, onBlocked: (pageUrl: String, blockedUrl: String) -> Unit,+ scheme: String?, ): WebResourceResponse? { val source = pageUrl.ifEmpty { url } val shields = shieldsFor(hostOf(source))- if (!shields.blockTrackers) return null+ // The gate is checked before touching requestHeaders / ResourceTypes:+ // with the engine still loading, ShieldsEngine.check can only return+ // null, so classifying the resource would be pure waste per request.+ if (!RequestGate.shouldShieldCheck(scheme, false, ShieldsEngine.ready, shields.blockTrackers)) {+ return null+ } val type = ResourceTypes.of(url, isMainFrame = false, headers = request.requestHeaders) val result = ShieldsEngine.check(url, source, type) ?: return null
web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsWebViewClient.kt
diff --git a/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsWebViewClient.kt b/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsWebViewClient.ktindex 9e7125d134..11ae0dd981 100644--- a/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsWebViewClient.kt+++ b/web/src/main/java/com/vayunmathur/web/platform/shields/ShieldsWebViewClient.kt@@ -14,6 +14,7 @@ import androidx.webkit.WebMessageCompat import androidx.webkit.WebViewCompat import androidx.webkit.WebViewFeature import com.vayunmathur.web.domain.EffectiveShields+import com.vayunmathur.web.domain.shields.HostShieldsCache import com.vayunmathur.web.domain.shields.ResourceTypes import com.vayunmathur.web.domain.shields.UrlCleaner import com.vayunmathur.web.platform.AdultSites@@ -61,6 +62,13 @@ open class ShieldsWebViewClient( @Volatile private var pageUrl: String = "" + /**+ * Resolved shields for [pageUrl]'s host, memoised for the page load.+ * Every subresource of a page shares its host's shields, so resolving+ * per request only repeats one answer; a new page host re-resolves.+ */+ private val shieldsCache = HostShieldsCache(shieldsFor)+ /** Per-session salt; combined with the site's host it gives Brave's per-origin seed. */ private val sessionSalt: Int = Random.nextInt() @@ -99,7 +107,7 @@ open class ShieldsWebViewClient( pageUrl = request.url.toString() blockedByContentFilter(request)?.let { return it } }- return ShieldsRequestFilter.intercept(context, request, pageUrl, shieldsFor, onBlocked)+ return ShieldsRequestFilter.intercept(context, request, pageUrl, shieldsCache::forHost, onBlocked) } /**
web/src/main/java/com/vayunmathur/web/ui/WebViewBrowser.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/WebViewBrowser.kt b/web/src/main/java/com/vayunmathur/web/ui/WebViewBrowser.ktindex 3040ada3ed..5a91bf6e20 100644--- a/web/src/main/java/com/vayunmathur/web/ui/WebViewBrowser.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/WebViewBrowser.kt@@ -149,7 +149,17 @@ fun WebViewBrowser( factory = { ctx -> webViewPool[tabId]?.let { existing -> (existing.parent as? ViewGroup)?.removeView(existing)- applyWebViewSettings(existing, viewModel)+ existing.onResume()+ val spec = webViewSettingsSpec(viewModel)+ if (holder.lastSettingsSpec != spec) {+ applyWebViewSettings(existing, viewModel)+ holder.lastSettingsSpec = spec+ }+ if (holder.lastFarblingConfig != farblingConfig) {+ (existing.webViewClient as? ShieldsWebViewClient)+ ?.installFarbling(existing, farblingConfig)+ holder.lastFarblingConfig = farblingConfig+ } existing.setOnLongClickListener { val hit = existing.hitTestResult val url = linkUrlFromHitTest(hit?.type, hit?.extra)@@ -231,7 +241,12 @@ fun WebViewBrowser( loadUrl(if (BrowserUtils.canLoadInWebView(toLoad)) toLoad else "about:blank") }.also { webViewPool[tabId] = it- applyWebViewSettings(it, viewModel)+ // Settings were already applied inside the factory above; the+ // second application the pool registration used to do was+ // pure main-thread repetition.+ holder.lastSettingsSpec = webViewSettingsSpec(viewModel)+ holder.lastFarblingConfig = farblingConfig+ holder.webView = it } }, update = { webView ->@@ -249,9 +264,20 @@ fun WebViewBrowser( webView.loadUrl(desired) } }- applyWebViewSettings(webView, viewModel)- (webView.webViewClient as? ShieldsWebViewClient)- ?.installFarbling(webView, farblingConfig)+ // Recomposition fires for progress/title/URL changes all through+ // a load. Neither the settings nor the farbling script (a ~10 KB+ // string rebuilt to compare equal) may be re-applied for those;+ // only a real input change earns that main-thread work.+ val spec = webViewSettingsSpec(viewModel)+ if (holder.lastSettingsSpec != spec) {+ applyWebViewSettings(webView, viewModel)+ holder.lastSettingsSpec = spec+ }+ if (holder.lastFarblingConfig != farblingConfig) {+ (webView.webViewClient as? ShieldsWebViewClient)+ ?.installFarbling(webView, farblingConfig)+ holder.lastFarblingConfig = farblingConfig+ } // Keep the long-press handler in sync after pool reuse / recomposition webView.setOnLongClickListener { val hit = webView.hitTestResult@@ -266,7 +292,19 @@ fun WebViewBrowser( } ) - DisposableEffect(tabId) { onDispose { } }+ DisposableEffect(tabId) {+ onDispose {+ // The pooled WebView stays alive for a fast tab switch, but a+ // detached page must not keep running timers/rendering: that+ // CPU competes directly with the foreground page's load.+ // The factory branch resumes it on reuse.+ holder.webView?.onPause()+ }+ } } -private class WebViewHolder { var webView: WebView? = null }+private class WebViewHolder {+ var webView: WebView? = null+ var lastSettingsSpec: WebViewSettingsSpec? = null+ var lastFarblingConfig: FarblingConfig? = null+}
web/src/main/java/com/vayunmathur/web/ui/WebViewClients.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/WebViewClients.kt b/web/src/main/java/com/vayunmathur/web/ui/WebViewClients.ktindex cf1e327e9c..a6df775389 100644--- a/web/src/main/java/com/vayunmathur/web/ui/WebViewClients.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/WebViewClients.kt@@ -35,6 +35,7 @@ import com.vayunmathur.web.platform.requestFileChooser import com.vayunmathur.web.platform.requestGeolocation import com.vayunmathur.web.platform.requestWebPermission import com.vayunmathur.web.platform.resetBlockedCount+import com.vayunmathur.web.domain.shields.OriginProbeGate import com.vayunmathur.web.platform.shields.ShieldsWebViewClient import com.vayunmathur.web.platform.shieldsFor @@ -68,6 +69,9 @@ internal fun createBrowserWebViewClient( view.loadUrl(rewritten) }, ) {+ /** One probe per origin change for this tab; reloads of one origin do not re-probe. */+ private val probeGate = OriginProbeGate()+ override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { val scheme = request.url.scheme ?: return false if (scheme !in setOf("about", "data", "blob", "javascript") && !BrowserUtils.isWebScheme(scheme)) {@@ -107,7 +111,12 @@ internal fun createBrowserWebViewClient( viewModel.recordHistoryVisit(url ?: "", title, isPrivateTab) } url?.let { u ->- if (BrowserUtils.isWebUrl(u)) {+ // Both JS probes are a full evaluateJavascript round trip (the+ // storage one walks every localStorage entry). They only earn+ // that on the first finish for an origin: reloads and redirect+ // finishes of the same origin cannot change the answers enough+ // to matter, and this callback is on the load critical path.+ if (BrowserUtils.isWebUrl(u) && probeGate.shouldProbe(BrowserUtils.originFromUrl(u))) { runCatching { val origin = BrowserUtils.originFromUrl(u) val cookies = CookieManager.getInstance().getCookie(u)@@ -130,7 +139,11 @@ internal fun createBrowserWebViewClient( } } }- viewModel.captureThumbnail(tabId, view)+ // No thumbnail here: drawing the WebView into a bitmap is a main-+ // thread raster taken at the exact moment the page becomes usable.+ // Thumbnails are captured when the tab actually leaves the+ // foreground (tab switch, switcher opening), which is the only+ // moment a tile can be seen. } override fun doUpdateVisitedHistory(view: WebView, url: String?, isReload: Boolean) {
web/src/main/java/com/vayunmathur/web/ui/WebViewSettings.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/WebViewSettings.kt b/web/src/main/java/com/vayunmathur/web/ui/WebViewSettings.ktindex 766077626d..5b9939205a 100644--- a/web/src/main/java/com/vayunmathur/web/ui/WebViewSettings.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/WebViewSettings.kt@@ -23,6 +23,51 @@ internal fun WebSettings.applySystemDarkMode() { } } +/**+ * The inputs [applyWebViewSettings] actually reads. Recomposition during+ * a load (progress, title, URL, blocked count) used to re-apply every+ * setting โ a default-user-agent lookup, a cookie-manager call, a+ * geolocation-path call and a reflective Safe Browsing probe โ on the+ * main thread, several times per page. Callers compare specs and only+ * re-apply when one of these values changed.+ */+internal data class WebViewSettingsSpec(+ val jsEnabled: Boolean,+ val cacheMode: Int,+ val desktopMode: Boolean,+ val blockThirdPartyCookies: Boolean,+ val httpsOnly: Boolean,+)++internal fun webViewSettingsSpec(viewModel: WebViewModel): WebViewSettingsSpec {+ val globalShields = com.vayunmathur.web.domain.EffectiveShields.resolve(viewModel.shields)+ return WebViewSettingsSpec(+ jsEnabled = viewModel.jsEnabled,+ cacheMode = viewModel.cacheMode.webSettingsValue,+ desktopMode = viewModel.desktopMode,+ blockThirdPartyCookies = viewModel.blockThirdPartyCookies,+ httpsOnly = globalShields.httpsOnly,+ )+}++/** Process-wide: the default UA is a system string, identical for every WebView in the process. */+@Volatile+private var cachedDefaultUserAgent: String? = null++private fun defaultUserAgent(context: android.content.Context): String =+ cachedDefaultUserAgent ?: WebSettings.getDefaultUserAgent(context).also { cachedDefaultUserAgent = it }++/** Process-wide: Safe Browsing support is a property of the installed WebView, not of a page. */+@Volatile+private var safeBrowsingSupported: Boolean? = null++private fun applySafeBrowsing(settings: WebSettings) {+ val supported = safeBrowsingSupported ?: runCatching {+ WebViewFeature.isFeatureSupported(WebViewFeature.SAFE_BROWSING_ENABLE)+ }.getOrDefault(false).also { safeBrowsingSupported = it }+ if (supported) runCatching { WebSettingsCompat.setSafeBrowsingEnabled(settings, true) }+}+ internal fun applyWebViewSettings(webView: WebView, viewModel: WebViewModel) { val settings = webView.settings @@ -73,23 +118,14 @@ internal fun applyWebViewSettings(webView: WebView, viewModel: WebViewModel) { settings.userAgentString = if (viewModel.desktopMode) { "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" } else {- WebSettings.getDefaultUserAgent(webView.context)+ defaultUserAgent(webView.context) } settings.mediaPlaybackRequiresUserGesture = false settings.applySystemDarkMode() - // Safe browsing- try {- val compat = Class.forName("androidx.webkit.WebSettingsCompat")- val feature = Class.forName("androidx.webkit.WebViewFeature")- val isSupported = feature.getMethod("isFeatureSupported", String::class.java).invoke(null, "SAFE_BROWSING_ENABLE") as Boolean- if (isSupported) {- compat.getMethod("setSafeBrowsingEnabled", WebSettings::class.java, Boolean::class.javaPrimitiveType)- .invoke(null, settings, true)- }- } catch (_: Exception) {}+ applySafeBrowsing(settings) } internal fun WebView.evalJsForStorageInfo(origin: String, cookieCount: Int, vm: WebViewModel) {
web/src/test/java/com/vayunmathur/web/domain/shields/RequestGateTest.kt
diff --git a/web/src/test/java/com/vayunmathur/web/domain/shields/RequestGateTest.kt b/web/src/test/java/com/vayunmathur/web/domain/shields/RequestGateTest.ktnew file mode 100644index 0000000000..733c939114--- /dev/null+++ b/web/src/test/java/com/vayunmathur/web/domain/shields/RequestGateTest.kt@@ -0,0 +1,91 @@+package com.vayunmathur.web.domain.shields++import com.vayunmathur.web.domain.EffectiveShields+import com.vayunmathur.web.domain.ShieldLevel+import com.vayunmathur.web.domain.ShieldsSettings+import kotlin.test.Test+import kotlin.test.assertEquals+import kotlin.test.assertFalse+import kotlin.test.assertSame+import kotlin.test.assertTrue++/** Pins the hot-path policy: what may skip the shields engine, and what must not. */+class RequestGateTest {++ @Test fun webSchemesAreOnlyHttpAndHttps() {+ assertTrue(RequestGate.isWebScheme("http"))+ assertTrue(RequestGate.isWebScheme("https"))+ assertFalse(RequestGate.isWebScheme("data"))+ assertFalse(RequestGate.isWebScheme("blob"))+ assertFalse(RequestGate.isWebScheme("file"))+ assertFalse(RequestGate.isWebScheme(null))+ }++ @Test fun shieldCheckRunsForSubresourceWhenEngineReadyAndBlockingOn() {+ assertTrue(RequestGate.shouldShieldCheck("https", isMainFrame = false, engineReady = true, blockTrackers = true))+ assertTrue(RequestGate.shouldShieldCheck("http", isMainFrame = false, engineReady = true, blockTrackers = true))+ }++ @Test fun shieldCheckSkippedWhenItCannotChangeTheOutcome() {+ // Main-frame documents are rewritten, never shield-blocked.+ assertFalse(RequestGate.shouldShieldCheck("https", isMainFrame = true, engineReady = true, blockTrackers = true))+ // Engine not loaded yet: check() can only answer null ("allow").+ assertFalse(RequestGate.shouldShieldCheck("https", isMainFrame = false, engineReady = false, blockTrackers = true))+ // Tracker blocking off for the site: nothing to ask.+ assertFalse(RequestGate.shouldShieldCheck("https", isMainFrame = false, engineReady = true, blockTrackers = false))+ // Non-web schemes never reach the engine.+ assertFalse(RequestGate.shouldShieldCheck("data", isMainFrame = false, engineReady = true, blockTrackers = true))+ assertFalse(RequestGate.shouldShieldCheck(null, isMainFrame = false, engineReady = true, blockTrackers = true))+ }++ @Test fun hostShieldsCacheResolvesOncePerHost() {+ var calls = 0+ val cache = HostShieldsCache { host ->+ calls+++ EffectiveShields.resolve(ShieldsSettings.AGGRESSIVE_DEFAULTS, null)+ .also { assertTrue(host.isNotEmpty()) }+ }+ val first = cache.forHost("example.com")+ val second = cache.forHost("example.com")+ assertSame(first, second)+ assertEquals(1, calls)++ cache.forHost("other.example")+ assertEquals(2, calls)+ // Single-entry: returning to the first host re-resolves (still correct, just not memoised).+ cache.forHost("example.com")+ assertEquals(3, calls)+ }++ @Test fun hostShieldsCacheInvalidateForcesReResolve() {+ var calls = 0+ val cache = HostShieldsCache {+ calls+++ EffectiveShields.resolve(ShieldsSettings(level = ShieldLevel.OFF), null)+ }+ cache.forHost("example.com")+ cache.invalidate()+ cache.forHost("example.com")+ assertEquals(2, calls)+ }++ @Test fun originProbeGateProbesOncePerOriginChange() {+ val gate = OriginProbeGate()+ assertTrue(gate.shouldProbe("https://example.com"))+ // Reloads / redirect finishes of the same origin are not re-probed.+ assertFalse(gate.shouldProbe("https://example.com"))+ assertFalse(gate.shouldProbe("https://example.com"))+ // A different origin earns a fresh probe...+ assertTrue(gate.shouldProbe("https://other.example"))+ assertFalse(gate.shouldProbe("https://other.example"))+ // ...and coming back re-probes, since storage may have changed meanwhile.+ assertTrue(gate.shouldProbe("https://example.com"))+ }++ @Test fun originProbeGateIgnoresBlankOrigins() {+ val gate = OriginProbeGate()+ assertFalse(gate.shouldProbe(""))+ assertFalse(gate.shouldProbe(" "))+ assertTrue(gate.shouldProbe("https://example.com"))+ }+}
web/src/test/java/com/vayunmathur/web/ui/WebViewClientsAndPwaTest.kt
diff --git a/web/src/test/java/com/vayunmathur/web/ui/WebViewClientsAndPwaTest.kt b/web/src/test/java/com/vayunmathur/web/ui/WebViewClientsAndPwaTest.ktindex 6cc4825bf7..233bf5be26 100644--- a/web/src/test/java/com/vayunmathur/web/ui/WebViewClientsAndPwaTest.kt+++ b/web/src/test/java/com/vayunmathur/web/ui/WebViewClientsAndPwaTest.kt@@ -161,6 +161,19 @@ class WebViewClientsAndPwaTest { controller.pause().stop().destroy() } + @Test fun settingsSpecChangesOnlyWhenAnAppliedInputChanges() {+ val v = vm()+ val before = webViewSettingsSpec(v)+ // Stable while nothing the settings read has changed: recomposition+ // alone must not re-apply WebView settings.+ kotlin.test.assertEquals(before, webViewSettingsSpec(v))+ v.desktopMode = true+ kotlin.test.assertNotEquals(before, webViewSettingsSpec(v))+ val desktop = webViewSettingsSpec(v)+ v.jsEnabled = false+ kotlin.test.assertNotEquals(desktop, webViewSettingsSpec(v))+ }+ @Test fun pwaActivityWithoutUrlShowsEmptyShell() { val controller = Robolectric.buildActivity(PwaActivity::class.java, Intent(context, PwaActivity::class.java)) val activity = controller.create().start().resume().get()