Bug 1289549 fix test driver child counting, r=automatedtester
MozReview-Commit-ID: IPqzfWrh5fK
--- 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);