Bug 866366 - [Buri][Alarm]it will not start alarm until light up the LCD (follow-up patch, part 1). r=jlebar,fabrice a=tef+

This commit is contained in:
Gene Lian 2013-05-23 17:53:40 +08:00
parent 29f9b9a792
commit 2011b60d38
2 changed files with 24 additions and 24 deletions

View File

@ -237,13 +237,15 @@ SystemMessageInternal.prototype = {
break;
case "SystemMessageManager:Register":
{
debug("Got Register from " + msg.manifest);
debug("Got Register from " + msg.uri + " @ " + msg.manifest);
let targets, index;
if (!(targets = this._listeners[msg.manifest])) {
this._listeners[msg.manifest] = [{ target: aMessage.target,
uri: msg.uri,
winCount: 1 }];
} else if ((index = this._findTargetIndex(targets, aMessage.target)) === -1) {
targets.push({ target: aMessage.target,
uri: msg.uri,
winCount: 1 });
} else {
targets[index].winCount++;
@ -301,7 +303,6 @@ SystemMessageInternal.prototype = {
aMessage.target.sendAsyncMessage("SystemMessageManager:GetPendingMessages:Return",
{ type: msg.type,
manifest: msg.manifest,
uri: msg.uri,
msgQueue: pendingMessages });
break;
}
@ -443,13 +444,17 @@ SystemMessageInternal.prototype = {
let targets = this._listeners[aManifestURI];
if (targets) {
for (let index = 0; index < targets.length; ++index) {
let manager = targets[index].target;
manager.sendAsyncMessage("SystemMessageManager:Message",
{ type: aType,
msg: aMessage,
manifest: aManifestURI,
uri: aPageURI,
msgID: aMessageID });
let target = targets[index];
// We only need to send the system message to the targets which match
// the manifest URL and page URL of the destination of system message.
if (target.uri != aPageURI) {
continue;
}
let manager = target.target;
manager.sendAsyncMessage("SystemMessageManager:Message",
{ type: aType,
msg: aMessage,
msgID: aMessageID });
}
}

View File

@ -148,29 +148,23 @@ SystemMessageManager.prototype = {
cpmm.sendAsyncMessage("SystemMessageManager:Unregister",
{ manifest: this._manifest,
innerWindowID: this.innerWindowID
});
innerWindowID: this.innerWindowID });
},
receiveMessage: function sysMessMgr_receiveMessage(aMessage) {
debug("receiveMessage " + aMessage.name + " for [" + aMessage.data.type + "] " +
"with manifest = " + aMessage.data.manifest + " (" + this._manifest + ") " +
"and uri = " + aMessage.data.uri + " (" + this._uri + ")");
"with manifest = " + this._manifest + " and uri = " + this._uri);
let msg = aMessage.data;
if (msg.manifest != this._manifest || msg.uri != this._uri) {
return;
}
if (aMessage.name == "SystemMessageManager:Message") {
// Send an acknowledgement to parent to clean up the pending message,
// so a re-launched app won't handle it again, which is redundant.
cpmm.sendAsyncMessage(
"SystemMessageManager:Message:Return:OK",
{ type: msg.type,
manifest: msg.manifest,
uri: msg.uri,
msgID: msg.msgID });
cpmm.sendAsyncMessage("SystemMessageManager:Message:Return:OK",
{ type: msg.type,
manifest: this._manifest,
uri: this._uri,
msgID: msg.msgID });
}
// Bail out if we have no handlers registered for this type.
@ -239,8 +233,9 @@ SystemMessageManager.prototype = {
if (!this._registerManifestReady) {
cpmm.sendAsyncMessage("SystemMessageManager:Register",
{ manifest: this._manifest,
innerWindowID: this.innerWindowID
});
uri: this._uri,
innerWindowID: this.innerWindowID });
this._registerManifestReady = true;
}
},