diff --git a/browser/components/preferences/security.js b/browser/components/preferences/security.js index ae2900361c..35caaceab1 100644 --- a/browser/components/preferences/security.js +++ b/browser/components/preferences/security.js @@ -15,6 +15,7 @@ var gSecurityPane = { { this._pane = document.getElementById("paneSecurity"); this._initMasterPasswordUI(); + this._initHPKPUI(); }, // ADD-ONS @@ -219,6 +220,31 @@ var gSecurityPane = { document.documentElement.openWindow("Toolkit:PasswordManager", "chrome://passwordmgr/content/passwordManager.xul", "", null); - } + }, + + _initHPKPUI: function() { + let checkbox = document.getElementById("enableHPKP"); + let HPKPpref = document.getElementById("security.cert_pinning.enforcement_level"); + if (HPKPpref.value == 0) { + checkbox.checked = false; + } else { + checkbox.checked = true; + } + }, + + /** + * Updates the HPKP enforcement level to the proper value depending on checkbox + * state. + */ + updateHPKPPref: function() { + let checkbox = document.getElementById("enableHPKP"); + let HPKPpref = document.getElementById("security.cert_pinning.enforcement_level"); + + if (checkbox.checked) { + HPKPpref.value = 2; + } else { + HPKPpref.value = 0; + } + } }; diff --git a/browser/components/preferences/security.xul b/browser/components/preferences/security.xul index 35a6e1b66e..9e5870b209 100644 --- a/browser/components/preferences/security.xul +++ b/browser/components/preferences/security.xul @@ -41,6 +41,15 @@ + + + + + + + + + + + + + +