Bug 1129040 - In the content process blocklist shim fail in all addon related calls. r=Mossop

This commit is contained in:
Jim Mathies 2015-05-01 10:07:19 -05:00
parent d4f9c00f75
commit a2b9aede2e
3 changed files with 12 additions and 3 deletions

View File

@ -428,6 +428,7 @@
@RESPATH@/components/amInstallTrigger.js
@RESPATH@/components/amWebInstallListener.js
@RESPATH@/components/nsBlocklistService.js
@RESPATH@/components/nsBlocklistServiceContent.js
#ifdef MOZ_UPDATER
@RESPATH@/components/nsUpdateService.manifest
@RESPATH@/components/nsUpdateService.js

View File

@ -299,6 +299,7 @@ function Blocklist() {
this.wrappedJSObject = this;
// requests from child processes come in here, see receiveMessage.
Services.ppmm.addMessageListener("Blocklist:getPluginBlocklistState", this);
Services.ppmm.addMessageListener("Blocklist:content-blocklist-updated", this);
}
Blocklist.prototype = {
@ -323,6 +324,7 @@ Blocklist.prototype = {
shutdown: function () {
Services.obs.removeObserver(this, "xpcom-shutdown");
Services.ppmm.removeMessageListener("Blocklist:getPluginBlocklistState", this);
Services.ppmm.removeMessageListener("Blocklist:content-blocklist-updated", this);
gPref.removeObserver("extensions.blocklist.", this);
gPref.removeObserver(PREF_EM_LOGGING_ENABLED, this);
},
@ -363,6 +365,9 @@ Blocklist.prototype = {
return this.getPluginBlocklistState(aMsg.data.addonData,
aMsg.data.appVersion,
aMsg.data.toolkitVersion);
case "Blocklist:content-blocklist-updated":
Services.obs.notifyObservers(null, "content-blocklist-updated", null);
break;
default:
throw new Error("Unknown blocklist message received from content: " + aMsg.name);
}

View File

@ -27,7 +27,8 @@ function Blocklist() {
Blocklist.prototype = {
classID: Components.ID("{e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBlocklistService]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsIBlocklistService]),
init: function () {
Services.cpmm.addMessageListener("Blocklist:blocklistInvalidated", this);
@ -52,6 +53,7 @@ Blocklist.prototype = {
switch (aMsg.name) {
case "Blocklist:blocklistInvalidated":
Services.obs.notifyObservers(null, "blocklist-updated", null);
Services.cpmm.sendAsyncMessage("Blocklist:content-blocklist-updated");
break;
default:
throw new Error("Unknown blocklist message received from content: " + aMsg.name);
@ -79,13 +81,14 @@ Blocklist.prototype = {
// only calls getPluginBlocklistState.
isAddonBlocklisted: function (aAddon, aAppVersion, aToolkitVersion) {
throw new Error(kMissingAPIMessage);
return true;
},
getAddonBlocklistState: function (aAddon, aAppVersion, aToolkitVersion) {
throw new Error(kMissingAPIMessage);
return Components.interfaces.nsIBlocklistService.STATE_BLOCKED;
},
// There are a few callers in layout that rely on this.
getPluginBlocklistState: function (aPluginTag, aAppVersion, aToolkitVersion) {
return Services.cpmm.sendSyncMessage("Blocklist:getPluginBlocklistState", {
addonData: this.flattenObject(aPluginTag),