- : 19 %
- : 88 %
- : 55 %
- : 11 %
- : 27 %
- : 76 %
- : 88 %
- : 88 %
- : 88 %
- : 47 %
- : 88 %
- : 88 %
- : 70 %
- : 88 %
- : 88 %
- : 88 %
- : 10 %
- : 12 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 65 %
- : 88 %
- : 10 %
- : 10 %
- : 88 %
- : 88 %
- : 88 %
- : 53 %
- : 43 %
- : 88 %
- : 47 %
- : 88 %
- : 100 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 25 %
- : 88 %
- : 77 %
- : 53 %
- : 56 %
- : 9 %
- : 88 %
- : 88 %
- : 85 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 57 %
- : 88 %
- : 88 %
- : 88 %
- : 100 %
- : 9 %
- : 88 %
- : 88 %
- : 100 %
- : 26 %
- : 88 %
- : 56 %
- : 88 %
- : 53 %
- : 8 %
- : 88 %
- : 47 %
- : 88 %
- : 88 %
- : 88 %
- : 53 %
- : 25 %
- : 88 %
- : 88 %
- : 88 %
- : 28 %
- : 100 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 100 %
- : 88 %
- : 10 %
- : 88 %
- : 27 %
- : 18 %
- : 14 %
- : 88 %
- : 100 %
- : 27 %
- : 88 %
- : 9 %
- : 88 %
- : 88 %
- : 9 %
- : 52 %
- : 88 %
- : 88 %
- : 47 %
- : 13 %
- : 51 %
- : 88 %
- : 50 %
- : 11 %
- : 100 %
- : 88 %
- : 88 %
- : 48 %
- : 10 %
- : 88 %
- : 60 %
- : 88 %
- : 27 %
- : 99 %
- : 17 %
- : 88 %
- : 48 %
- : 27 %
- : 88 %
- : 12 %
- : 33 %
- : 88 %
- : 100 %
- : 45 %
- : 10 %
- : 88 %
- : 10 %
- : 88 %
- : 12 %
- : 18 %
- : 88 %
- : 88 %
- : 100 %
- : 100 %
- : 33 %
- : 100 %
- : 55 %
- : 88 %
- : 43 %
- : 35 %
- : 16 %
- : 29 %
- : 79 %
- : 88 %
- : 9 %
- : 100 %
- : 15 %
- : 88 %
- : 88 %
- : 9 %
- : 88 %
- : 88 %
- : 88 %
- : 43 %
- : 26 %
- : 88 %
- : 47 %
- : 30 %
- : 9 %
- : 79 %
- : 33 %
- : 33 %
- : 33 %
- : 100 %
- : 38 %
- : 26 %
- : 100 %
- : 48 %
- : 88 %
- : 54 %
- : 21 %
- : 88 %
- : 100 %
- : 88 %
- : 34 %
- : 88 %
- : 88 %
- : 56 %
- : 100 %
- : 88 %
- : 88 %
- : 33 %
- : 22 %
- : 46 %
- : 88 %
- : 33 %
- : 100 %
- : 41 %
- : 88 %
- : 98 %
- : 30 %
- : 88 %
- : 27 %
- : 88 %
- : 88 %
- : 11 %
- : 88 %
- : 27 %
- : 43 %
- : 88 %
- : 49 %
- : 18 %
- : 88 %
- : 33 %
- : 88 %
- : 88 %
- : 53 %
- : 17 %
- : 93 %
- : 26 %
- : 36 %
- : 41 %
- : 49 %
- : 33 %
- : 20 %
- : 29 %
- : 79 %
- : 56 %
- : 88 %
- : 27 %
- : 88 %
- : 88 %
- : 31 %
- : 88 %
- : 88 %
- : 88 %
- : 21 %
- : 88 %
- : 45 %
- : 88 %
- : 17 %
- : 53 %
- : 88 %
- : 88 %
- : 100 %
- : 25 %
- : 83 %
- : 43 %
- : 88 %
- : 88 %
- : 48 %
- : 49 %
- : 88 %
- : 19 %
- : 57 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 23 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 49 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 86 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 100 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 99 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 57 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 25 %
- : 88 %
- : 88 %
- : 99 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 25 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 88 %
- : 41 %
- : 88 %
- : 88 %
Source code
Revision control
Copy as Markdown
Other Tools
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* global AppConstants, ChromeUtils, ExtensionAPI, Services */
ChromeUtils.defineESModuleGetters(this, {
KEYBOARD_CONTROLS: "resource://gre/modules/PictureInPictureControls.sys.mjs",
TOGGLE_POLICIES: "resource://gre/modules/PictureInPictureControls.sys.mjs",
});
const TOGGLE_ENABLED_PREF =
"media.videocontrols.picture-in-picture.video-toggle.enabled";
/**
* This API is expected to be running in the parent process.
*/
this.pictureInPictureParent = class extends ExtensionAPI {
/**
* Override ExtensionAPI with PiP override's specific API
* Relays the site overrides to this extension's child process
*
* @returns {object} returns the necessary API structure required to manage sharedData in PictureInPictureParent
*/
getAPI() {
return {
pictureInPictureParent: {
setOverrides(overrides) {
// The Picture-in-Picture toggle is only implemented for Desktop, so make
// this a no-op for non-Desktop builds.
if (AppConstants.platform == "android") {
return;
}
Services.ppmm.sharedData.set(
"PictureInPicture:SiteOverrides",
overrides
);
},
},
};
}
};
/**
* This API is expected to be running in a content process - specifically,
* the WebExtension content process that the background scripts run in. We
* split these out so that they can return values synchronously to the
* background scripts.
*/
this.pictureInPictureChild = class extends ExtensionAPI {
/**
* Override ExtensionAPI with PiP override's specific API
* Clone constants into the Picture-in-Picture child process
*
* @param {ExtensionContext} context the context of our extension
* @returns {object} returns the necessary API structure required to get data from PictureInPictureChild
*/
getAPI(context) {
return {
pictureInPictureChild: {
getKeyboardControls() {
// The Picture-in-Picture toggle is only implemented for Desktop, so make
// this return nothing for non-Desktop builds.
if (AppConstants.platform == "android") {
return Cu.cloneInto({}, context.cloneScope);
}
return Cu.cloneInto(KEYBOARD_CONTROLS, context.cloneScope);
},
getPolicies() {
// The Picture-in-Picture toggle is only implemented for Desktop, so make
// this return nothing for non-Desktop builds.
if (AppConstants.platform == "android") {
return Cu.cloneInto({}, context.cloneScope);
}
return Cu.cloneInto(TOGGLE_POLICIES, context.cloneScope);
},
},
};
}
};