Bug 1289549 fix test driver child counting, r=automatedtester draft
authorShane Caraveo <scaraveo@mozilla.com>
Tue, 23 Aug 2016 14:51:10 -0700
changeset 404604 9acc194db33b416afe0f44a0e6b38d191419cab0
parent 404603 6e17a469a1b137c535adee7e476f86ee9dfcc071
child 404605 0c593f1e9cf046f868586484dc49ed62b0b80e47
push id27260
push usermixedpuppy@gmail.com
push dateTue, 23 Aug 2016 21:52:25 +0000
reviewersautomatedtester
bugs1289549
milestone51.0a1
Bug 1289549 fix test driver child counting, r=automatedtester MozReview-Commit-ID: IPqzfWrh5fK
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -328,18 +328,25 @@ GeckoDriver.prototype.whenBrowserStarted
   let mm = win.window.messageManager;
   if (mm) {
     if (!isNewSession) {
       // Loading the frame script corresponds to a situation we need to
       // return to the server. If the messageManager is a message broadcaster
       // with no children, we don't have a hope of coming back from this call,
       // so send the ack here. Otherwise, make a note of how many child scripts
       // will be loaded so we known when it's safe to return.
+      // Child managers may not have child scripts yet (e.g. socialapi), only
+      // count child managers that have children, but only count the top level
+      // children as they are the ones that we expect a response from.
       if (mm.childCount !== 0) {
-        this.curBrowser.frameRegsPending = mm.childCount;
+        this.curBrowser.frameRegsPending = 0;
+        for (let i = 0; i < mm.childCount; i++) {
+          if (mm.getChildAt(i).childCount !== 0)
+            this.curBrowser.frameRegsPending += 1;
+        }
       }
     }
 
     if (!Preferences.get(CONTENT_LISTENER_PREF) || !isNewSession) {
       // load listener into the remote frame
       // and any applicable new frames
       // opened after this call
       mm.loadFrameScript(FRAME_SCRIPT, true);