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

OK, but there's also this tricky case, as you pointed out:

```js
el.addEventListener("click", el.cloneNode); // purposefully not bound
```

When "inner invoke" invokes the IDL callback created from `el.cloneNode`, which of course throws an exception due to invalid `this`, there's no script possible to pass to "report an exception".

I can't imagine a relevant filename for this, unless we wanted to try to use the callback context, and make it capture the "incumbent script" (i.e. the script that did `addEventListener`). Probably it makes more sense to say that there's no filename that's responsible for throwing, since it's really browser code that's doing the `if (isNotCorrectlyBranded(this)) { throw new TypeError(); }`.

So it seems like the approach of having "report an exception" only take a script, and derive the correct global from that script, won't work, unless we capture the incumbent script. Which sounds pretty different from anything anyone is doing, so probably we shouldn't do that...

---
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#issuecomment-218629030

Received on Thursday, 12 May 2016 00:31:48 UTC