Created attachment 8750934[details]
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