firefox: Enable userChrome in about:config
Enable "toolkit.legacyUserProfileCustomizations.stylesheets" in about:config if userChrome or userContent is not empty.
This commit is contained in:
parent
4fcd54df7c
commit
4205c1fc74
|
@ -343,7 +343,12 @@ in {
|
|||
|
||||
profiles = mkOption {
|
||||
inherit visible;
|
||||
type = types.attrsOf (types.submodule ({ config, name, ... }: {
|
||||
type = types.attrsOf (types.submodule ({ config, name, ... }:
|
||||
let
|
||||
|
||||
profile = config;
|
||||
|
||||
in {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
|
@ -746,6 +751,12 @@ in {
|
|||
};
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
settings."toolkit.legacyUserProfileCustomizations.stylesheets" =
|
||||
mkIf (profile.userChrome != "" || profile.userContent != "") true;
|
||||
};
|
||||
|
||||
}));
|
||||
default = { };
|
||||
description = "Attribute set of ${name} profiles.";
|
||||
|
@ -801,7 +812,28 @@ in {
|
|||
}
|
||||
|
||||
(mkNoDuplicateAssertion cfg.profiles "profile")
|
||||
] ++ (mapAttrsToList
|
||||
] ++ (
|
||||
|
||||
# Assert "toolkit.legacyUserProfileCustomizations.stylesheets" is enabled if userChrome/userContent is used.
|
||||
let
|
||||
|
||||
assertProfile = userChromeAttr: profile:
|
||||
profile.${userChromeAttr} != ""
|
||||
-> (profile.settings."toolkit.legacyUserProfileCustomizations.stylesheets"
|
||||
!= false);
|
||||
|
||||
mkAssertion = userChromeAttr: {
|
||||
assertion =
|
||||
all (assertProfile userChromeAttr) (attrValues cfg.profiles);
|
||||
message = ''
|
||||
{option}`${userChromeAttr}` won't work with
|
||||
{option}`settings."toolkit.legacyUserProfileCustomizations.stylesheets"` set to false.
|
||||
'';
|
||||
};
|
||||
|
||||
in [ (mkAssertion "userChrome") (mkAssertion "userContent") ]
|
||||
|
||||
) ++ (mapAttrsToList
|
||||
(_: profile: mkNoDuplicateAssertion profile.containers "container")
|
||||
cfg.profiles);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"identities":[{"color":"yellow","icon":"circle","name":"shopping","public":true,"userContextId":6},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.thumbnail","public":false,"userContextId":4294967294},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.webextStorageLocal","public":false,"userContextId":4294967295}],"lastUserContextId":6,"version":4}
|
||||
{"identities":[{"color":"yellow","icon":"circle","name":"shopping","public":true,"userContextId":0},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.thumbnail","public":false,"userContextId":4294967294},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.webextStorageLocal","public":false,"userContextId":4294967295}],"lastUserContextId":0,"version":4}
|
||||
|
|
|
@ -9,6 +9,9 @@ let
|
|||
|
||||
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
|
||||
|
||||
userChromeExample = "#example-user-chrome { display: none; }";
|
||||
userContentExample = "#example-user-content { display: none; }";
|
||||
|
||||
in {
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
|
@ -154,12 +157,18 @@ in {
|
|||
id = 5;
|
||||
containers = {
|
||||
"shopping" = {
|
||||
id = 6;
|
||||
icon = "circle";
|
||||
color = "yellow";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
profiles.userChrome = {
|
||||
id = 6;
|
||||
userChrome = userChromeExample;
|
||||
userContent = userContentExample;
|
||||
};
|
||||
|
||||
} // {
|
||||
|
||||
nmt.script = ''
|
||||
|
@ -173,10 +182,6 @@ in {
|
|||
home-files/${cfg.configPath}/test/user.js \
|
||||
${./profile-settings-expected-user.js}
|
||||
|
||||
assertFileContent \
|
||||
home-files/${cfg.configPath}/containers/containers.json \
|
||||
${./profile-settings-expected-containers.json}
|
||||
|
||||
bookmarksUserJs=$(normalizeStorePaths \
|
||||
home-files/${cfg.configPath}/bookmarks/user.js)
|
||||
|
||||
|
@ -210,6 +215,22 @@ in {
|
|||
assertFirefoxSearchContent \
|
||||
home-files/${cfg.configPath}/searchWithoutDefault/search.json.mozlz4 \
|
||||
${./profile-settings-expected-search-without-default.json}
|
||||
|
||||
assertFileContent \
|
||||
home-files/${cfg.configPath}/containers/containers.json \
|
||||
${./profile-settings-expected-containers.json}
|
||||
|
||||
assertFileContains \
|
||||
home-files/.mozilla/firefox/userChrome/user.js \
|
||||
'user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true)'
|
||||
|
||||
assertFileContains \
|
||||
home-files/.mozilla/firefox/userChrome/chrome/userChrome.css \
|
||||
'${userChromeExample}'
|
||||
|
||||
assertFileContains \
|
||||
home-files/.mozilla/firefox/userChrome/chrome/userContent.css \
|
||||
'${userContentExample}'
|
||||
'';
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue