Skip to content

I need a concept of "currently running script" #78

@domenic

Description

@domenic

This is for HTML/ES integration. HTML has a concept of script which contains a few useful pieces of information. Notably, it contains a "muted errors flag", which is set based on whether the script was retrieved in a cross-origin manner.

When performing NextJob's "implementation defined unhandled exception processing", I need to be able to retrieve the current "HTML script" given the information available to me in the ES context.

I would have thought this would be simple: I'd simply get whatever concept ES has for "script", and add a pointer between them associating "HTML script" and "ES script". Or, I could even try to get rid of "HTML script" entirely, and just store a couple things on the ES script.

But, I can't find any concept of script in ES! :(

The closest thing I can find is the top-level execution context scriptCtx created by ScriptEvaluation.

So far the best I've come up with is:

  • When running script from HTML, via NextJob(ScriptEvaluationJob, ...), smuggle in the HTML script as part of the [[HostDefined]]. Then, say something like "All execution contexts created from this ScriptEvaluationJob must have a state component pointing back to the HTML script". (Apparently execution contexts are allowed to have implementation-dependent state.)
  • When implementation defined unhandled exception processing happens, use "the running execution context" to retrieve the appropriate HTML script.

Does this seem vaguely legit? I don't like "all execution contexts created from".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions