This patch moves the "timeout" and "interval" positional arguments
on PollPromise to an options dictionary.
In the following code example it is hard to know which argument means
what because they are not named:
new PollPromise(resolve => resolve(), 100, 100);
Named arguments can be achieved in JavaScript using option
dictionaries, and this patch changes the input PollPromise takes so
that the above example looks like this:
new PollPromise(resolve => resolve(), {timeout: 100, interval: 100};
This plays especially well with code in testing/marionette/element.js
as we already have named arguments that we can pass directly in through
an object literal, making the code more readable and more compact:
let timeout = 42;
new PollPromise(resolve => resolve(), {timeout});
MozReview-Commit-ID: GFWNGQAeWk1
--HG--
extra : rebase_source : 296843053e72bd07463a3018b06782f0dcc4828a
In formalising our synchronisation module, this renames wait.until
to PollPromise. It is a specialisation of a promise, just like
TimedPromise, that poll-waits a condition for a given amount of time
before either resolving (passing) or rejecting (failing) the poll-wait.
Also fix and improve documentation.
MozReview-Commit-ID: AcP3C1qCgKA
--HG--
extra : rebase_source : d17bb3be0819b0ce9de55d44741836fc00b10f46
testing/marionette/wait.js originally contained a utility for
poll-waiting on a condition. The module has since been expanded to
also include TimedPromise, which is a specialisation of Promise that
is rejected after a duration.
The latter is not a wait utility but a synchronisation primitive.
This terminology also covers the first, and this change renames the
wait module to sync.
MozReview-Commit-ID: Fd3LqfpiEaU
--HG--
rename : testing/marionette/wait.js => testing/marionette/sync.js
extra : rebase_source : f48ff62ca2589ab0ce4a2f3d134d392e6f0be015
This patch moves the "timeout" and "interval" positional arguments
on PollPromise to an options dictionary.
In the following code example it is hard to know which argument means
what because they are not named:
new PollPromise(resolve => resolve(), 100, 100);
Named arguments can be achieved in JavaScript using option
dictionaries, and this patch changes the input PollPromise takes so
that the above example looks like this:
new PollPromise(resolve => resolve(), {timeout: 100, interval: 100};
This plays especially well with code in testing/marionette/element.js
as we already have named arguments that we can pass directly in through
an object literal, making the code more readable and more compact:
let timeout = 42;
new PollPromise(resolve => resolve(), {timeout});
MozReview-Commit-ID: GFWNGQAeWk1
--HG--
extra : rebase_source : 06e558129f1e0acf3fbf8b6ca99c2407320b8e61
Now that we have selective imports through Cu.import we can give
wait.until a more descriptive name that matches TimedPromise.
This patch renames the wait.until utility to PollPromise.
MozReview-Commit-ID: 9gsvAV27mMl
--HG--
extra : rebase_source : ea98d63013d709d52ce234446404233d9dbe572e
testing/marionette/wait.js originally contained a utility for
poll-waiting on a condition. The module has since been expanded to
also include TimedPromise, which is a specialisation of Promise that
is rejected after a duration.
The latter is not a wait utility but a synchronisation primitive.
This terminology also covers the first, and this change renames the
wait module to sync.
MozReview-Commit-ID: Fd3LqfpiEaU
--HG--
rename : testing/marionette/wait.js => testing/marionette/sync.js
extra : rebase_source : 5e22ec5e26b5405c928ab26734a8d2ddc5d43785