Boris Zbarsky (2015-01-27T19:48:03.000Z)
On 12/4/14 11:49 AM, Mark S. Miller wrote:
> On Thu, Dec 4, 2014 at 2:58 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>> OK.  What do we do if we discover that throwing from the defineProperty call
>> with a non-configurable property descriptor is not web-compatible?
>
> What we always do

So just for the record, jQuery (at least all the 2.* versions I've 
looked at) contains that following bits:

   Data.prototype = {
	key: function( owner ) {
...
		var descriptor = {},
...
			// Secure it in a non-enumerable, non-writable property
			try {
				descriptor[ this.expando ] = { value: unlock };
				Object.defineProperties( owner, descriptor );

			// Support: Android < 4
			// Fallback to a less secure definition
			} catch ( e ) {
				descriptor[ this.expando ] = unlock;
				jQuery.extend( owner, descriptor );
			}

This function is called from Data.prototype.get, which is called from 
jQuery.event.add.  So the upshot is that trying to add an event listener 
to the window via the jQuery API will hit this codepath.

Now the good news is that the try/catch _is_ present there, so this 
doesn't immediately break sites.  But it's something to watch out for, 
and we _will_ be changing the behavior of jQuery here in a way that the 
jQuery developers clearly think is undesirable.

-Boris
d at domenic.me (2015-02-13T23:27:08.117Z)
On 12/4/14 11:49 AM, Mark S. Miller wrote:
> On Thu, Dec 4, 2014 at 2:58 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>> OK.  What do we do if we discover that throwing from the defineProperty call
>> with a non-configurable property descriptor is not web-compatible?
>
> What we always do

So just for the record, jQuery (at least all the 2.* versions I've 
looked at) contains that following bits:

```js
   Data.prototype = {
	key: function( owner ) {
...
		var descriptor = {},
...
			// Secure it in a non-enumerable, non-writable property
			try {
				descriptor[ this.expando ] = { value: unlock };
				Object.defineProperties( owner, descriptor );

			// Support: Android < 4
			// Fallback to a less secure definition
			} catch ( e ) {
				descriptor[ this.expando ] = unlock;
				jQuery.extend( owner, descriptor );
			}
```

This function is called from Data.prototype.get, which is called from 
jQuery.event.add.  So the upshot is that trying to add an event listener 
to the window via the jQuery API will hit this codepath.

Now the good news is that the try/catch _is_ present there, so this 
doesn't immediately break sites.  But it's something to watch out for, 
and we _will_ be changing the behavior of jQuery here in a way that the 
jQuery developers clearly think is undesirable.