0

Reading through the JavaScript and related specifications, these two concepts appear:

Some of the spec uses both. For example, in the steps of 4.2.2.5 Signaling slot change:

Append slot to slot’s relevant agent’s signal slots.

and then a bit further, into step 2:

If the surrounding agent’s mutation observer microtask queued is true, then return.

Are these concepts the same, in this case? Are they the same in all cases, from HTML's perspective?

  • HTML's _relevant-agent_ === ECMA's _execution-context_ in which that code is relevant. HTML's _surrounding-agent_ === ECMA's outer closure (outer _execution-context_). – Randy Casburn Feb 03 '21 at 22:27
  • Agent is [defined by ECMA](https://tc39.es/ecma262/#agent) [and is adopted by HTML](https://html.spec.whatwg.org/multipage/webappapis.html#agents-and-agent-clusters) - The term is synonymous in both respects. – Randy Casburn Feb 03 '21 at 22:31
  • What's confusing is ECMA says ".. the specification level execution objects held within the agent: the running execution context, the execution context stack, and the Agent Record's fields..." which implies agent contains execution-context, meaning they are distinct concepts/objects. – tsconstraints Feb 03 '21 at 23:09
  • There are multiple agents. The surrounding-agent is an agent that acts somewhat like a container or marshaller of other agents. The current-execution-context (carefully chosen term) - is an agent within a surrounding-agent. There can also me many agents running concurrently within that surrounding agent. As I understand it, is the surrounding agent's task to present all that complexity as the single thread that the runtime sees. – Randy Casburn Feb 03 '21 at 23:14
  • Is it one concrete, top-level, surrounding-agent? Or is that agent only symbolically acting as the 'surrounding-agent' with respect to other agents by virtue of how its execution contexts are accessed? – tsconstraints Feb 03 '21 at 23:48
  • That's up to Google, Mozilla, Apple, etc. I would avoid trying to interpret the text of the Specs as gospel. They are recommendations. The details are up to the developers. If you want to see how WebKit and V8 interact, go scour the Chromium source code. That's where you'll find the answer to the previous question. – Randy Casburn Feb 04 '21 at 00:03

0 Answers0