Bug 1289549 fix test driver child counting, r?ato draft
authorShane Caraveo <scaraveo@mozilla.com>
Mon, 15 Aug 2016 15:52:13 -0700
changeset 400829 e13da7163887f8f3d043978dc939ec74dae2a82a
parent 400737 3e4803eb9a5ca755a8881bf599f05f8430ffb343
child 400830 a3476decc377f2fbd1a21ace01003a34ee78faf0
push id26292
push usermixedpuppy@gmail.com
push dateMon, 15 Aug 2016 22:52:35 +0000
reviewersato
bugs1289549
milestone51.0a1
Bug 1289549 fix test driver child counting, r?ato MozReview-Commit-ID: DeXtQmZeLvA
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -328,18 +328,23 @@ 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), so get
+      // the count from each child.
       if (mm.childCount !== 0) {
-        this.curBrowser.frameRegsPending = mm.childCount;
+        this.curBrowser.frameRegsPending = 0;
+        for (let i = 0; i < mm.childCount; i++) {
+          this.curBrowser.frameRegsPending += mm.getChildAt(i).childCount;
+        }
       }
     }
 
     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);