mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1629113 - Move remaining services to components.conf. r=snorp,baku
Differential Revision: https://phabricator.services.mozilla.com/D75878
This commit is contained in:
parent
c4530466c4
commit
398b7f2e76
@ -11,10 +11,14 @@ Classes = [
|
||||
'jsm': 'resource://gre/modules/Push.jsm',
|
||||
'constructor': 'Push',
|
||||
},
|
||||
{
|
||||
'cid': '{daaa8d73-677e-4233-8acd-2c404bd01658}',
|
||||
'contract_ids': ['@mozilla.org/push/Service;1'],
|
||||
'jsm': 'resource://gre/modules/PushComponents.jsm',
|
||||
'constructor': 'Service',
|
||||
},
|
||||
]
|
||||
|
||||
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android':
|
||||
Classes += [
|
||||
{
|
||||
'cid': '{daaa8d73-677e-4233-8acd-2c404bd01658}',
|
||||
'contract_ids': ['@mozilla.org/push/Service;1'],
|
||||
'jsm': 'resource://gre/modules/PushComponents.jsm',
|
||||
'constructor': 'Service',
|
||||
},
|
||||
]
|
||||
|
@ -1,14 +1,4 @@
|
||||
# GeckoViewStartup.js
|
||||
component {8e993c34-fdd6-432c-967e-f995d888777f} GeckoViewStartup.js
|
||||
contract @mozilla.org/geckoview/startup;1 {8e993c34-fdd6-432c-967e-f995d888777f}
|
||||
category app-startup GeckoViewStartup service,@mozilla.org/geckoview/startup;1
|
||||
category profile-after-change GeckoViewStartup @mozilla.org/geckoview/startup;1 process=main
|
||||
category browser-idle-startup-tasks-finished GeckoViewStartup @mozilla.org/geckoview/startup;1 process=main
|
||||
|
||||
# GeckoViewPermission.js
|
||||
component {42f3c238-e8e8-4015-9ca2-148723a8afcf} GeckoViewPermission.js
|
||||
contract @mozilla.org/content-permission/prompt;1 {42f3c238-e8e8-4015-9ca2-148723a8afcf}
|
||||
|
||||
# GeckoViewPush.js
|
||||
component {a54d84d7-98a4-4fec-b664-e42e512ae9cc} GeckoViewPush.js
|
||||
contract @mozilla.org/push/Service;1 {a54d84d7-98a4-4fec-b664-e42e512ae9cc}
|
||||
|
@ -1,36 +1,30 @@
|
||||
/* 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";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["GeckoViewPermission"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
EventDispatcher: "resource://gre/modules/Messaging.jsm",
|
||||
GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
|
||||
// See: http://developer.android.com/reference/android/Manifest.permission.html
|
||||
const PERM_ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
|
||||
const PERM_ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
|
||||
const PERM_CAMERA = "android.permission.CAMERA";
|
||||
const PERM_RECORD_AUDIO = "android.permission.RECORD_AUDIO";
|
||||
|
||||
function GeckoViewPermission() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
class GeckoViewPermission {
|
||||
constructor() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
|
||||
GeckoViewPermission.prototype = {
|
||||
classID: Components.ID("{42f3c238-e8e8-4015-9ca2-148723a8afcf}"),
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
Ci.nsIObserver,
|
||||
Ci.nsIContentPermissionPrompt,
|
||||
]),
|
||||
|
||||
_appPermissions: {},
|
||||
_appPermissions = {};
|
||||
|
||||
/* ---------- nsIObserver ---------- */
|
||||
observe(aSubject, aTopic, aData) {
|
||||
@ -48,7 +42,7 @@ GeckoViewPermission.prototype = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
receiveMessage(aMsg) {
|
||||
switch (aMsg.name) {
|
||||
@ -68,7 +62,7 @@ GeckoViewPermission.prototype = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
handleMediaAskDevicePermission(aType, aCallback) {
|
||||
const perms = [];
|
||||
@ -93,7 +87,7 @@ GeckoViewPermission.prototype = {
|
||||
// No dispatcher; just bail.
|
||||
callback();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
handleMediaRequest(aRequest) {
|
||||
const constraints = aRequest.getConstraints();
|
||||
@ -197,7 +191,7 @@ GeckoViewPermission.prototype = {
|
||||
Cu.reportError("Media device error: " + error);
|
||||
denyRequest();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
handlePeerConnectionRequest(aRequest) {
|
||||
Services.obs.notifyObservers(
|
||||
@ -205,11 +199,11 @@ GeckoViewPermission.prototype = {
|
||||
"PeerConnection:response:allow",
|
||||
aRequest.callID
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
checkAppPermissions(aPerms) {
|
||||
return aPerms.every(perm => this._appPermissions[perm]);
|
||||
},
|
||||
}
|
||||
|
||||
getAppPermissions(aDispatcher, aPerms) {
|
||||
const perms = aPerms.filter(perm => !this._appPermissions[perm]);
|
||||
@ -229,7 +223,7 @@ GeckoViewPermission.prototype = {
|
||||
}
|
||||
return granted;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
prompt(aRequest) {
|
||||
// Only allow exactly one permission request here.
|
||||
@ -289,7 +283,13 @@ GeckoViewPermission.prototype = {
|
||||
// Manually release the target request here to facilitate garbage collection.
|
||||
aRequest = undefined;
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([GeckoViewPermission]);
|
||||
GeckoViewPermission.prototype.classID = Components.ID(
|
||||
"{42f3c238-e8e8-4015-9ca2-148723a8afcf}"
|
||||
);
|
||||
GeckoViewPermission.prototype.QueryInterface = ChromeUtils.generateQI([
|
||||
Ci.nsIObserver,
|
||||
Ci.nsIContentPermissionPrompt,
|
||||
]);
|
@ -1,12 +1,10 @@
|
||||
/* 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";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
var EXPORTED_SYMBOLS = ["PushService"];
|
||||
|
||||
const { GeckoViewUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/GeckoViewUtils.jsm"
|
||||
);
|
||||
@ -54,34 +52,24 @@ function scopeWithAttrs(scope, attrs) {
|
||||
return scope + ChromeUtils.originAttributesToSuffix(attrs);
|
||||
}
|
||||
|
||||
function PushService() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
class PushService {
|
||||
constructor() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
|
||||
PushService.prototype = {
|
||||
classID: Components.ID("{a54d84d7-98a4-4fec-b664-e42e512ae9cc}"),
|
||||
contractID: "@mozilla.org/push/Service;1",
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIPushService,
|
||||
Ci.nsIPushQuotaManager,
|
||||
Ci.nsIPushErrorReporter,
|
||||
]),
|
||||
|
||||
pushTopic: OBSERVER_TOPIC_PUSH,
|
||||
subscriptionChangeTopic: OBSERVER_TOPIC_SUBSCRIPTION_CHANGE,
|
||||
subscriptionModifiedTopic: OBSERVER_TOPIC_SUBSCRIPTION_MODIFIED,
|
||||
pushTopic = OBSERVER_TOPIC_PUSH;
|
||||
subscriptionChangeTopic = OBSERVER_TOPIC_SUBSCRIPTION_CHANGE;
|
||||
subscriptionModifiedTopic = OBSERVER_TOPIC_SUBSCRIPTION_MODIFIED;
|
||||
|
||||
// nsIObserver methods
|
||||
|
||||
observe(subject, topic, data) {},
|
||||
observe(subject, topic, data) {}
|
||||
|
||||
// nsIPushService methods
|
||||
|
||||
subscribe(scope, principal, callback) {
|
||||
this.subscribeWithKey(scope, principal, null, callback);
|
||||
},
|
||||
}
|
||||
|
||||
async subscribeWithKey(scope, principal, appServerKey, callback) {
|
||||
try {
|
||||
@ -109,7 +97,7 @@ PushService.prototype = {
|
||||
} catch (e) {
|
||||
callback.onPushSubscription(Cr.NS_ERROR_FAILURE, null);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
async unsubscribe(scope, principal, callback) {
|
||||
try {
|
||||
@ -122,7 +110,7 @@ PushService.prototype = {
|
||||
} catch (e) {
|
||||
callback.onUnsubscribe(Cr.NS_ERROR_FAILURE, false);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
async getSubscription(scope, principal, callback) {
|
||||
try {
|
||||
@ -144,45 +132,55 @@ PushService.prototype = {
|
||||
} catch (e) {
|
||||
callback.onPushSubscription(Cr.NS_ERROR_FAILURE, null);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
clearForDomain(domain, callback) {
|
||||
callback.onClear(Cr.NS_OK);
|
||||
},
|
||||
}
|
||||
|
||||
// nsIPushQuotaManager methods
|
||||
|
||||
notificationForOriginShown(origin) {},
|
||||
notificationForOriginShown(origin) {}
|
||||
|
||||
notificationForOriginClosed(origin) {},
|
||||
notificationForOriginClosed(origin) {}
|
||||
|
||||
// nsIPushErrorReporter methods
|
||||
|
||||
reportDeliveryError(messageId, reason) {},
|
||||
};
|
||||
|
||||
/** `PushSubscription` instances are passed to all subscription callbacks. */
|
||||
function PushSubscription(props) {
|
||||
this._props = props;
|
||||
reportDeliveryError(messageId, reason) {}
|
||||
}
|
||||
|
||||
PushSubscription.prototype = {
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIPushSubscription]),
|
||||
PushService.prototype.classID = Components.ID(
|
||||
"{a54d84d7-98a4-4fec-b664-e42e512ae9cc}"
|
||||
);
|
||||
PushService.prototype.contractID = "@mozilla.org/push/Service;1";
|
||||
PushService.prototype.QueryInterface = ChromeUtils.generateQI([
|
||||
Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIPushService,
|
||||
Ci.nsIPushQuotaManager,
|
||||
Ci.nsIPushErrorReporter,
|
||||
]);
|
||||
|
||||
/** `PushSubscription` instances are passed to all subscription callbacks. */
|
||||
class PushSubscription {
|
||||
constructor(props) {
|
||||
this._props = props;
|
||||
}
|
||||
|
||||
/** The URL for sending messages to this subscription. */
|
||||
get endpoint() {
|
||||
return this._props.endpoint;
|
||||
},
|
||||
}
|
||||
|
||||
/** The last time a message was sent to this subscription. */
|
||||
get lastPush() {
|
||||
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
},
|
||||
}
|
||||
|
||||
/** The total number of messages sent to this subscription. */
|
||||
get pushCount() {
|
||||
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* The app will take care of throttling, so we don't
|
||||
@ -190,7 +188,7 @@ PushSubscription.prototype = {
|
||||
*/
|
||||
get quota() {
|
||||
return -1;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this subscription was created with the system principal.
|
||||
@ -199,12 +197,12 @@ PushSubscription.prototype = {
|
||||
*/
|
||||
get isSystemSubscription() {
|
||||
return false;
|
||||
},
|
||||
}
|
||||
|
||||
/** The private key used to decrypt incoming push messages, in JWK format */
|
||||
get p256dhPrivateKey() {
|
||||
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this subscription is subject to the background message
|
||||
@ -212,7 +210,7 @@ PushSubscription.prototype = {
|
||||
*/
|
||||
quotaApplies() {
|
||||
return false;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this subscription exceeded the background message quota,
|
||||
@ -221,7 +219,7 @@ PushSubscription.prototype = {
|
||||
*/
|
||||
isExpired() {
|
||||
return false;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a key for encrypting messages sent to this subscription. JS
|
||||
@ -240,14 +238,16 @@ PushSubscription.prototype = {
|
||||
return this._getRawKey(this._props.appServerKey);
|
||||
}
|
||||
return [];
|
||||
},
|
||||
}
|
||||
|
||||
_getRawKey(key) {
|
||||
if (!key) {
|
||||
return [];
|
||||
}
|
||||
return new Uint8Array(key);
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PushService]);
|
||||
PushSubscription.prototype.QueryInterface = ChromeUtils.generateQI([
|
||||
Ci.nsIPushSubscription,
|
||||
]);
|
@ -1,6 +1,9 @@
|
||||
/* 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";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["GeckoViewStartup"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
@ -45,13 +48,7 @@ const JSWINDOWACTORS = {
|
||||
},
|
||||
};
|
||||
|
||||
function GeckoViewStartup() {}
|
||||
|
||||
GeckoViewStartup.prototype = {
|
||||
classID: Components.ID("{8e993c34-fdd6-432c-967e-f995d888777f}"),
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
|
||||
|
||||
class GeckoViewStartup {
|
||||
/* ---------- nsIObserver ---------- */
|
||||
observe(aSubject, aTopic, aData) {
|
||||
debug`observe: ${aTopic}`;
|
||||
@ -234,7 +231,7 @@ GeckoViewStartup.prototype = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onEvent(aEvent, aData, aCallback) {
|
||||
debug`onEvent ${aEvent}`;
|
||||
@ -271,7 +268,12 @@ GeckoViewStartup.prototype = {
|
||||
);
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([GeckoViewStartup]);
|
||||
GeckoViewStartup.prototype.classID = Components.ID(
|
||||
"{8e993c34-fdd6-432c-967e-f995d888777f}"
|
||||
);
|
||||
GeckoViewStartup.prototype.QueryInterface = ChromeUtils.generateQI([
|
||||
Ci.nsIObserver,
|
||||
]);
|
@ -20,6 +20,24 @@ Classes = [
|
||||
'jsm': 'resource://gre/modules/GeckoViewPrompt.jsm',
|
||||
'constructor': 'PromptFactory',
|
||||
},
|
||||
{
|
||||
'cid': '{8e993c34-fdd6-432c-967e-f995d888777f}',
|
||||
'contract_ids': ['@mozilla.org/geckoview/startup;1'],
|
||||
'jsm': 'resource://gre/modules/GeckoViewStartup.jsm',
|
||||
'constructor': 'GeckoViewStartup',
|
||||
},
|
||||
{
|
||||
'cid': '{42f3c238-e8e8-4015-9ca2-148723a8afcf}',
|
||||
'contract_ids': ['@mozilla.org/content-permission/prompt;1'],
|
||||
'jsm': 'resource://gre/modules/GeckoViewPermission.jsm',
|
||||
'constructor': 'GeckoViewPermission',
|
||||
},
|
||||
{
|
||||
'cid': '{a54d84d7-98a4-4fec-b664-e42e512ae9cc}',
|
||||
'contract_ids': ['@mozilla.org/push/Service;1'],
|
||||
'jsm': 'resource://gre/modules/GeckoViewPush.jsm',
|
||||
'constructor': 'PushService',
|
||||
},
|
||||
{
|
||||
'cid': '{aa0dd6fc-73dd-4621-8385-c0b377e02cee}',
|
||||
'contract_ids': ['@mozilla.org/colorpicker;1'],
|
||||
|
@ -22,16 +22,16 @@ XPCOM_MANIFESTS += [
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'GeckoView.manifest',
|
||||
'GeckoViewPermission.js',
|
||||
'GeckoViewPush.js',
|
||||
'GeckoViewStartup.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'ColorPickerDelegate.jsm',
|
||||
'FilePickerDelegate.jsm',
|
||||
'GeckoViewPermission.jsm',
|
||||
'GeckoViewPrompt.jsm',
|
||||
'GeckoViewPrompter.jsm',
|
||||
'GeckoViewPush.jsm',
|
||||
'GeckoViewStartup.jsm',
|
||||
'LoginStorageDelegate.jsm',
|
||||
'PromptCollection.jsm',
|
||||
'ShareDelegate.jsm',
|
||||
|
@ -216,9 +216,6 @@
|
||||
|
||||
#ifdef MOZ_GECKOVIEW_JAR
|
||||
@BINPATH@/components/GeckoView.manifest
|
||||
@BINPATH@/components/GeckoViewPush.js
|
||||
@BINPATH@/components/GeckoViewPermission.js
|
||||
@BINPATH@/components/GeckoViewStartup.js
|
||||
#else
|
||||
@BINPATH@/chrome/chrome@JAREXT@
|
||||
@BINPATH@/chrome/chrome.manifest
|
||||
|
@ -37,7 +37,7 @@ function getPendingMinidump(id) {
|
||||
}
|
||||
|
||||
var ContentCrashHandler = {
|
||||
// The event listener for this is hooked up in GeckoViewStartup.js
|
||||
// The event listener for this is hooked up in GeckoViewStartup.jsm
|
||||
observe(aSubject, aTopic, aData) {
|
||||
aSubject.QueryInterface(Ci.nsIPropertyBag2);
|
||||
|
||||
|
@ -57,7 +57,7 @@ class GeckoViewMedia extends GeckoViewModule {
|
||||
}
|
||||
|
||||
const GeckoViewRecordingMedia = {
|
||||
// The event listener for this is hooked up in GeckoViewStartup.js
|
||||
// The event listener for this is hooked up in GeckoViewStartup.jsm
|
||||
observe(aSubject, aTopic, aData) {
|
||||
debug`observe: aTopic=${aTopic}`;
|
||||
switch (aTopic) {
|
||||
|
Loading…
Reference in New Issue
Block a user