Closed Bug 810517 Opened 11 years ago Closed 11 years ago

"TypeError: listenerWindow is null" when running twice in a row


(Remote Protocol :: Marionette, defect)

Gonk (Firefox OS)
Not set


(Not tracked)



(Reporter: jgriffin, Assigned: jgriffin)



(1 file, 1 obsolete file)

According to Zac, fails when run twice in a row.  Needs investigation.
The symptoms are thus:

The test runs ok the first time.  On the second run, it launches the browser and successfully navigates the browser to  When it tries to switch into the browser's iframe (, an error occurs and the call to switch_to_frame dies:

E/GeckoConsole(  106): [JavaScript Error: "TypeError: listenerWindow is null" {file: "chrome://marionette/content/marionette-actors.js" line: 1658}]
Summary: fails when run twice in a row → "TypeError: listenerWindow is null" when running twice in a row
The problem is here:

Child processes and the parent process maintain completely independent lists of windows, from which outerWindowID comes.  When a register message is received from an OOP frame, the outerWindowID comes from the child processes' window list...the same outerWindowID in the parent process may not exist, or may point to some random window.
Attached patch Check for valid listenerWindow, (obsolete) — Splinter Review
The solution is just to add another check that listenerWindow is valid before attempting to access it's href.  Unfortunately, I don't know of a better way to determine whether the frame registration is coming from an OOP process, but it would be nice if there were.
Attachment #680739 - Flags: review?(mdas)
Actually, I wonder if we can use window.parent to determine this?
(In reply to Jonathan Griffin (:jgriffin) from comment #4)
> Actually, I wonder if we can use window.parent to determine this?

No, we can't; that trick only works *from* the OOP process, not the parent one.
Comment on attachment 680739 [details] [diff] [review]
Check for valid listenerWindow,

Review of attachment 680739 [details] [diff] [review]:

Good catch! I'd add a comment about the outerWindowID mismatch if you can, to explain why we may not find the listenerWindow.
Attachment #680739 - Flags: review?(mdas) → review+
Attachment #680739 - Attachment is obsolete: true
Comment on attachment 680866 [details] [diff] [review]
Check for valid listenerWindow,

Review comments addressed; carrying r+ forward.
Attachment #680866 - Flags: review+
re-pushed to try, since my original didn't seem to trigger tests on the emulator:
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.