Bug 393285 - "Add OS and ABI for restricting the blocklist checks" [p=Mossop r=rob_strong a=blocking-firefox3+]

git-svn-id: svn://10.0.0.236/trunk@238887 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
reed%reedloden.com
2007-11-07 08:56:29 +00:00
parent 38c9a8fa13
commit 09537b38af

View File

@@ -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) {