This is adding the RemotePermissionService xpcom js service for the purpose of importing default permission manager entries from remote settings. This service will be initialized by the permission manager after it has read all its permissions from disk and is fully initialized. When being initialized, the service will at first get all the current default remote permissions from the remote settings client, and add them as default permissions through the `AddDefaultFromPrincipal` method added in D222650. An event listener is then also set up to keep the default entries in the permission manager in sync with remote settings. All of this is guarded behind a whitelist in the the `ALLOWED_PERMISSION_VALUES` variable, ensuring only specific permission types and values can be imported through this mechanism. Differential Revision: https://phabricator.services.mozilla.com/D222649
42 lines
1.7 KiB
Plaintext
42 lines
1.7 KiB
Plaintext
/* 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/. */
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
interface nsIPrincipal;
|
|
|
|
/**
|
|
* Service to import default permissions from Remote Settings. Will be
|
|
* initialized by permission manager after it itself has completed its
|
|
* initialization, and will then import default permissions from Remote Settings
|
|
* asynchronously. This also means default permissions aren't guranteed to be
|
|
* available directly after startup.
|
|
*/
|
|
[scriptable, uuid(a4b1b3b1-b68a-4129-aa2f-eb086162a8c7)]
|
|
interface nsIRemotePermissionService : nsISupports {
|
|
/**
|
|
* Asynchonously import all default permissions from remote settings into
|
|
* the permission manager. Also, if not already done, set up remote settings
|
|
* event listener to keep remote permissions in sync.
|
|
*/
|
|
void init();
|
|
/**
|
|
* Promise that is resolved when the remote permission service has been
|
|
* fully initialized, meaning all intial permissions have been imported and
|
|
* the remote settings sync event listener has been set up. If any errors
|
|
* are encountered during inizialization, this promise will be rejected.
|
|
*/
|
|
readonly attribute Promise isInitialized;
|
|
/**
|
|
* Allowed permission types and values to be set through remote settings.
|
|
* See RemotePermissionService.sys.mjs for further documentation. Exposed
|
|
* only for testing purposes.
|
|
*/
|
|
attribute jsval testAllowedPermissionValues;
|
|
};
|
|
|
|
%{C++
|
|
#define NS_REMOTEPERMISSIONSERVICE_CONTRACTID "@mozilla.org/remote-permission-service;1"
|
|
%}
|