// Prefs for the Steam TV box's Firefox profile. Installed by
// build-steam-tv-box-iso.sh to /etc/steamtv-firefox/user.js, from where
// /usr/local/bin/web-browser copies it into
// /home/<KIOSK_USERNAME>/.mozilla/firefox/web on every launch.
//
// One profile here, not two: this image has no digest canvas — the browser is the
// general-browsing window and nothing else. Otherwise these are the thin client's
// prefs verbatim, and for the same reasons.
//
// user.js rather than prefs.js: user.js is re-applied to prefs.js on every startup, so
// nothing a stray click changes at runtime survives a restart. That matters on a kiosk
// nobody logs into to fix things.
//
// Anything expressible as enterprise policy lives in policies.json instead — policy is
// enforced and shows up in about:policies, whereas a pref is merely a default. The
// prefs here are the ones with no policy equivalent.

// The only reason userChrome.css is read at all. Without this the stylesheet in
// chrome/ is silently ignored and the window comes up with full default chrome.
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);

// First-run / post-update interstitials. An unattended screen has nobody to close them.
user_pref("browser.startup.homepage_override.mstone", "ignore");
user_pref("browser.aboutwelcome.enabled", false);
user_pref("browser.messaging-system.whatsNewPanel.enabled", false);
user_pref("trailhead.firstrun.didSeeAboutWelcome", true);
user_pref("datareporting.policy.firstRunURL", "");
user_pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);

// Session restore prompts after a power cut would leave the room's display stuck on a
// "restore your session?" page instead of the digest.
user_pref("browser.sessionstore.resume_from_crash", false);
user_pref("browser.tabs.warnOnClose", false);
user_pref("browser.tabs.warnOnCloseOtherTabs", false);
user_pref("browser.warnOnQuit", false);

// No permission doorhangers on a display nobody is standing at. Autoplay is allowed
// because the digest canvas and embedded video are the point of the machine.
user_pref("permissions.default.desktop-notification", 2);
user_pref("permissions.default.geo", 2);
user_pref("media.autoplay.default", 0);
user_pref("media.autoplay.blocking_policy", 0);

// Wayland-native rather than Xwayland, matching MOZ_ENABLE_WAYLAND in kiosk-session.
// VA-API is left at its default: no thin-client hardware has been chosen yet
// (project-plan §4 #7), so forcing hardware decode here could just as easily produce a
// black video surface as a working one.
user_pref("gfx.webrender.all", true);

// The address bar in the minimal-chrome window is for typing a URL, not for a dropdown
// of suggestions covering the page.
user_pref("browser.urlbar.suggest.topsites", false);
user_pref("browser.urlbar.suggest.quicksuggest.sponsored", false);
user_pref("browser.newtabpage.activity-stream.showSponsored", false);
user_pref("browser.newtabpage.activity-stream.showSponsoredTopSites", false);
