зеркало из https://github.com/mozilla/gecko-dev.git
Bug 461627 - Hide the UI for saving certificate exceptions permanently in Private Browsing mode; r=kaie,gavin
This commit is contained in:
Родитель
5b1040a743
Коммит
65057a4354
|
@ -2286,7 +2286,7 @@ function BrowserOnCommand(event) {
|
|||
// Exception…" or "Get me out of here!" button
|
||||
if (/^about:certerror/.test(errorDoc.documentURI)) {
|
||||
if (ot == errorDoc.getElementById('exceptionDialogButton')) {
|
||||
var params = { exceptionAdded : false };
|
||||
var params = { exceptionAdded : false, handlePrivateBrowsing : true };
|
||||
|
||||
try {
|
||||
switch (gPrefService.getIntPref("browser.ssl_override_behavior")) {
|
||||
|
|
|
@ -83,19 +83,6 @@ function initExceptionDialog() {
|
|||
[brandName], 1));
|
||||
gDialog.getButton("extra1").disabled = true;
|
||||
|
||||
// If the Private Browsing service is available and the mode is active,
|
||||
// don't store permanent exceptions, since they would persist after
|
||||
// private browsing mode was disabled.
|
||||
try {
|
||||
var pb = Components.classes["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Components.interfaces.nsIPrivateBrowsingService);
|
||||
if (pb.privateBrowsingEnabled) {
|
||||
var permanentCheckbox = document.getElementById("permanent");
|
||||
permanentCheckbox.setAttribute("disabled", "true");
|
||||
permanentCheckbox.removeAttribute("checked");
|
||||
}
|
||||
} catch (ex) {}
|
||||
|
||||
var args = window.arguments;
|
||||
if (args && args[0]) {
|
||||
if (args[0].location) {
|
||||
|
@ -300,7 +287,15 @@ function updateCertStatus() {
|
|||
|
||||
// In these cases, we do want to enable the "Add Exception" button
|
||||
gDialog.getButton("extra1").disabled = false;
|
||||
document.getElementById("permanent").disabled = false;
|
||||
|
||||
// If the Private Browsing service is available and the mode is active,
|
||||
// don't store permanent exceptions, since they would persist after
|
||||
// private browsing mode was disabled.
|
||||
var inPrivateBrowsing = inPrivateBrowsingMode();
|
||||
var pe = document.getElementById("permanent");
|
||||
pe.disabled = inPrivateBrowsing;
|
||||
pe.checked = !inPrivateBrowsing;
|
||||
|
||||
setText("headerDescription", gPKIBundle.GetStringFromName("addExceptionInvalidHeader"));
|
||||
}
|
||||
else {
|
||||
|
@ -370,13 +365,14 @@ function addException() {
|
|||
flags |= overrideService.ERROR_TIME;
|
||||
|
||||
var permanentCheckbox = document.getElementById("permanent");
|
||||
var shouldStorePermanently = permanentCheckbox.checked && !inPrivateBrowsingMode();
|
||||
|
||||
var uri = getURI();
|
||||
overrideService.rememberValidityOverride(
|
||||
uri.asciiHost, uri.port,
|
||||
gCert,
|
||||
flags,
|
||||
!permanentCheckbox.checked);
|
||||
!shouldStorePermanently);
|
||||
|
||||
var args = window.arguments;
|
||||
if (args && args[0])
|
||||
|
@ -384,3 +380,24 @@ function addException() {
|
|||
|
||||
gDialog.acceptDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the private browsing mode is currently active and
|
||||
* we have been instructed to handle it.
|
||||
*/
|
||||
function inPrivateBrowsingMode() {
|
||||
// first, check to see if we should handle the private browsing mode
|
||||
var args = window.arguments;
|
||||
if (args && args[0] && args[0].handlePrivateBrowsing) {
|
||||
// detect if the private browsing mode is active
|
||||
try {
|
||||
var pb = Components.classes["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Components.interfaces.nsIPrivateBrowsingService);
|
||||
return pb.privateBrowsingEnabled;
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Could not get the Private Browsing service");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
<description id="status3LongDescription" style="white-space: pre-wrap;"/>
|
||||
<spacer flex="1"/>
|
||||
</vbox>
|
||||
<checkbox id="permanent" checked="true" disabled="true"
|
||||
<checkbox id="permanent" disabled="true"
|
||||
label="&exceptionMgr.permanent.label;"
|
||||
accesskey="&exceptionMgr.permanent.accesskey;"/>
|
||||
</groupbox>
|
||||
|
|
Загрузка…
Ссылка в новой задаче