Bug 1075081 - Enhance pinning test to ensure the neterror page the one found. r=keeler
authorCamilo Viecco <cviecco@mozilla.com>
Thu, 02 Oct 2014 10:49:56 -0700
changeset 208494 944246c0d39fea189c9086f68a0d39e5f13cbe67
parent 208493 762c775b242a9d95eed36a310788bd3fcb2cc50d
child 208495 61588fcd074fb2961c768b2ace97a4b8bf0e03ea
push id27585
push useremorley@mozilla.com
push dateFri, 03 Oct 2014 13:26:33 +0000
treeherdermozilla-central@e4f5e843a370 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler
bugs1075081
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1075081 - Enhance pinning test to ensure the neterror page the one found. r=keeler
browser/base/content/test/general/browser_blockHPKP.js
--- a/browser/base/content/test/general/browser_blockHPKP.js
+++ b/browser/base/content/test/general/browser_blockHPKP.js
@@ -64,33 +64,27 @@ let successfulPinningPageListener = {
     gBrowser.addProgressListener(certErrorProgressListener);
     gBrowser.selectedBrowser.loadURI("https://" + kBadPinningDomain);
   }
 };
 
 // The browser should load about:neterror, when this happens, proceed
 // to load the pinning domain again, this time removing the pinning information
 let certErrorProgressListener = {
-  buttonClicked: false,
   onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
     if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
-      let self = this;
-      // Can't directly call button.click() in onStateChange
-      executeSoon(function() {
-        let button =   content.document.getElementById("errorTryAgain");
-        // If about:neterror hasn't fully loaded, the button won't be present.
-        // It will eventually be there, however.
-        if (button && !self.buttonClicked) {
-          gBrowser.removeProgressListener(self);
-          gBrowser.selectedBrowser.addEventListener("load",
-                                                    successfulPinningRemovalPageListener,
-                                                    true);
-          gBrowser.selectedBrowser.loadURI("https://" + kPinningDomain + kURLPath + "zeromaxagevalid");
-        }
-      });
+      let textElement = content.document.getElementById("errorShortDescText");
+      let text = textElement.innerHTML;
+      ok(text.indexOf("mozilla_pkix_error_key_pinning_failure") > 0,
+         "Got a pinning error page");
+      gBrowser.removeProgressListener(this);
+      gBrowser.selectedBrowser.addEventListener("load",
+                                                successfulPinningRemovalPageListener,
+                                                true);
+      gBrowser.selectedBrowser.loadURI("https://" + kPinningDomain + kURLPath + "zeromaxagevalid");
     }
   }
 };
 
 // After the pinning information has been removed (successful load) proceed
 // to load again with the invalid pin domain.
 let successfulPinningRemovalPageListener = {
   handleEvent: function() {