Closed Bug 810517 Opened 8 years ago Closed 8 years ago

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

Categories

(Testing :: Marionette, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla19

People

(Reporter: jgriffin, Assigned: jgriffin)

Details

Attachments

(1 file, 1 obsolete file)

According to Zac, https://github.com/zacc/gaia-ui-tests/blob/browser_smoke_test/gaiatest/tests/test_browser.py 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 mozilla.org.  When it tries to switch into the browser's iframe (https://github.com/zacc/gaia-ui-tests/blob/master/gaiatest/tests/test_browser.py#L49), 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: test_browser.py fails when run twice in a row → "TypeError: listenerWindow is null" when running test_browser.py twice in a row
The problem is here:  http://mxr.mozilla.org/mozilla-central/source/testing/marionette/marionette-actors.js#1654

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:  https://tbpl.mozilla.org/?tree=Try&rev=6066eca91645
https://hg.mozilla.org/mozilla-central/rev/76509d0847ec
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.