M6 fix: tracking protection via ContentBlocking (old TrackingProtectionPolicy API removed in GV 147)
Browse files
app/src/main/java/dev/nova/browser/BrowserActivity.kt
CHANGED
|
@@ -17,6 +17,7 @@ import androidx.compose.ui.platform.LocalFocusManager
|
|
| 17 |
import androidx.compose.ui.text.style.TextOverflow
|
| 18 |
import androidx.compose.ui.unit.dp
|
| 19 |
import androidx.compose.ui.viewinterop.AndroidView
|
|
|
|
| 20 |
import org.mozilla.geckoview.GeckoResult
|
| 21 |
import org.mozilla.geckoview.GeckoRuntime
|
| 22 |
import org.mozilla.geckoview.GeckoRuntimeSettings
|
|
@@ -38,12 +39,18 @@ class BrowserActivity : ComponentActivity() {
|
|
| 38 |
super.onCreate(savedInstanceState)
|
| 39 |
|
| 40 |
if (runtime == null) {
|
| 41 |
-
// M6:
|
| 42 |
-
//
|
|
|
|
| 43 |
runtime = GeckoRuntime.create(
|
| 44 |
this,
|
| 45 |
GeckoRuntimeSettings.Builder()
|
| 46 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
.build()
|
| 48 |
)
|
| 49 |
// Layer 2 of the dev console: desktop Firefox DevTools can attach
|
|
|
|
| 17 |
import androidx.compose.ui.text.style.TextOverflow
|
| 18 |
import androidx.compose.ui.unit.dp
|
| 19 |
import androidx.compose.ui.viewinterop.AndroidView
|
| 20 |
+
import org.mozilla.geckoview.ContentBlocking
|
| 21 |
import org.mozilla.geckoview.GeckoResult
|
| 22 |
import org.mozilla.geckoview.GeckoRuntime
|
| 23 |
import org.mozilla.geckoview.GeckoRuntimeSettings
|
|
|
|
| 39 |
super.onCreate(savedInstanceState)
|
| 40 |
|
| 41 |
if (runtime == null) {
|
| 42 |
+
// M6: content blocking (tracking protection) at the runtime level.
|
| 43 |
+
// NB: the old GeckoSession.TrackingProtectionPolicy API is gone in
|
| 44 |
+
// current GV; the modern API is ContentBlocking settings.
|
| 45 |
runtime = GeckoRuntime.create(
|
| 46 |
this,
|
| 47 |
GeckoRuntimeSettings.Builder()
|
| 48 |
+
.contentBlocking(
|
| 49 |
+
ContentBlocking.Settings.Builder()
|
| 50 |
+
.antiTracking(ContentBlocking.AntiTracking.RECOMMENDED)
|
| 51 |
+
.cookieBehavior(ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS)
|
| 52 |
+
.build()
|
| 53 |
+
)
|
| 54 |
.build()
|
| 55 |
)
|
| 56 |
// Layer 2 of the dev console: desktop Firefox DevTools can attach
|