[cookies] add support for LibreWolf (#4101 #7625)

This commit is contained in:
Mike Fährmann
2025-06-04 08:21:33 +02:00
parent 3c6c40d4ed
commit 6df80fe595

View File

@@ -26,7 +26,7 @@ from . import aes, text, util
SUPPORTED_BROWSERS_CHROMIUM = {
"brave", "chrome", "chromium", "edge", "opera", "thorium", "vivaldi"}
SUPPORTED_BROWSERS_FIREFOX = {"firefox", "zen"}
SUPPORTED_BROWSERS_FIREFOX = {"firefox", "librewolf", "zen"}
SUPPORTED_BROWSERS = \
SUPPORTED_BROWSERS_CHROMIUM | SUPPORTED_BROWSERS_FIREFOX | {"safari"}
@@ -212,8 +212,10 @@ def _firefox_cookies_database(browser_name, profile=None, container=None):
path = _find_most_recently_used_file(search_root, "cookies.sqlite")
if path is None:
raise FileNotFoundError("Unable to find Firefox cookies database in "
"{}".format(search_root))
raise FileNotFoundError(
"Unable to find {} cookies database in {}".format(
browser_name.capitalize(), search_root))
_log_debug("Extracting cookies from %s", path)
if not container or container == "none":
@@ -257,20 +259,23 @@ def _firefox_browser_directory(browser_name):
if sys.platform in ("win32", "cygwin"):
appdata = os.path.expandvars("%APPDATA%")
return {
"firefox": join(appdata, R"Mozilla\Firefox\Profiles"),
"zen" : join(appdata, R"zen\Profiles")
"firefox" : join(appdata, R"Mozilla\Firefox\Profiles"),
"librewolf": join(appdata, R"librewolf\Profiles"),
"zen" : join(appdata, R"zen\Profiles"),
}[browser_name]
elif sys.platform == "darwin":
appdata = os.path.expanduser("~/Library/Application Support")
return {
"firefox": join(appdata, R"Firefox/Profiles"),
"zen" : join(appdata, R"zen/Profiles")
"firefox" : join(appdata, R"Firefox/Profiles"),
"librewolf": join(appdata, R"librewolf/Profiles"),
"zen" : join(appdata, R"zen/Profiles"),
}[browser_name]
else:
home = os.path.expanduser("~")
return {
"firefox": join(home, R".mozilla/firefox"),
"zen" : join(home, R".zen")
"firefox" : join(home, R".mozilla/firefox"),
"librewolf": join(home, R".librewolf"),
"zen" : join(home, R".zen"),
}[browser_name]