Add new scriptlet — 'disable-pageview-api'
YouTube uses pageview api to show popup "Video paused. Continue watching?" when user is not interacting with the page.
/// disable-pageview-api.js (function(){ // based on https://addons.mozilla.org/en-US/firefox/addon/disable-page-visibility/ // visibilitychange events are captured and stopped document.addEventListener("visibilitychange", function(e) { e.stopImmediatePropagation(); }, true); // document.visibilityState always returns false Object.defineProperty(Document.prototype, "hidden", { get: function hidden() { return false; }, enumerable: true, configurable: true }); // document.visibilityState always returns "visible" Object.defineProperty(Document.prototype, "visibilityState", { get: function visibilityState() { return "visible"; }, enumerable: true, configurable: true }); })()
Discussion on reddit regarding it: https://www.reddit.com/r/firefox/comments/f0ewaq/any_way_to_disable_pageview_api_via_unlock_origin/