Bug 988129 - Correct the chaotic naming styles in system message codes (part 1, remove function name). r=fabrice

This commit is contained in:
Gene Lian 2014-03-31 16:04:11 +08:00
parent 28fbee74be
commit 779ed94d29
2 changed files with 25 additions and 28 deletions

View File

@ -91,7 +91,7 @@ function SystemMessageInternal() {
SystemMessageInternal.prototype = {
_getMessageConfigurator: function _getMessageConfigurator(aType) {
_getMessageConfigurator: function(aType) {
debug("_getMessageConfigurator for type: " + aType);
if (this._configurators[aType] === undefined) {
let contractID = "@mozilla.org/dom/system-messages/configurator/" + aType + ";1";
@ -107,7 +107,7 @@ SystemMessageInternal.prototype = {
return this._configurators[aType] || defaultMessageConfigurator;
},
_cancelCpuWakeLock: function _cancelCpuWakeLock(aPageKey) {
_cancelCpuWakeLock: function(aPageKey) {
let cpuWakeLock = this._cpuWakeLocks[aPageKey];
if (cpuWakeLock) {
debug("Releasing the CPU wake lock for page key = " + aPageKey);
@ -117,7 +117,7 @@ SystemMessageInternal.prototype = {
}
},
_acquireCpuWakeLock: function _acquireCpuWakeLock(aPageKey) {
_acquireCpuWakeLock: function(aPageKey) {
let cpuWakeLock = this._cpuWakeLocks[aPageKey];
if (!cpuWakeLock) {
// We have to ensure the CPU doesn't sleep during the process of the page
@ -157,7 +157,7 @@ SystemMessageInternal.prototype = {
}
},
_findPage: function _findPage(aType, aPageURL, aManifestURL) {
_findPage: function(aType, aPageURL, aManifestURL) {
let page = null;
this._pages.some(function(aPage) {
if (this._isPageMatched(aPage, aType, aPageURL, aManifestURL)) {
@ -168,7 +168,7 @@ SystemMessageInternal.prototype = {
return page;
},
sendMessage: function sendMessage(aType, aMessage, aPageURI, aManifestURI, aExtra) {
sendMessage: function(aType, aMessage, aPageURI, aManifestURI, aExtra) {
// Buffer system messages until the webapps' registration is ready,
// so that we can know the correct pages registered to be sent.
if (!this._webappsRegistryReady) {
@ -212,7 +212,7 @@ SystemMessageInternal.prototype = {
}
},
broadcastMessage: function broadcastMessage(aType, aMessage, aExtra) {
broadcastMessage: function(aType, aMessage, aExtra) {
// Buffer system messages until the webapps' registration is ready,
// so that we can know the correct pages registered to be broadcasted.
if (!this._webappsRegistryReady) {
@ -255,7 +255,7 @@ SystemMessageInternal.prototype = {
}, this);
},
registerPage: function registerPage(aType, aPageURI, aManifestURI) {
registerPage: function(aType, aPageURI, aManifestURI) {
if (!aPageURI || !aManifestURI) {
throw Cr.NS_ERROR_INVALID_ARG;
}
@ -277,7 +277,7 @@ SystemMessageInternal.prototype = {
pendingMessages: [] });
},
_findTargetIndex: function _findTargetIndex(aTargets, aTarget) {
_findTargetIndex: function(aTargets, aTarget) {
if (!aTargets || !aTarget) {
return -1;
}
@ -290,17 +290,14 @@ SystemMessageInternal.prototype = {
return -1;
},
_isEmptyObject: function _isEmptyObject(aObj) {
_isEmptyObject: function(aObj) {
for (let name in aObj) {
return false;
}
return true;
},
_removeTargetFromListener: function _removeTargetFromListener(aTarget,
aManifest,
aRemoveListener,
aUri) {
_removeTargetFromListener: function(aTarget, aManifest, aRemoveListener, aUri) {
let targets = this._listeners[aManifest];
if (!targets) {
return false;
@ -336,7 +333,7 @@ SystemMessageInternal.prototype = {
return true;
},
receiveMessage: function receiveMessage(aMessage) {
receiveMessage: function(aMessage) {
let msg = aMessage.json;
// To prevent the hacked child process from sending commands to parent
@ -480,7 +477,7 @@ SystemMessageInternal.prototype = {
}
},
observe: function observe(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "xpcom-shutdown":
kMessages.forEach(function(aMsg) {
@ -516,7 +513,7 @@ SystemMessageInternal.prototype = {
}
},
_queueMessage: function _queueMessage(aPage, aMessage, aMessageID) {
_queueMessage: function(aPage, aMessage, aMessageID) {
// Queue the message for this page because we've never known if an app is
// opened or not. We'll clean it up when the app has already received it.
aPage.pendingMessages.push({ msg: aMessage, msgID: aMessageID });
@ -525,7 +522,7 @@ SystemMessageInternal.prototype = {
}
},
_openAppPage: function _openAppPage(aPage, aMessage, aExtra, aMsgSentStatus) {
_openAppPage: function(aPage, aMessage, aExtra, aMsgSentStatus) {
// This means the app must be brought to the foreground.
let showApp = this._getMessageConfigurator(aPage.type).mustShowRunningApp;
@ -551,7 +548,7 @@ SystemMessageInternal.prototype = {
Services.obs.notifyObservers(this, "system-messages-open-app", JSON.stringify(page));
},
_isPageMatched: function _isPageMatched(aPage, aType, aPageURI, aManifestURI) {
_isPageMatched: function(aPage, aType, aPageURI, aManifestURI) {
return (aPage.type === aType &&
aPage.manifest === aManifestURI &&
aPage.uri === aPageURI)
@ -575,8 +572,8 @@ SystemMessageInternal.prototype = {
return hasher.finish(true);
},
_sendMessageCommon:
function _sendMessageCommon(aType, aMessage, aMessageID, aPageURI, aManifestURI, aExtra) {
_sendMessageCommon: function(aType, aMessage, aMessageID,
aPageURI, aManifestURI, aExtra) {
// Don't send the system message not granted by the app's permissions.
if (!SystemMessagePermissionsChecker
.isSystemMessagePermittedToSend(aType,

View File

@ -57,7 +57,7 @@ function SystemMessageManager() {
SystemMessageManager.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
_dispatchMessage: function sysMessMgr_dispatchMessage(aType, aDispatcher, aMessage) {
_dispatchMessage: function(aType, aDispatcher, aMessage) {
if (aDispatcher.isHandling) {
// Queue up the incomming message if we're currently dispatching a
// message; we'll send the message once we finish with the current one.
@ -109,7 +109,7 @@ SystemMessageManager.prototype = {
}
},
mozSetMessageHandler: function sysMessMgr_setMessageHandler(aType, aHandler) {
mozSetMessageHandler: function(aType, aHandler) {
debug("set message handler for [" + aType + "] " + aHandler);
if (this._isInBrowserElement) {
@ -141,7 +141,7 @@ SystemMessageManager.prototype = {
manifest: this._manifest });
},
mozHasPendingMessage: function sysMessMgr_hasPendingMessage(aType) {
mozHasPendingMessage: function(aType) {
debug("asking pending message for [" + aType + "]");
if (this._isInBrowserElement) {
@ -161,7 +161,7 @@ SystemMessageManager.prototype = {
manifest: this._manifest })[0];
},
uninit: function sysMessMgr_uninit() {
uninit: function() {
this._dispatchers = null;
this._pendings = null;
@ -191,7 +191,7 @@ SystemMessageManager.prototype = {
// This one will be received when the starting child process wants to
// retrieve the pending system messages from the parent (i.e. after
// sending SystemMessageManager:GetPendingMessages).
receiveMessage: function sysMessMgr_receiveMessage(aMessage) {
receiveMessage: function(aMessage) {
let msg = aMessage.data;
debug("receiveMessage " + aMessage.name + " for [" + msg.type + "] " +
"with manifest = " + msg.manifest + " and uri = " + msg.uri);
@ -245,7 +245,7 @@ SystemMessageManager.prototype = {
},
// nsIDOMGlobalPropertyInitializer implementation.
init: function sysMessMgr_init(aWindow) {
init: function(aWindow) {
debug("init");
this.initDOMRequestHelper(aWindow, ["SystemMessageManager:Message",
"SystemMessageManager:GetPendingMessages:Return"]);
@ -277,7 +277,7 @@ SystemMessageManager.prototype = {
debug("done");
},
observe: function sysMessMgr_observe(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
if (aTopic === kSystemMessageInternalReady) {
this._registerManifest();
}
@ -286,7 +286,7 @@ SystemMessageManager.prototype = {
this.__proto__.__proto__.observe.call(this, aSubject, aTopic, aData);
},
_registerManifest: function sysMessMgr_registerManifest() {
_registerManifest: function() {
if (this._isInBrowserElement) {
debug("the app loaded in the browser doesn't need to register " +
"the manifest for listening to the system messages");