mkFirefoxModule: serialize path prefs as strings
Treat Nix paths like plain string preferences when generating user.js so values such as browser.bookmarks.file are not JSON-quoted twice. Add a regression case in the Firefox settings test for a path-valued preference.
This commit is contained in:
@@ -75,7 +75,10 @@ let
|
||||
userPrefValue =
|
||||
pref:
|
||||
builtins.toJSON (
|
||||
if lib.isBool pref || lib.isInt pref || lib.isString pref then pref else builtins.toJSON pref
|
||||
if lib.isBool pref || lib.isInt pref || lib.isString pref || lib.isPath pref then
|
||||
pref
|
||||
else
|
||||
builtins.toJSON pref
|
||||
);
|
||||
|
||||
extensionSettingsNeedForce =
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
||||
@@ -24,6 +24,7 @@ in
|
||||
test = {
|
||||
id = 1;
|
||||
settings = {
|
||||
"browser.bookmarks.file" = ./bookmarks.html;
|
||||
"general.smoothScroll" = false;
|
||||
"browser.newtabpage.pinned" = [
|
||||
{
|
||||
@@ -51,8 +52,11 @@ in
|
||||
|
||||
assertDirectoryExists "home-files/${cfg.profilesPath}/basic"
|
||||
|
||||
settingsUserJs=$(normalizeStorePaths \
|
||||
"home-files/${cfg.profilesPath}/test/user.js")
|
||||
|
||||
assertFileContent \
|
||||
"home-files/${cfg.profilesPath}/test/user.js" \
|
||||
$settingsUserJs \
|
||||
${./expected-user.js}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
|
||||
|
||||
user_pref("browser.bookmarks.file", "/nix/store/00000000000000000000000000000000-bookmarks.html");
|
||||
user_pref("browser.newtabpage.pinned", "[{\"title\":\"NixOS\",\"url\":\"https://nixos.org\"}]");
|
||||
user_pref("general.smoothScroll", false);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user