Re: [heycam/webidl] Modernize invoking user code (#113)

>                  <li>
>                    Let <var>arg</var><sub>0..<var>n</var>−1</sub> be a list of
>                    ECMAScript values, where <var>arg</var><sub><var>i</var></sub> is the result
>                    of <a class="dfnref" href="#dfn-convert-idl-to-ecmascript-value">converting</a>
>                    <var>idlarg</var><sub><var>i</var></sub> to an ECMAScript value.
>                  </li>
> -                <li>Let <var>script</var> be the <a class="dfnref" href="#dfn-callback-context">callback context</a> associated with <var>V</var>.</li>
> -                <li>Push <var>script</var> on to the <a class="dfnref external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html">stack of incumbent scripts</a>. <a href="#ref-HTML">[HTML]</a></li>
> +                <li>Let <var>execution context</var> be <a class="external" href="https://tc39.github.io/ecma262/#sec-getfunctionrealm">GetFunctionRealm</a>(<var>X</var>)'s <a class="dfnref external" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-realm-settings-object">settings object</a>'s <a class="external" href="https://html.spec.whatwg.org/multipage/webappapis.html#realm-execution-context">realm execution context</a>.</li>

Hmm, I must be missing what the connection is between entry settings object and exception handling? The current spec is very vague on this. EventTarget says "report the exception". And the definition of "report an exception" just says "using the global object specified by the relevant script's settings object as the target." I have no idea what the "relevant script" is. I guess that is https://github.com/whatwg/html/issues/958. I guess you're assuming it's derived from the entry settings object. Maybe that was agreed upon in some earlier thread I forgot or was before my time.

To match Chrome's behavior, I guess we would have event dispatch specifically report errors to the EventTarget object's relevant settings object. Maybe it would be ideal to have every caller of "report an exception" explicitly supply a global object or settings object to dispatch at anyway.

But that of course still doesn't solve the problem of needing to set up the entry settings object before the Get() call.

One solution is to do here what I did below for "get a user object's attribute value": use _value_'s callback context's settings object's realm execution context. I think that works? I guess it would give B in both cases?

Another solution is to acknowledge that all objects have a realm, not just functions, and then use _O_'s realm. No spec acknowledges this currently, but we could just say "_O_'s realm" and add a note stating our assumption here. That would, if I understand correctly, use B in both cases also.

Thoughts?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/113/files/2687a7f8dee42781c250ffc11c084f1ef84d1bf4#r62941025

Received on Wednesday, 11 May 2016 22:55:34 UTC