mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 722978 - Port the certificate exception UI to the new per-window private browsing API; r=jdm
--HG-- extra : rebase_source : a49d0c630a170a950dd830ad484e084a29f8b51f
This commit is contained in:
parent
c8cb13bace
commit
115ba5a2eb
@ -2549,7 +2549,7 @@ let BrowserOnClick = {
|
||||
switch (elmId) {
|
||||
case "exceptionDialogButton":
|
||||
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_CLICK_ADD_EXCEPTION);
|
||||
let params = { exceptionAdded : false, handlePrivateBrowsing : true };
|
||||
let params = { exceptionAdded : false };
|
||||
|
||||
try {
|
||||
switch (Services.prefs.getIntPref("browser.ssl_override_behavior")) {
|
||||
|
@ -19,14 +19,13 @@ function test() {
|
||||
// enter private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
||||
step1();
|
||||
doTest();
|
||||
|
||||
// Test the certificate exceptions dialog as it is invoked from about:certerror
|
||||
function step1() {
|
||||
// Test the certificate exceptions dialog
|
||||
function doTest() {
|
||||
let params = {
|
||||
exceptionAdded : false,
|
||||
location: INVALID_CERT_LOCATION,
|
||||
handlePrivateBrowsing : true,
|
||||
prefetchCert: true,
|
||||
};
|
||||
function testCheckbox() {
|
||||
@ -41,32 +40,6 @@ function test() {
|
||||
ok(!checkbox.hasAttribute("checked"),
|
||||
"the permanent checkbox should not be checked when handling the private browsing mode");
|
||||
win.close();
|
||||
step2();
|
||||
}, "cert-exception-ui-ready", false);
|
||||
}
|
||||
var win = openDialog(EXCEPTIONS_DLG_URL, "", EXCEPTIONS_DLG_FEATURES, params);
|
||||
win.addEventListener("load", testCheckbox, false);
|
||||
}
|
||||
|
||||
// Test the certificate excetions dialog as it is invoked from the Preferences dialog
|
||||
function step2() {
|
||||
let params = {
|
||||
exceptionAdded : false,
|
||||
location: INVALID_CERT_LOCATION,
|
||||
prefetchCert: true,
|
||||
};
|
||||
function testCheckbox() {
|
||||
win.removeEventListener("load", testCheckbox, false);
|
||||
Services.obs.addObserver(function (aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(arguments.callee, "cert-exception-ui-ready", false);
|
||||
ok(win.gCert, "The certificate information should be available now");
|
||||
|
||||
let checkbox = win.document.getElementById("permanent");
|
||||
ok(!checkbox.hasAttribute("disabled"),
|
||||
"the permanent checkbox should not be disabled when not handling the private browsing mode");
|
||||
ok(checkbox.hasAttribute("checked"),
|
||||
"the permanent checkbox should be checked when not handling the private browsing mode");
|
||||
win.close();
|
||||
cleanup();
|
||||
}, "cert-exception-ui-ready", false);
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ var gNeedReset;
|
||||
var gSecHistogram;
|
||||
var gNsISecTel;
|
||||
|
||||
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
function badCertListener() {}
|
||||
badCertListener.prototype = {
|
||||
getInterface: function (aIID) {
|
||||
@ -379,22 +381,8 @@ function addException() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the private browsing mode is currently active and
|
||||
* we have been instructed to handle it.
|
||||
* Returns true if this dialog is in private browsing mode.
|
||||
*/
|
||||
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;
|
||||
return PrivateBrowsingUtils.isWindowPrivate(window);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user