Bug 1299587 - Handle if marionette tests can't focus mainFrame in tearDown. r=automatedtester
authorEric Rahm <erahm@mozilla.com>
Thu, 01 Sep 2016 13:30:24 -0700
changeset 312353 2948b2f6ffffe9c5a22db1deb85120781bcc3d8d
parent 312352 2d673f97bf4dd6fc3d4be6ef1888e417e30b7100
child 312354 6435e739a7ff8a1d9e9a3f6efccc34d4eb620f6d
push id20447
push userkwierso@gmail.com
push dateFri, 02 Sep 2016 20:36:44 +0000
treeherderfx-team@969397f22187 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1299587
milestone51.0a1
Bug 1299587 - Handle if marionette tests can't focus mainFrame in tearDown. r=automatedtester It's possible the mainFrame has already been closed in which case it can become a dead wrapper. Just gracefully handle failure in this situation.
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2263,17 +2263,22 @@ GeckoDriver.prototype.sessionTearDown = 
         globalMessageManager);
   }
 
   this.switchToGlobalMessageManager();
 
   // reset frame to the top-most frame
   this.curFrame = null;
   if (this.mainFrame) {
-    this.mainFrame.focus();
+    try {
+      this.mainFrame.focus();
+    }
+    catch (e) {
+      this.mainFrame = null;
+    }
   }
 
   this.sessionId = null;
 
   if (this.observing !== null) {
     for (let topic in this.observing) {
       Services.obs.removeObserver(this.observing[topic], topic);
     }