Remove unused UntrustedHttpsRequest bits.
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Wed, 21 Apr 2010 10:23:07 -0700
changeset 50 e3227b18fe5c477bc9b17e307dc779315e838854
parent 49 08f26a9e7a698413330017b96068cb2d6744351c
child 51 b1e7a7c55ea0c9c872ab8fc62fe31aa0f4910f8d
push id26
push usersdwilsh@shawnwilsher.com
push dateWed, 21 Apr 2010 21:00:51 +0000
Remove unused UntrustedHttpsRequest bits.
content/UntrustedHttpsRequest.js
content/reply.xul
deleted file mode 100644
--- a/content/UntrustedHttpsRequest.js
+++ /dev/null
@@ -1,103 +0,0 @@
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-/**
- * Wraps an XMLHttpRequest to make a safe and secure connection to an untrusted
- * https server.  Consumers MUST provide an MD5 fingerprint of the server the
- * connection is going to for this to be safe.
- *
- * This object can then be used just like an XMLHttpRequest object.
- *
- * @param aFingerprint
- *        The MD5 fingerprint of the certificate encrypting the connection.
- */
-function UntrustedHttpsRequest(aFingerprint)
-{
-  if (!aFingerprint) {
-    throw new Components.Exception("Must provide an MD5 fingerprint!",
-                                   Components.results.NS_ERROR_INVALID_ARG,
-                                   Components.stack.caller);
-  }
-  this.__proto__.__proto__ = new XMLHttpRequest();
-  this._callback._fingerprint = aFingerprint;
-}
-
-UntrustedHttpsRequest.prototype = {
-  //////////////////////////////////////////////////////////////////////////////
-  //// UntrustedHttpsRequest
-
-  _wrappedOpen: XMLHttpRequest.prototype.open,
-
-  _callback: {
-    ////////////////////////////////////////////////////////////////////////////
-    //// nsIBadCertListener2
-
-    notifyCertProblem: function UHR_notifyCertProblem(aSocketInfo,
-                                                      aStatus,
-                                                      aTargetSite)
-    {
-      let certificate = aStatus.serverCert;
-      // Check to ensure that our fingerprint is what we expect.
-      if (certificate.md5Fingerprint != this._fingerprint)
-        return false;
-
-      // aTargetSite is a host:port combination.
-      let host, port;
-      let (items = aTargetSite.split(":")) {
-        host = items[0];
-        port = items[1];
-      };
-
-      // And add the exception.
-      const nsICertOverrideService =
-        Components.interfaces.nsICertOverrideService;
-      const ERROR_UNTRUSTED = nsICertOverrideService.ERROR_UNTRUSTED;
-      let cow = Components.classes["@mozilla.org/security/certoverride;1"]
-                          .getService(nsICertOverrideService);
-      cow.rememberValidityOverride(host, port, certificate, ERROR_UNTRUSTED,
-                                   true);
-      return true;
-    },
-
-    ////////////////////////////////////////////////////////////////////////////
-    //// nsIInterfaceRequestor
-
-    getInterface: function UHR_getInterace(aIID)
-    {
-      return this.QueryInterface(aIID);
-    },
-
-    ////////////////////////////////////////////////////////////////////////////
-    //// nsISupports
-
-    QueryInterface: XPCOMUtils.generateQI([
-      Components.interfaces.nsIBadCertListener2,
-      Components.interfaces.nsIIntefaceRequestor,
-    ]),
-  },
-
-  //////////////////////////////////////////////////////////////////////////////
-  //// XMLHttpRequest
-
-  open: function UHR_open(aMethod, aURI)
-  {
-    // We want to make sure that the certificate will be added, so we open up
-    // another request now to the address.
-    let req = new XMLHttpRequest();
-    req.open("HEAD", aURI, false);
-    req.channel.notificationCallbacks = this._callback;
-    try {
-      req.send(null);
-    }
-    catch (e) {
-      // Unconditionally catch the exception about the load failing.
-    }
-    this._wrappedOpen.apply(this, arguments);
-  },
-
-  //////////////////////////////////////////////////////////////////////////////
-  //// nsISupports
-
-  QueryInterface: XPCOMUtils.generateQI([
-    Components.interfaces.nsIXMLHttpRequest,
-  ]),
-};
--- a/content/reply.xul
+++ b/content/reply.xul
@@ -11,18 +11,16 @@
         buttonlabelcancel="Cancel"
         ondialogaccept="ReplyDialog.onAccept();"
         height="400"
         width="800"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="text/javascript"
           src="chrome://bugzilla-helper/content/reply.js"/>
-  <script type="text/javascript"
-          src="chrome://bugzilla-helper/content/UntrustedHttpsRequest.js"/>
 
   <hbox>
     <label id="comment-label"
            for="comment"/>
     <spacer flex="1"/>
     <checkbox id="private" oncommand="ReplyDialog.togglePrivate();"
               label="Private"/>
   </hbox>