domenic at domenicdenicola.com (2014-06-17T20:44:42.199Z)
On Wed, 11 Jun 2014, Domenic Denicola wrote:
> https://people.mozilla.org/~jorendorff/es6-draft.html#sec-triggerpromisereactions
> and
> https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype.then;
> search for `EnqueueTask("PromiseTasks"`.
EnqueueTask() step 7 is where the HTML spec would hook in and treat
different jobs as ending up in different task queues. Presumably, if we
want all promise resolutions to be treated as microtasks, then that step
would be overridden to queue a microtask when queueName = 'PromiseTasks',
and queue a regular task otherwise (or whatever the other queues need),
where that task/microtask would trigger the NextTask magic to run the
actual job.
(As far as I can tell, in an HTML implementation the only queue name that
is used is "PromiseTasks" currently, so maybe EnqueueTask() step 7 would
just always queue a microtask. The only other queue name used in the ES
spec currently is "ScriptTasks", but that one is never called in a browser
environment, according to the discussion in the other fork of this
thread, where I was talking about this with Allen.)
On Wed, 11 Jun 2014, Domenic Denicola wrote: > From: Ian Hickson [mailto:ian at hixie.ch] > > > > Where in the ES spec are the ES jobs for promises queued up? > > https://people.mozilla.org/~jorendorff/es6-draft.html#sec-triggerpromisereactions > and > https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype.then; > search for `EnqueueTask("PromiseTasks"`. EnqueueTask() step 7 is where the HTML spec would hook in and treat different jobs as ending up in different task queues. Presumably, if we want all promise resolutions to be treated as microtasks, then that step would be overridden to queue a microtask when queueName = 'PromiseTasks', and queue a regular task otherwise (or whatever the other queues need), where that task/microtask would trigger the NextTask magic to run the actual job. (As far as I can tell, in an HTML implementation the only queue name that is used is "PromiseTasks" currently, so maybe EnqueueTask() step 7 would just always queue a microtask. The only other queue name used in the ES spec currently is "ScriptTasks", but that one is never called in a browser environment, according to the discussion in the other fork of this thread, where I was talking about this with Allen.) -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'