Closed Bug 1271758 Opened 8 years ago Closed 8 years ago

MarionetteException gets thrown during shutdown due to inappropriate usage of setTimeout

Categories

(Remote Protocol :: Marionette, defect)

49 Branch
defect
Not set
normal

Tracking

(firefox48 fixed, firefox49 fixed)

RESOLVED FIXED
mozilla49
Tracking Status
firefox48 --- fixed
firefox49 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

(Keywords: pi-marionette-server)

Attachments

(2 files)

Attached file proposed patch
With the landing of bug 1123506 we have seen a regression in our Firefox UI tests which is filed as bug 1271446. To reproduce run the following command in your local mozilla-central repository:

mach firefox-ui-functional --gecko-log - testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py testing/firefox-ui/tests/functional/security/test_dv_certificate.py

The exception thrown is:

 16:34:15     INFO -  Marionette threw an error: [Exception... "Component not initialized"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: chrome://marionette/content/evaluate.js :: evaluate.sandbox/promise< :: line 136"  data: no]

Source:

> => timeoutId = sb.window.setTimeout(
>        timeoutHandler, opts.timeout || DEFAULT_TIMEOUT);
>    sb.window.addEventListener("unload", unloadHandler);

Given that this happens while a chrome window gets closed the window reference might not exist anymore. A better solution would be to use the Timer.jsm to set the timeout, which would also fix our problem. See the attachment for a proposal.

https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Timer.jsm
Attachment #8750934 - Attachment mime type: text/x-patch → text/plain
This patch looks fine.  Please ship if you feel confident with testing.
After talking with Andreas on IRC I will take this bug. I will try again to figure out a minimized testcase. If I can't find one in time we will land the patch as is.
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Comment on attachment 8751450 [details]
MozReview Request: Bug 1271758 - Ensure that execute_script does not fail on closed chrome windows. r?ato

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/52021/diff/1-2/
Comment on attachment 8751450 [details]
MozReview Request: Bug 1271758 - Ensure that execute_script does not fail on closed chrome windows. r?ato

https://reviewboard.mozilla.org/r/52021/#review49083

Please do a try run including the Mn tests.
Attachment #8751450 - Flags: review?(ato) → review+
https://hg.mozilla.org/mozilla-central/rev/ea476de583db
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Flags: in-testsuite+
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.