Closed Bug 1465719 Opened 2 years ago Closed 11 months ago

JavaScript error: chrome://marionette/content/listener.js, line 465: TypeError: reply[0] is undefined

Categories

(Testing :: Marionette, enhancement, P5)

enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1538809

People

(Reporter: whimboo, Unassigned)

Details

This failure can sometimes be seen for restart tests:

> 1527753828034	Marionette	DEBUG	Register listener.js for window 8589934593
> 1527753828045	Marionette	ERROR	No reply from Marionette:Register
> JavaScript error: chrome://marionette/content/listener.js, line 465: TypeError: reply[0] is undefined

The problem is here:

https://dxr.mozilla.org/mozilla-central/rev/5866d6685849311f057e7e229b9ace63a2641c29/testing/marionette/listener.js#464

If `reply` is of length 0 we log an error, but continue that method and accessing `reply[0]` simply fails. 

Andreas, you added this code in bug 1430077. Is there any reason why we cannot early return from that method?
Flags: needinfo?(ato)
The check of whether the outerWindowID matches is actually not that
important.  It is just an ack that Marionette:Register completed.

When the frame script sends Marionette:Register, any one of the
listeners in chrome can reply.  Because it’s a sync IPC message,
ultimately they form an collation of these responses.  When reply[0]
is empty, it means that one of the listeners didn’t have a return
value.

In any case, this should get resolved with
https://bugzilla.mozilla.org/show_bug.cgi?id=marionette-window-tracking if
you deem it acceptable to wait for that.
Flags: needinfo?(ato)
If it doesn't cause any issues then I'm fine with waiting for the other bug to be fixed.
Priority: -- → P5

I'm fairly sure this is the consequence of bug 1363368. Whereby I'm not sure why reply can be empty:

https://searchfox.org/mozilla-central/source/testing/marionette/listener.js#454-459

Andreas, in which cases sendSyncMessage() could reply no data?

No longer depends on: marionette-window-tracking
Flags: needinfo?(ato)

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #3)

in which cases sendSyncMessage() could reply no data?

sendSyncMessage is, as its name implies, synchronous and collates
responses from all attached message listeners. When there are no
attached listeners, it returns undefined.

Flags: needinfo?(ato)
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1538809
You need to log in before you can comment on or make changes to this bug.