4848 * > e => console.error('FAILURE: ' + e));
4949 * > ```
5050 * >
51- * > The motiviation behind this change and full deprecation plan are documented
51+ * > The motivation behind this change and full deprecation plan are documented
5252 * > in [issue 2969](https://github.com/SeleniumHQ/selenium/issues/2969).
5353 * >
5454 * >
8787 * The control flow is based on the concept of tasks and task queues. Tasks are
8888 * functions that define the basic unit of work for the control flow to execute.
8989 * Each task is scheduled via {@link ControlFlow#execute()}, which will return
90- * a {@link ManagedPromise ManagedPromise} that will be resolved with the task's
91- * result.
90+ * a {@link ManagedPromise} that will be resolved with the task's result.
9291 *
9392 * A task queue contains all of the tasks scheduled within a single turn of the
9493 * [JavaScript event loop][JSEL]. The control flow will create a new task queue
123122 *
124123 * ## Task Execution
125124 *
126- * Upon creating a task queue, and whenever an exisiting queue completes a task,
125+ * Upon creating a task queue, and whenever an existing queue completes a task,
127126 * the control flow will schedule a microtask timer to process any scheduled
128127 * tasks. This ensures no task is ever started within the same turn of the
129128 * JavaScript event loop in which it was scheduled, nor is a task ever started
140139 * discarded and the task's promised result (previously returned by
141140 * {@link ControlFlow#execute()}) is immediately rejected with the thrown
142141 * error.
143- * 3. The task function returns sucessfully .
142+ * 3. The task function returns successfully .
144143 *
145144 * If a task function created a new task queue, the control flow will wait for
146145 * that queue to complete before processing the task result. If the queue
147146 * completes without error, the flow will settle the task's promise with the
148- * value originaly returned by the task function. On the other hand, if the task
149- * queue termintes with an error, the task's promise will be rejected with that
147+ * value originally returned by the task function. On the other hand, if the task
148+ * queue terminates with an error, the task's promise will be rejected with that
150149 * error.
151150 *
152151 * flow.execute(function() {
161160 * ## ManagedPromise Integration
162161 *
163162 * In addition to the {@link ControlFlow } class, the promise module also exports
164- * a [Promise /A+] {@linkplain ManagedPromise implementation} that is deeply
163+ * a [Promises /A+] {@linkplain ManagedPromise implementation} that is deeply
165164 * integrated with the ControlFlow. First and foremost, each promise
166165 * {@linkplain ManagedPromise#then() callback} is scheduled with the
167166 * control flow as a task. As a result, each callback is invoked in its own turn
328327 * Even though a subtask's promised result will never resolve while the task
329328 * function is on the stack, it will be treated as a promise resolved within the
330329 * task. In all other scenarios, a task's promise behaves just like a normal
331- * promise. In the sample below, `C/D` is loggged before `B` because the
330+ * promise. In the sample below, `C/D` is logged before `B` because the
332331 * resolution of `subtask1` interrupts the flow of the enclosing task. Within
333332 * the final subtask, `E/F` is logged in order because `subtask1` is a resolved
334333 * promise when that task runs.
582581 *
583582 * Bottom line: you __*must*__ handle rejected promises.
584583 *
585- * # Promise /A+ Compatibility
584+ * # Promises /A+ Compatibility
586585 *
587- * This `promise` module is compliant with the [Promise /A+] specification
586+ * This `promise` module is compliant with the [Promises /A+] specification
588587 * except for sections `2.2.6.1` and `2.2.6.2`:
589588 *
590589 * >
623622 *
624623 * [JSEL]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
625624 * [GF]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
626- * [Promise /A+]: https://promisesaplus.com/
625+ * [Promises /A+]: https://promisesaplus.com/
627626 * [MicrotasksArticle]: https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/
628627 */
629628
@@ -943,7 +942,7 @@ class Thenable {
943942
944943/**
945944 * Marker interface for objects that allow consumers to request the cancellation
946- * of a promies -based operation. A cancelled promise will be rejected with a
945+ * of a promise -based operation. A cancelled promise will be rejected with a
947946 * {@link CancellationError}.
948947 *
949948 * This interface is considered package-private and should not be used outside
@@ -1309,7 +1308,7 @@ class ManagedPromise {
13091308 * @param {!Function } fn The function to use as the top of the stack when
13101309 * recording the callback's creation point.
13111310 * @return {!ManagedPromise<R> } A new promise which will be resolved with the
1312- * esult of the invoked callback.
1311+ * result of the invoked callback.
13131312 * @template R
13141313 * @private
13151314 */
@@ -1974,7 +1973,7 @@ class Scheduler {
19741973 /**
19751974 * Schedules a task to wait for a condition to hold.
19761975 *
1977- * If the condition is defined as a function, it may return any value. Promies
1976+ * If the condition is defined as a function, it may return any value. Promise
19781977 * will be resolved before testing if the condition holds (resolution time
19791978 * counts towards the timeout). Once resolved, values are always evaluated as
19801979 * booleans.
@@ -1998,7 +1997,7 @@ class Scheduler {
19981997 * @param {string= } opt_message An optional error message to include if the
19991998 * wait times out; defaults to the empty string.
20001999 * @return {!Thenable<T> } A promise that will be fulfilled
2001- * when the condition has been satisified . The promise shall be rejected
2000+ * when the condition has been satisfied . The promise shall be rejected
20022001 * if the wait times out waiting for the condition.
20032002 * @throws {TypeError } If condition is not a function or promise or if timeout
20042003 * is not a number >= 0.
@@ -2041,7 +2040,7 @@ function createPromise(resolver) {
20412040 * @param {string= } opt_message An optional error message to include if the
20422041 * wait times out; defaults to the empty string.
20432042 * @return {!Thenable<T> } A promise that will be fulfilled
2044- * when the condition has been satisified . The promise shall be rejected
2043+ * when the condition has been satisfied . The promise shall be rejected
20452044 * if the wait times out waiting for the condition.
20462045 * @throws {TypeError } If condition is not a function or promise or if timeout
20472046 * is not a number >= 0.
@@ -2165,7 +2164,7 @@ const SIMPLE_SCHEDULER = new SimpleScheduler;
21652164/**
21662165 * Handles the execution of scheduled tasks, each of which may be an
21672166 * asynchronous operation. The control flow will ensure tasks are executed in
2168- * the ordered scheduled, starting each task only once those before it have
2167+ * the order scheduled, starting each task only once those before it have
21692168 * completed.
21702169 *
21712170 * Each task scheduled within this flow may return a {@link ManagedPromise} to
@@ -2213,7 +2212,7 @@ class ControlFlow extends events.EventEmitter {
22132212 this . taskQueues_ = null ;
22142213
22152214 /**
2216- * Micro task that controls shutting down the control flow. Upon shut down,
2215+ * Microtask that controls shutting down the control flow. Upon shut down,
22172216 * the flow will emit an
22182217 * {@link ControlFlow.EventType.IDLE} event. Idle events
22192218 * always follow a brief timeout in order to catch latent errors from the
@@ -2222,8 +2221,8 @@ class ControlFlow extends events.EventEmitter {
22222221 * by the promise system until the next turn of the event loop:
22232222 *
22242223 * // Schedule 1 task that fails.
2225- * var result = promise.controlFlow().schedule('example',
2226- * function () { return promise.rejected('failed'); } );
2224+ * var result = promise.controlFlow().execute(
2225+ * () => promise.rejected('failed'), 'example' );
22272226 * // Set a callback on the result. This delays reporting the unhandled
22282227 * // failure for 1 turn of the event loop.
22292228 * result.then(function() {});
@@ -2247,7 +2246,7 @@ class ControlFlow extends events.EventEmitter {
22472246 /**
22482247 * Returns a string representation of this control flow, which is its current
22492248 * {@linkplain #getSchedule() schedule}, sans task stack traces.
2250- * @return {string } The string representation of this contorl flow.
2249+ * @return {string } The string representation of this control flow.
22512250 * @override
22522251 */
22532252 toString ( ) {
@@ -2890,7 +2889,7 @@ class TaskQueue extends events.EventEmitter {
28902889 }
28912890
28922891 // Now that all of the remaining tasks have been silently cancelled (e.g. no
2893- // exisitng callbacks on those tasks will fire), clear the silence bit on
2892+ // existing callbacks on those tasks will fire), clear the silence bit on
28942893 // the cancellation error. This ensures additional callbacks registered in
28952894 // the future will actually execute.
28962895 cancellation . silent_ = false ;
@@ -3069,7 +3068,7 @@ class TaskQueue extends events.EventEmitter {
30693068 }
30703069 return task ;
30713070 }
3072- } ;
3071+ }
30733072
30743073
30753074
@@ -3215,7 +3214,7 @@ function consume(generatorFn, opt_self, ...var_args) {
32153214
32163215 function pump ( fn , opt_arg ) {
32173216 if ( ret instanceof ManagedPromise && ! isPending ( ret ) ) {
3218- return ; // Defererd was cancelled; silently abort.
3217+ return ; // Deferred was cancelled; silently abort.
32193218 }
32203219
32213220 try {
@@ -3276,7 +3275,7 @@ module.exports = {
32763275 * The promise manager is currently enabled by default, but may be disabled
32773276 * by setting the environment variable `SELENIUM_PROMISE_MANAGER=0` or by
32783277 * setting this property to false. Setting this property will always take
3279- * precedence ove the use of the environment variable.
3278+ * precedence over the use of the environment variable.
32803279 *
32813280 * @return {boolean } Whether the promise manager is enabled.
32823281 * @see <https://github.com/SeleniumHQ/selenium/issues/2969>
0 commit comments