diff --git a/browser/root-certs b/browser/root-certs index f76bc74..6c57965 100755 --- a/browser/root-certs +++ b/browser/root-certs @@ -34,8 +34,6 @@ function getRootCerts(callback) { + '"' + key + '":\n'; }); body += '' - + '\n' - + 'certs.__proto__ = null;\n' + '\n' + '// Use hash table for efficiency:\n' + 'var trusted = Object.keys(certs).reduce(function(trusted, key) {\n' @@ -45,20 +43,20 @@ function getRootCerts(callback) { + ' pem = pem.replace(/\\s+/g, "");\n' + ' trusted[pem] = key;\n' + ' return trusted;\n' - + '}, { __proto__: null });\n' + + '}, {});\n' + '\n' + 'function getTrusted(pem) {\n' + ' pem = pem + "";\n' + ' pem = pem.replace(/-----BEGIN CERTIFICATE-----/g, "");\n' + ' pem = pem.replace(/-----END CERTIFICATE-----/g, "");\n' + ' pem = pem.replace(/\\s+/g, "");\n' - + ' if (pem === "__proto__") return;\n' + + ' if (!Object.prototype.hasOwnProperty.call(certs, pem)) return;\n' + ' return certs[pem];\n' + '}\n' + '\n' + 'function getCert(name) {\n' + ' name = name.replace(/^\s+|\s+$/g, "");\n' - + ' if (name === "__proto__") return;\n' + + ' if (!Object.prototype.hasOwnProperty.call(trusted, name)) return;\n' + ' return trusted[name];\n' + '}\n' + '\n' diff --git a/lib/common/RootCerts.js b/lib/common/RootCerts.js index f4efa35..5c5629e 100644 --- a/lib/common/RootCerts.js +++ b/lib/common/RootCerts.js @@ -3704,8 +3704,6 @@ var certs = { + "-----END CERTIFICATE-----\n" }; -certs.__proto__ = null; - // Use hash table for efficiency: var trusted = Object.keys(certs).reduce(function(trusted, key) { var pem = certs[key]; @@ -3714,20 +3712,20 @@ var trusted = Object.keys(certs).reduce(function(trusted, key) { pem = pem.replace(/\s+/g, ""); trusted[pem] = key; return trusted; -}, { __proto__: null }); +}, {}); function getTrusted(pem) { pem = pem + ""; pem = pem.replace(/-----BEGIN CERTIFICATE-----/g, ""); pem = pem.replace(/-----END CERTIFICATE-----/g, ""); pem = pem.replace(/\s+/g, ""); - if (pem === "__proto__") return; + if (!Object.prototype.hasOwnProperty.call(certs, pem)) return; return certs[pem]; } function getCert(name) { name = name.replace(/^s+|s+$/g, ""); - if (name === "__proto__") return; + if (!Object.prototype.hasOwnProperty.call(trusted, name)) return; return trusted[name]; }