From 6b09b252c8ea277a3f006a319c5d836a18f096ea Mon Sep 17 00:00:00 2001 From: Thomas Groman Date: Mon, 20 Apr 2020 22:50:43 -0700 Subject: Remove cert9.db and key4.db from profile if they exist. resolves #1711 (https://github.com/MoonchildProductions/Pale-Moon/issues/1711) --- webbrowser/components/nsBrowserGlue.js | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'webbrowser') diff --git a/webbrowser/components/nsBrowserGlue.js b/webbrowser/components/nsBrowserGlue.js index e8eefa4..b4f7cf1 100644 --- a/webbrowser/components/nsBrowserGlue.js +++ b/webbrowser/components/nsBrowserGlue.js @@ -1198,7 +1198,7 @@ BrowserGlue.prototype = { }, _migrateUI: function BG__migrateUI() { - const UI_VERSION = 20; + const UI_VERSION = 21; const BROWSER_DOCURL = "chrome://browser/content/browser.xul#"; let currentUIVersion = 0; try { @@ -1240,10 +1240,33 @@ BrowserGlue.prototype = { } #endif - if (currentUIVersion < 20) { - // HPKP change of UI preference; reset enforcement level - Services.prefs.clearUserPref("security.cert_pinning.eforcement_level"); - } +if (currentUIVersion < 20) { + // HPKP change of UI preference; reset enforcement level + Services.prefs.clearUserPref("security.cert_pinning.eforcement_level"); +} + +if (currentUIVersion < 21) { + //remove key4.db and cert9.db if those files exist + // XXX: Remove this code block once we actually start using them. + let dsCertFile = Cc["@mozilla.org/file/directory_service;1"] + .getService(Ci.nsIProperties) + .get("ProfD", Ci.nsIFile); + dsKeyFile = dsCertFile.clone(); + dsCertFile.append("cert9.db"); + if (dsCertFile.exists()) { + try { dsCertFile.remove(false); } catch(e) {} + } + if ((dsKeyFile.exists()) { + try { dsKeyFile.remove(false); } catch(e) {} + } +} + +// Clear out dirty storage +if (this._dirty) + this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush(); + +delete this._rdf; +delete this._dataSource; // Update the migration version. Services.prefs.setIntPref("browser.migration.version", UI_VERSION); -- cgit v1.2.3