summaryrefslogtreecommitdiffstats
path: root/security/manager
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-08-17 22:33:51 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-08-17 22:33:51 +0200
commita63272b5303b7aef467e974c630f745146fb983a (patch)
tree4af6aa2ad862cf198261f5860d9451f07a0bd45f /security/manager
parent3252e220000430851ce92446f0fd1336258c7584 (diff)
downloadUXP-a63272b5303b7aef467e974c630f745146fb983a.tar
UXP-a63272b5303b7aef467e974c630f745146fb983a.tar.gz
UXP-a63272b5303b7aef467e974c630f745146fb983a.tar.lz
UXP-a63272b5303b7aef467e974c630f745146fb983a.tar.xz
UXP-a63272b5303b7aef467e974c630f745146fb983a.zip
No issue: Clean up `exceptionDialog.js`
- Fix some quoting, comments and inconsistencies and code style - Swap manually grabbing service components out for using `Services.*`
Diffstat (limited to 'security/manager')
-rw-r--r--security/manager/pki/resources/content/exceptionDialog.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/security/manager/pki/resources/content/exceptionDialog.js b/security/manager/pki/resources/content/exceptionDialog.js
index cebf51fa1..9d70ebdce 100644
--- a/security/manager/pki/resources/content/exceptionDialog.js
+++ b/security/manager/pki/resources/content/exceptionDialog.js
@@ -31,7 +31,7 @@ function initExceptionDialog() {
if (args[0].location) {
// We were pre-seeded with a location.
document.getElementById("locationTextBox").value = args[0].location;
- document.getElementById('checkCertButton').disabled = false;
+ document.getElementById("checkCertButton").disabled = false;
if (args[0].sslStatus) {
gSSLStatus = args[0].sslStatus;
@@ -108,15 +108,17 @@ function checkCert() {
/**
* Build and return a URI, based on the information supplied in the
* Certificate Location fields
+ *
+ * @returns {nsIURI}
+ * URI constructed from the information supplied on success, null
+ * otherwise.
*/
function getURI() {
// Use fixup service instead of just ioservice's newURI since it's quite
// likely that the host will be supplied without a protocol prefix, resulting
// in malformed uri exceptions being thrown.
- let fus = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(Components.interfaces.nsIURIFixup);
let locationTextBox = document.getElementById("locationTextBox");
- let uri = fus.createFixupURI(locationTextBox.value, 0);
+ let uri = Services.uriFixup.createFixupURI(locationTextBox.value, 0);
if (!uri) {
return null;
@@ -150,7 +152,7 @@ function resetDialog() {
* Called by input textboxes to manage UI state
*/
function handleTextChange() {
- var checkCertButton = document.getElementById('checkCertButton');
+ var checkCertButton = document.getElementById("checkCertButton");
checkCertButton.disabled = !(document.getElementById("locationTextBox").value);
if (gNeedReset) {
gNeedReset = false;
@@ -218,8 +220,7 @@ function updateCertStatus() {
pe.checked = !inPrivateBrowsing;
setText("headerDescription", gPKIBundle.getString("addExceptionInvalidHeader"));
- }
- else {
+ } else {
shortDesc = "addExceptionValidShort";
longDesc = "addExceptionValidLong";
gDialog.getButton("extra1").disabled = true;
@@ -231,11 +232,8 @@ function updateCertStatus() {
document.getElementById("viewCertButton").disabled = false;
// Notify observers about the availability of the certificate
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .notifyObservers(null, "cert-exception-ui-ready", null);
- }
- else if (gChecking) {
+ Services.obs.notifyObservers(null, "cert-exception-ui-ready");
+ } else if (gChecking) {
shortDesc = "addExceptionCheckingShort";
longDesc = "addExceptionCheckingLong2";
// We're checking the certificate, so we disable the Get Certificate
@@ -245,8 +243,7 @@ function updateCertStatus() {
document.getElementById("viewCertButton").disabled = true;
gDialog.getButton("extra1").disabled = true;
document.getElementById("permanent").disabled = true;
- }
- else {
+ } else {
shortDesc = "addExceptionNoCertShort";
longDesc = "addExceptionNoCertLong2";
// We're done checking the certificate, so allow the user to check it again.