This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
http://www.w3.org/TR/WebIDL/#es-invoking-callback-functions When a JS callback is invoked, WebIDL specifies default `this` to be `null`, but JS strict mode functions require that `this` be `undefined`.
(In reply to Nikhil from comment #0) > http://www.w3.org/TR/WebIDL/#es-invoking-callback-functions > > When a JS callback is invoked, WebIDL specifies default `this` to be `null`, > but JS strict mode functions require that `this` be `undefined`. That isn't exactly true. See step 1 of http://www.ecma-international.org/ecma-262/5.1/#sec-10.4.3 Strict mode functions accept whatever is passed to them as a thisValue without modifying it. It's true that the function call operator http://www.ecma-international.org/ecma-262/5.1/#sec-11.2.3 passes undefined as the thisValue (step 7.a) but other means of function invocation (the call/apply functions) can pass null as the thisValue to a function. BTW, I'm not arguing against the proposed change (I'm reserving judgement on that), just saying that it isn't an ES requirement one way or the other.
I think Nikhil is only referring to the cases where you don't explicitly provide a this value, e.g. by doing f() or f.call() or f.apply().
Conceptually, this is meant for cases when no this value is being explicitly provided to a function call, which should act just like this: var f = theFunctionIWasGiven; f(); or f.call();
https://github.com/heycam/webidl/commit/b495c5e1e63db9b3775e5ad48cc6518a46cc0cfc
"When any callback is called, call the callback's internal [[Call]] method, passing undefined as the this value." That takes care of bound functions, too.
Some callbacks are in fact called with some other this value. For example, event handlers and callable event listeners are called with the event target as the this value. So always passing undefined wouldn't be correct either. Of course if the callee is a bound function it'll just ignore the this value passed to [[Call]], so they work no matter what.