Commit Graph

11 Commits

Author SHA1 Message Date
Andreas Tolfsen
74fbed7467 Bug 1404946 - Have PollPromise accept an options dictionary. r=whimboo
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
2017-10-02 17:13:57 +01:00
Andreas Tolfsen
a5fa626acc Bug 1404946 - Rename wait.until to PollPromise. r=whimboo
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
2017-10-02 16:50:11 +01:00
Andreas Tolfsen
f9a974ff5b Bug 1404946 - Rename wait module to sync. r=whimboo
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
2017-10-02 16:38:33 +01:00
Sebastian Hengst
a867e38354 Backed out changeset 231a24060d29 (bug 1404946) for linting failure at testing/marionette/driver.js:3054:35 | 'f' is defined but never used. r=backout
--HG--
rename : testing/marionette/sync.js => testing/marionette/wait.js
extra : amend_source : 009478a65c290d4b7540723f157de57dbe19901e
2017-10-09 16:23:15 +02:00
Sebastian Hengst
b668981dca Backed out changeset 135c1e44a92b (bug 1404946) 2017-10-09 16:23:10 +02:00
Sebastian Hengst
c9b41f4cb7 Backed out changeset bf79d5b1b4b0 (bug 1404946) 2017-10-09 16:23:04 +02:00
Sebastian Hengst
3b0bd340dc Backed out changeset dfc766f28aec (bug 1404946) 2017-10-09 16:22:59 +02:00
Andreas Tolfsen
9b9dc004c1 Bug 1404946 - Have PollPromise accept an options dictionary. r=whimboo
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
2017-10-02 17:13:57 +01:00
Andreas Tolfsen
0fb99a7cd4 Bug 1404946 - Rename wait.until to PollPromise. r=whimboo
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
2017-10-02 16:59:25 +01:00
Andreas Tolfsen
448628bdcc Bug 1404946 - Add markup to wait.until's docs. r=whimboo
MozReview-Commit-ID: AcP3C1qCgKA

--HG--
extra : rebase_source : 441be4b537f8868bff5b8c2009e7586e85f66efc
2017-10-02 16:50:11 +01:00
Andreas Tolfsen
583c91fabd Bug 1404946 - Rename wait module to sync. r=whimboo
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
2017-10-02 16:38:33 +01:00