MozMill upgrade incoming, waitForEval users beware

Siddharth Agarwal sagarwal at mozilla.com
Wed Jun 8 00:33:46 UTC 2011


We're probably going to upgrade to MozMill 1.5.4 soon [1], and one of 
the changes introduced [2] is that if a waitForEval times out, it throws 
an exception instead of just returning false. We started throwing 
exceptions on timeouts over a year ago [3], so we're mostly set, but 
apparently we missed at least one instance (fixed as part of [1]).

Going forward, I think the best practice is to
- use utils.waitFor [4] instead of controller.waitForEval. Any statement 
of the form controller.waitForEval("subject()", timeout, interval, 
callback) simply becomes utils.waitFor(callback, message, timeout, 
interval) with an optional |this| object at the end. timeout and 
interval are also optional -- the defaults are 5 seconds and 100ms 
respectively, which are pretty close to our NORMAL_TIMEOUT (6 seconds) 
and FAST_INTERVAL (100ms). I think the defaults are fine here, but I'm 
willing to listen to arguments to the contrary.
- pass in a helpful message as the second argument to waitFor, wherever 
necessary.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=656736
[2] 
https://github.com/mozautomation/mozmill/commit/45213c70e89c05d8a728aa9ca293ffe1fad7b660
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=540110
[4] 
https://github.com/mozautomation/mozmill/blob/hotfix-1.5/mozmill/mozmill/extension/resource/modules/utils.js#L426



More information about the tb-planning mailing list