Backed out changeset f27d827ba404 (bug 1103196)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 25 Nov 2016 00:18:23 +0100
changeset 324218 0dc0daaaa649064a1663d5bf5f0a4b169e9379c8
parent 324217 bb320c72a6bba8d688cb66736839c8d348ba0502
child 324219 92e3bd08056fc7c68a86ad540a39f22a33e7f617
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
bugs1103196
milestone53.0a1
backs outf27d827ba40471ee6035685818c3d237a7d43916
Backed out changeset f27d827ba404 (bug 1103196)
testing/marionette/driver.js
testing/marionette/listener.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1408,32 +1408,27 @@ GeckoDriver.prototype.switchToParentFram
  *     A web element reference to the element to switch to.
  * @param {(string|number)} id
  *     If element is not defined, then this holds either the id, name,
  *     or index of the frame to switch to.
  */
 GeckoDriver.prototype.switchToFrame = function*(cmd, resp) {
   let {id, element, focus} = cmd.parameters;
 
-  const otherErrorsExpr = /about:.+(error)|(blocked)\?/;
-  const checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-
+  let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   let curWindow = this.getCurrentWindow();
 
   let checkLoad = function() {
-    let win = this.getCurrentWindow();
-    if (win.document.readyState == "complete") {
+    let errorRegex = /about:.+(error)|(blocked)\?/;
+    let curWindow = this.getCurrentWindow();
+    if (curWindow.document.readyState == "complete") {
       return;
-    } else if (win.document.readyState == "interactive") {
-      let baseURI = win.document.baseURI;
-      if (baseURI.startsWith("about:certerror")) {
-        throw new InsecureCertificateError();
-      } else if (otherErrorsExpr.exec(win.document.baseURI)) {
-        throw new UnknownError("Error loading page");
-      }
+    } else if (curWindow.document.readyState == "interactive" &&
+        errorRegex.exec(curWindow.document.baseURI)) {
+      throw new UnknownError("Error loading page");
     }
 
     checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
   };
 
   if (this.context == Context.CHROME) {
     let foundFrame = null;
 
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -870,25 +870,20 @@ function pollForReadyState(msg, start = 
     let doc = curContainer.frame.document;
     let now = new Date().getTime();
     if (pageTimeout == null || (now - start) <= pageTimeout) {
       // document fully loaded
       if (doc.readyState == "complete") {
         callback();
         sendOk(command_id);
 
-      // document with an insecure cert
-      } else if (doc.readyState == "interactive" &&
-          doc.baseURI.startsWith("about:certerror")) {
-        callback();
-        sendError(new InsecureCertificateError(), command_id);
-
       // we have reached an error url without requesting it
       } else if (doc.readyState == "interactive" &&
-          /about:.+(error)\?/.exec(doc.baseURI)) {
+          /about:.+(error)\?/.exec(doc.baseURI) &&
+          !doc.baseURI.startsWith(url)) {
         callback();
         sendError(new UnknownError("Reached error page: " + doc.baseURI), command_id);
 
       // return early for about: urls
       } else if (doc.readyState == "interactive" && doc.baseURI.startsWith("about:")) {
         callback();
         sendOk(command_id);