зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1524688: Part 16 - Convert push components to static registration. r=baku
--HG-- rename : dom/push/Push.js => dom/push/Push.jsm rename : dom/push/PushComponents.js => dom/push/PushComponents.jsm extra : rebase_source : 5daa46a45484a69617089bb24cf64cb9c66ed7df
This commit is contained in:
Родитель
bb9f19264a
Коммит
ea3de863a9
|
@ -26,10 +26,6 @@ const startupPhases = {
|
||||||
// Consider loading your code after first paint instead,
|
// Consider loading your code after first paint instead,
|
||||||
// eg. from BrowserGlue.jsm' _onFirstWindowLoaded method).
|
// eg. from BrowserGlue.jsm' _onFirstWindowLoaded method).
|
||||||
"before profile selection": {whitelist: {
|
"before profile selection": {whitelist: {
|
||||||
components: new Set([
|
|
||||||
// Bugs to fix: The following components shouldn't be initialized that early.
|
|
||||||
"PushComponents.js", // bug 1369436
|
|
||||||
]),
|
|
||||||
modules: new Set([
|
modules: new Set([
|
||||||
"resource:///modules/BrowserGlue.jsm",
|
"resource:///modules/BrowserGlue.jsm",
|
||||||
"resource://gre/modules/AppConstants.jsm",
|
"resource://gre/modules/AppConstants.jsm",
|
||||||
|
@ -39,6 +35,8 @@ const startupPhases = {
|
||||||
"resource://gre/modules/MainProcessSingleton.jsm",
|
"resource://gre/modules/MainProcessSingleton.jsm",
|
||||||
"resource://gre/modules/XPCOMUtils.jsm",
|
"resource://gre/modules/XPCOMUtils.jsm",
|
||||||
"resource://gre/modules/Services.jsm",
|
"resource://gre/modules/Services.jsm",
|
||||||
|
// Bugs to fix: The following components shouldn't be initialized that early.
|
||||||
|
"resource://gre/modules/PushComponents.jsm", // bug 1369436
|
||||||
]),
|
]),
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
|
|
@ -257,9 +257,7 @@
|
||||||
|
|
||||||
@RESPATH@/components/NotificationStorage.js
|
@RESPATH@/components/NotificationStorage.js
|
||||||
@RESPATH@/components/NotificationStorage.manifest
|
@RESPATH@/components/NotificationStorage.manifest
|
||||||
@RESPATH@/components/Push.js
|
|
||||||
@RESPATH@/components/Push.manifest
|
@RESPATH@/components/Push.manifest
|
||||||
@RESPATH@/components/PushComponents.js
|
|
||||||
|
|
||||||
@RESPATH@/components/remotebrowserutils.manifest
|
@RESPATH@/components/remotebrowserutils.manifest
|
||||||
@RESPATH@/components/RemoteWebNavigation.js
|
@RESPATH@/components/RemoteWebNavigation.js
|
||||||
|
|
|
@ -285,4 +285,4 @@ PushSubscriptionCallback.prototype = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Push]);
|
var EXPORTED_SYMBOLS = ["Push"];
|
|
@ -1,10 +1,3 @@
|
||||||
# DOM API
|
|
||||||
component {cde1d019-fad8-4044-b141-65fb4fb7a245} Push.js
|
|
||||||
contract @mozilla.org/push/PushManager;1 {cde1d019-fad8-4044-b141-65fb4fb7a245}
|
|
||||||
|
|
||||||
# XPCOM components.
|
|
||||||
component {daaa8d73-677e-4233-8acd-2c404bd01658} PushComponents.js
|
|
||||||
contract @mozilla.org/push/Service;1 {daaa8d73-677e-4233-8acd-2c404bd01658}
|
|
||||||
category app-startup PushServiceParent @mozilla.org/push/Service;1 process=main
|
category app-startup PushServiceParent @mozilla.org/push/Service;1 process=main
|
||||||
|
|
||||||
# For immediate loading of PushService instead of delayed loading.
|
# For immediate loading of PushService instead of delayed loading.
|
||||||
|
|
|
@ -113,7 +113,13 @@ PushServiceBase.prototype = {
|
||||||
* `PushService.jsm` at startup and calls its methods directly. It also
|
* `PushService.jsm` at startup and calls its methods directly. It also
|
||||||
* receives and responds to requests from the content process.
|
* receives and responds to requests from the content process.
|
||||||
*/
|
*/
|
||||||
|
let parentInstance;
|
||||||
function PushServiceParent() {
|
function PushServiceParent() {
|
||||||
|
if (parentInstance) {
|
||||||
|
return parentInstance;
|
||||||
|
}
|
||||||
|
parentInstance = this;
|
||||||
|
|
||||||
PushServiceBase.call(this);
|
PushServiceBase.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,8 +129,6 @@ XPCOMUtils.defineLazyServiceGetter(PushServiceParent.prototype, "_mm",
|
||||||
"@mozilla.org/parentprocessmessagemanager;1", "nsISupports");
|
"@mozilla.org/parentprocessmessagemanager;1", "nsISupports");
|
||||||
|
|
||||||
Object.assign(PushServiceParent.prototype, {
|
Object.assign(PushServiceParent.prototype, {
|
||||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(PushServiceParent),
|
|
||||||
|
|
||||||
_messages: [
|
_messages: [
|
||||||
"Push:Register",
|
"Push:Register",
|
||||||
"Push:Registration",
|
"Push:Registration",
|
||||||
|
@ -306,6 +310,7 @@ Object.defineProperty(PushServiceParent.prototype, "service", {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let contentInstance;
|
||||||
/**
|
/**
|
||||||
* The content process implementation of `nsIPushService`. This version
|
* The content process implementation of `nsIPushService`. This version
|
||||||
* uses the child message manager to forward calls to the parent process.
|
* uses the child message manager to forward calls to the parent process.
|
||||||
|
@ -313,6 +318,11 @@ Object.defineProperty(PushServiceParent.prototype, "service", {
|
||||||
* message containing the result.
|
* message containing the result.
|
||||||
*/
|
*/
|
||||||
function PushServiceContent() {
|
function PushServiceContent() {
|
||||||
|
if (contentInstance) {
|
||||||
|
return contentInstance;
|
||||||
|
}
|
||||||
|
contentInstance = this;
|
||||||
|
|
||||||
PushServiceBase.apply(this, arguments);
|
PushServiceBase.apply(this, arguments);
|
||||||
this._requests = new Map();
|
this._requests = new Map();
|
||||||
this._requestId = 0;
|
this._requestId = 0;
|
||||||
|
@ -325,8 +335,6 @@ XPCOMUtils.defineLazyServiceGetter(PushServiceContent.prototype,
|
||||||
"nsISupports");
|
"nsISupports");
|
||||||
|
|
||||||
Object.assign(PushServiceContent.prototype, {
|
Object.assign(PushServiceContent.prototype, {
|
||||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(PushServiceContent),
|
|
||||||
|
|
||||||
_messages: [
|
_messages: [
|
||||||
"PushService:Register:OK",
|
"PushService:Register:OK",
|
||||||
"PushService:Register:KO",
|
"PushService:Register:KO",
|
||||||
|
@ -548,8 +556,8 @@ PushSubscription.prototype = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
|
// Export the correct implementation depending on whether we're running in
|
||||||
// Export the correct implementation depending on whether we're running in
|
// the parent or content process.
|
||||||
// the parent or content process.
|
let Service = isParent ? PushServiceParent : PushServiceContent;
|
||||||
isParent ? PushServiceParent : PushServiceContent,
|
|
||||||
]);
|
var EXPORTED_SYMBOLS = ["Service"];
|
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||||
|
# vim: set filetype=python:
|
||||||
|
# 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{cde1d019-fad8-4044-b141-65fb4fb7a245}',
|
||||||
|
'contract_ids': ['@mozilla.org/push/PushManager;1'],
|
||||||
|
'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',
|
||||||
|
},
|
||||||
|
]
|
|
@ -7,13 +7,13 @@ with Files("**"):
|
||||||
BUG_COMPONENT = ("Core", "DOM: Push Notifications")
|
BUG_COMPONENT = ("Core", "DOM: Push Notifications")
|
||||||
|
|
||||||
EXTRA_COMPONENTS += [
|
EXTRA_COMPONENTS += [
|
||||||
'Push.js',
|
|
||||||
'Push.manifest',
|
'Push.manifest',
|
||||||
'PushComponents.js',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
|
'Push.jsm',
|
||||||
'PushBroadcastService.jsm',
|
'PushBroadcastService.jsm',
|
||||||
|
'PushComponents.jsm',
|
||||||
'PushCrypto.jsm',
|
'PushCrypto.jsm',
|
||||||
'PushDB.jsm',
|
'PushDB.jsm',
|
||||||
'PushRecord.jsm',
|
'PushRecord.jsm',
|
||||||
|
@ -32,6 +32,10 @@ else:
|
||||||
'PushServiceAndroidGCM.jsm',
|
'PushServiceAndroidGCM.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
MOCHITEST_MANIFESTS += [
|
MOCHITEST_MANIFESTS += [
|
||||||
'test/mochitest.ini',
|
'test/mochitest.ini',
|
||||||
]
|
]
|
||||||
|
|
|
@ -106,9 +106,7 @@
|
||||||
@BINPATH@/components/NotificationStorage.js
|
@BINPATH@/components/NotificationStorage.js
|
||||||
@BINPATH@/components/NotificationStorage.manifest
|
@BINPATH@/components/NotificationStorage.manifest
|
||||||
#ifdef MOZ_ANDROID_GCM
|
#ifdef MOZ_ANDROID_GCM
|
||||||
@BINPATH@/components/Push.js
|
|
||||||
@BINPATH@/components/Push.manifest
|
@BINPATH@/components/Push.manifest
|
||||||
@BINPATH@/components/PushComponents.js
|
|
||||||
#endif
|
#endif
|
||||||
@BINPATH@/components/BrowserElementParent.manifest
|
@BINPATH@/components/BrowserElementParent.manifest
|
||||||
@BINPATH@/components/BrowserElementParent.js
|
@BINPATH@/components/BrowserElementParent.js
|
||||||
|
|
Загрузка…
Ссылка в новой задаче