mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1162899 - Use sync message for in-process mozHasPendingMessage. r=fabrice
This commit is contained in:
parent
7d7c2e5ca3
commit
24103c02e5
@ -40,6 +40,7 @@ try {
|
||||
}
|
||||
|
||||
const kMessages =["SystemMessageManager:GetPendingMessages",
|
||||
"SystemMessageManager:HasPendingMessages",
|
||||
"SystemMessageManager:Register",
|
||||
"SystemMessageManager:Unregister",
|
||||
"SystemMessageManager:Message:Return:OK",
|
||||
@ -419,6 +420,7 @@ SystemMessageInternal.prototype = {
|
||||
// TODO: fix bug 988142 to re-enable.
|
||||
// "SystemMessageManager:Unregister",
|
||||
"SystemMessageManager:GetPendingMessages",
|
||||
"SystemMessageManager:HasPendingMessages",
|
||||
"SystemMessageManager:Message:Return:OK",
|
||||
"SystemMessageManager:HandleMessagesDone",
|
||||
"SystemMessageManager:HandleMessageDone"].indexOf(aMessage.name) != -1) {
|
||||
@ -519,6 +521,25 @@ SystemMessageInternal.prototype = {
|
||||
this._refreshCacheInternal(aMessage.target, msg.manifestURL);
|
||||
break;
|
||||
}
|
||||
case "SystemMessageManager:HasPendingMessages":
|
||||
{
|
||||
debug("received SystemMessageManager:HasPendingMessages " + msg.type +
|
||||
" for " + msg.pageURL + " @ " + msg.manifestURL);
|
||||
|
||||
// NB: Sync message SystemMessageManager:HasPendingMessages
|
||||
// should only be used by in-process app. For out-of-process
|
||||
// app, SystemMessageCache should be used.
|
||||
|
||||
// This is a sync call used to return if a page has pending messages.
|
||||
// Find the right page to get its corresponding pending messages.
|
||||
let page = this._findPage(msg.type, msg.pageURL, msg.manifestURL);
|
||||
if (!page) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return page.pendingMessages.length != 0;
|
||||
break;
|
||||
}
|
||||
case "SystemMessageManager:Message:Return:OK":
|
||||
{
|
||||
debug("received SystemMessageManager:Message:Return:OK " + msg.type +
|
||||
|
@ -194,6 +194,14 @@ SystemMessageManager.prototype = {
|
||||
}
|
||||
|
||||
|
||||
// Use SystemMessageManager directly when we are in the same process.
|
||||
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_DEFAULT) {
|
||||
return cpmm.sendSyncMessage("SystemMessageManager:HasPendingMessages",
|
||||
{ type: aType,
|
||||
pageURL: this._pageURL,
|
||||
manifestURL: this._manifestURL })[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* NB: If the system message is fired after we received the cache
|
||||
* and before we registered the pageURL we will get false
|
||||
|
Loading…
Reference in New Issue
Block a user