Closed Bug 967021 Opened 9 years ago Closed 8 years ago

JavaScript Error: "listenerWindow.location is null"


(Testing :: Marionette, defect)

Gonk (Firefox OS)
Not set


(Not tracked)



(Reporter: zcampbell, Assigned: automatedtester)




(1 file, 2 obsolete files)

I've just encountered a 'hung' UI test running against Hamachi when launching an app using the atom.

In logcat the last activity from Gecko was this:

I/Gecko   ( 4484): 1391443823047	Marionette	DEBUG	Got request: executeWithCallback, data: {"to":"0","sessionId":"3-b2g","name":"executeAsyncScript","parameters":{"specialPowers":false,"scriptTimeout":null,"newSandbox":true,"args":[],"filename":"","script":"GaiaApps.launchWithName('Usage')","line":82}}, id: {379a1fc7-b603-4f40-80b1-2266ae9e34b2}
E/GeckoConsole( 4484): Content JS LOG at dummy file:301 in GaiaApps.launch: launching app with name 'Usage'
I/Gonk    ( 4484): Setting nice for pid 4681 to 1
I/Gonk    ( 4484): Changed nice for pid 4681 from 18 to 1.
I/Gonk    ( 4484): Setting nice for pid 4598 to 18
I/Gonk    ( 4484): Changed nice for pid 4598 from 1 to 18.
I/Gecko   ( 4484): 1391443823570	Marionette	INFO	sendToClient: {"from":"0","value":{"frame":{"ELEMENT":"{e74be563-cb87-4960-a882-8438f5957e38}"},"src":"app://","name":"Usage","origin":"app://"}}, {379a1fc7-b603-4f40-80b1-2266ae9e34b2}, {379a1fc7-b603-4f40-80b1-2266ae9e34b2}
E/GeckoConsole( 4484): Content JS LOG at dummy file:292 in GaiaApps.launch/appOpen/<: app with origin 'app://' has launched
I/Gecko   ( 4484): 1391443823591	Marionette	DEBUG	Got request: switchToFrame, data: {"to":"0","sessionId":"3-b2g","name":"switchToFrame","parameters":{"focus":true,"element":"{e74be563-cb87-4960-a882-8438f5957e38}"}}, id: {67c4c3be-9e6a-4bac-b37c-62caac4acd99}
I/Gecko   ( 4484): 1391443823593	Marionette	INFO	Switched to frame: {"frameValue":"{e74be563-cb87-4960-a882-8438f5957e38}"}
I/Gecko   ( 4484): 1391443823597	Marionette	INFO	trying remote frame 0
E/GeckoConsole( 4484): [JavaScript Error: "listenerWindow.location is null" {file: "chrome://marionette/content/marionette-server.js" line: 2354}]

This resulted in a socket.timeout after 6+ minutes of waiting.

The test being run is tests/functional/cost_control/

The replication frequency is low (maybe 10%) but the effect is bad as this does not fail quickly.
Blocks: 859417
Assignee: nobody → dburns
Attachment #8398834 - Flags: review?(mdas)
I have done the obvious of adding another check but since this is OOP I am not sure if there is a better way so let me know what you suggest
Comment on attachment 8398834 [details] [diff] [review]
Add extra check on variable to prevent marionette crash

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

I can't reproduce this either, but what do you think of this comment?

::: testing/marionette/marionette-server.js
@@ +2370,5 @@
>                              Services.wm.getOuterWindowWithId(message.json.value);
>          //go in here if we're already in a remote frame.
> +        if ((!listenerWindow || (listenerWindow.location &&
> +                                 listenerWindow.location.href != message.json.href)) &&

If I understand the problem correctly, I think the OOP frame exists but is still being initialized. so listenerWindow is an object, but its location is not yet a value, so what we should do here is:

((!listenerWindow || (!listenerWindow.location) || (listenerWindow.location &&
		listenerWindow.location.href != message.json.href)) &&
(In reply to Malini Das [:mdas] from comment #3)

> ((!listenerWindow || (!listenerWindow.location) || (listenerWindow.location
> &&
> 		listenerWindow.location.href != message.json.href)) &&

I feel like I am missing something. The `(!listenerWindow.location) ||` feels unneeded since we are testing it in the next part of the conditional
Attachment #8398834 - Attachment is obsolete: true
Attachment #8398834 - Flags: review?(mdas)
Comment on attachment 8405416 [details] [diff] [review]
Check that a window listener is not null in marionette

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

You're right in your comment that we don't need to do the (!listenerWindow.location) check. You can remove this and push
Attachment #8405416 - Flags: review?(mdas) → review+
Attachment #8405416 - Attachment is obsolete: true
Attachment #8408505 - Flags: review+
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.