Bug 1951985 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

GeckoView is not respecting the distinction between “default” and “user” Gecko prefs when set via RuntimeSettings because the pref is reset on startup.

The goal of this bug is to research and possibly implement a solution to this issue. It is possibly relevant because depending on how we save information to rollback on Nimbus, the distinction could be very important.

[Full results of determining this bug may be found here.](https://docs.google.com/document/d/1OKepjYuG40M16cWyGxvjqO8cJt7fL03CIvkEKu9Asyc/edit?tab=t.0)

Abbreviated summary of results:

#### Pref Set by GeckoView as PrefWithoutDefault

**Tested:** [dom.security.https\_only\_mode\_pbm](https://searchfox.org/mozilla-central/rev/13d864c116029fe5d067d589005f49c1c46f74b5/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java#655)  
**Init:**

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): false  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): false  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false

**After change in about:config:** 

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): true  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false


**After hard close / reopen:**

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): **false** <-- should be true  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): **false** <-- notice pref didn't change  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false

It is because `allowInsecureConnections` is clobbering the value at startup through `httpsOnlyMode` [here](https://searchfox.org/mozilla-central/rev/9c395b6371eaea0d15f9c8a37889022be350cf0b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt#165). It is [stored in Fenix here](https://searchfox.org/mozilla-central/rev/9c395b6371eaea0d15f9c8a37889022be350cf0b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt#1876). This pattern is common on Fenix.
GeckoView is not respecting the distinction between “default” and “user” Gecko prefs when set via RuntimeSettings because the pref is reset on startup.

The goal of this bug is to research and possibly implement a solution to this issue. It is possibly relevant because depending on how we save information to rollback on Nimbus, the distinction could be very important.

[Full results of determining this bug may be found here.](https://docs.google.com/document/d/1OKepjYuG40M16cWyGxvjqO8cJt7fL03CIvkEKu9Asyc/edit?tab=t.0#heading=h.8cy7bau525nc)

Abbreviated summary of results:

#### Pref Set by GeckoView as PrefWithoutDefault

**Tested:** [dom.security.https\_only\_mode\_pbm](https://searchfox.org/mozilla-central/rev/13d864c116029fe5d067d589005f49c1c46f74b5/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java#655)  
**Init:**

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): false  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): false  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false

**After change in about:config:** 

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): true  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false


**After hard close / reopen:**

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): **false** <-- should be true  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): **false** <-- notice pref didn't change  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false

It is because `allowInsecureConnections` is clobbering the value at startup through `httpsOnlyMode` [here](https://searchfox.org/mozilla-central/rev/9c395b6371eaea0d15f9c8a37889022be350cf0b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt#165). It is [stored in Fenix here](https://searchfox.org/mozilla-central/rev/9c395b6371eaea0d15f9c8a37889022be350cf0b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt#1876). This pattern is common on Fenix.
GeckoView is not respecting the distinction between “default” and “user” Gecko prefs when set via RuntimeSettings because the pref is reset on startup.

The goal of this bug is to research and possibly implement a solution to this issue. It is possibly relevant because depending on how we save information to rollback on Nimbus, the distinction could be very important.

[Full results of determining this bug may be found here.](https://docs.google.com/document/d/1OKepjYuG40M16cWyGxvjqO8cJt7fL03CIvkEKu9Asyc/edit?tab=t.0#heading=h.8cy7bau525nc)

Abbreviated summary of results:

#### Pref Set by GeckoView as PrefWithoutDefault

**Tested:** [dom.security.https\_only\_mode\_pbm](https://searchfox.org/mozilla-central/rev/13d864c116029fe5d067d589005f49c1c46f74b5/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java#655)  
**Init:**

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): false  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): false  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false

**After change in about:config:** 

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): true  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false


**After hard close / reopen:**

* Services.prefs.prefHasUserValue(dom.security.https\_only\_mode\_pbm): **false** <-- should be true  
* Services.prefs.prefHasDefaultValue(dom.security.https\_only\_mode\_pbm): true  
* Services.prefs.getBoolPref(dom.security.https\_only\_mode\_pbm): **false** <-- notice pref didn't change  
* defaultBranch.getBoolPref(dom.security.https\_only\_mode\_pbm): false

It is because `allowInsecureConnections` is clobbering the value at startup through `httpsOnlyMode` [here](https://searchfox.org/mozilla-central/rev/9c395b6371eaea0d15f9c8a37889022be350cf0b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt#165). It is [stored in Fenix here](https://searchfox.org/mozilla-central/rev/9c395b6371eaea0d15f9c8a37889022be350cf0b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt#1876). This pattern is common on Fenix.

`Pref` (in comparison to `PrefWithoutDefault`) might even have a bigger problem where it states a "user" pref is a "default" due to the way Fenix is setting them.

Back to Bug 1951985 Comment 0