diff --git a/mozilla/toolkit/mozapps/extensions/src/nsBlocklistService.js b/mozilla/toolkit/mozapps/extensions/src/nsBlocklistService.js index fa3b87dbee1..8ca2033162d 100644 --- a/mozilla/toolkit/mozapps/extensions/src/nsBlocklistService.js +++ b/mozilla/toolkit/mozapps/extensions/src/nsBlocklistService.js @@ -178,6 +178,28 @@ function newURI(spec) { return ioServ.newURI(spec, null, null); } +/** + * Checks whether this blocklist element is valid for the current OS and ABI. + * If the element has an "os" attribute then the current OS must appear in + * it's comma separated list for the element to be valid. Similarly for the + * xpcomabi attribute. + */ +function matchesOSABI(blocklistElement) { + if (blocklistElement.hasAttribute("os")) { + var choices = blocklistElement.getAttribute("os").split(","); + if (choices.length > 0 && choices.indexOf(gApp.OS) < 0) + return false; + } + + if (blocklistElement.hasAttribute("xpcomabi")) { + choices = blocklistElement.getAttribute("xpcomabi").split(","); + if (choices.length > 0 && choices.indexOf(gApp.XPCOMABI) < 0) + return false; + } + + return true; +} + /** * Manages the Blocklist. The Blocklist is a representation of the contents of * blocklist.xml and allows us to remotely disable / re-enable blocklisted @@ -498,6 +520,9 @@ Blocklist.prototype = { }, _handleEmItemNode: function(blocklistElement, result) { + if (!matchesOSABI(blocklistElement)) + return; + var versionNodes = blocklistElement.childNodes; var id = blocklistElement.getAttribute("id"); result[id] = []; @@ -516,6 +541,9 @@ Blocklist.prototype = { }, _handlePluginItemNode: function(blocklistElement, result) { + if (!matchesOSABI(blocklistElement)) + return; + var matchNodes = blocklistElement.childNodes; var matchList; for (var x = 0; x < matchNodes.length; ++x) {