Locking a preference doesn't affect the value, it just locks the preference to the user. Obviously any extension could unlock a preference and do what they want with that value.
Locking preferences is not for the benefit of preventing other extensions from messing with things, it's to keep users from messing with things.
To expound on what :glandium said:
Extensions can lock preferences with:
Components. classes[ "@mozilla. org/preferences -service; 1"]
.getServic e(Components. interfaces. nsIPrefService)
.getBranch (null)
.lockPref( "name_of_ pref");
Locking a preference doesn't affect the value, it just locks the preference to the user. Obviously any extension could unlock a preference and do what they want with that value.
Locking preferences is not for the benefit of preventing other extensions from messing with things, it's to keep users from messing with things.
Oddly, this document:
https:/ /developer. mozilla. org/en- US/docs/ Mozilla/ Preferences/ A_brief_ guide_to_ Mozilla_ preferences
Says we already support lockPref in JS files?