RE: [WebIDL] Which realm should be used for coercing null/undefined this values to "the" global object?

I checked, and the issues was indeed root-caused to our introduction of strict-mode, but not as a consequence of strict-mode. Rather, IE9 would convert undefined to the raw JS global and pass that to addEventListener in this scenario. The addEventListener code (never expecting to get the raw global) would throw. In IE10, this was fixed so that undefined correctly passes the window object. It was just a bug. :)

-----Original Message-----
From: David Bruant [mailto:bruant.d@gmail.com] 
Sent: Tuesday, September 24, 2013 12:32 AM
To: Boris Zbarsky
Cc: public-script-coord@w3.org
Subject: Re: [WebIDL] Which realm should be used for coercing null/undefined this values to "the" global object?

Le 24/09/2013 02:07, Boris Zbarsky a écrit :
> On 9/23/13 5:43 PM, David Bruant wrote:
>> Maybe IE9 has a form of self-hosted addEventListener, somthing like:
>>      EventTarget.prototype.addEventListener = function(type, listener){
>>          // use |this| as an object
>>      }
>>
>> IE9 has no support for strict mode, so the code would be non-strict 
>> and "this" has the global object as value by default when the 
>> function is called as a function (as opposed to as a method).
>
> It has the global object as default value no matter how it's called, 
> in non-strict code.  Simple testcase:
>
> <script>
>   (function f() {alert(this);}).call(undefined); </script>
>
> try it in your favorite browser.
Yep, I was mistaken. My bad.

David

Received on Wednesday, 25 September 2013 00:53:36 UTC