Re: [heycam/webidl] Give Location an immutable prototype object (#606)

The `[ImmutablePrototype]` Blink-specific extended attribute does what you're trying to do here--it makes the `.prototype` property an immutable prototype exotic object. (It doesn't do what that HTML text does, of freezing the prototype of the instance, sorry for my confusion.)

```
> EventTarget.prototype.__proto__ = {}
< VM82:1 Uncaught TypeError: Immutable prototype object '#<EventTarget>' cannot have their prototype set
    at EventTarget.set __proto__ [as __proto__] (<anonymous>)
    at <anonymous>:1:33
```

I still wouldn't mind if we switched the logic in WebIDL from implicitly freezing all prototypes of objects which any global inherits from, to marking each of them with an extended attribute, but we already settled on this design, so I won't try to argue that again. I'm OK with the layering violation here.

If we end up using WebIDL for more kinds of non-web things, it might be helpful to do these kinds of refactorings, to be strict about what's HTML and what's just WebIDL, but we're not there yet. More important to fully specify everything to start. So I'm fine with the spec in its current state.

----

LGTM modulo the following:

Are there wpt tests that check that Location.prototype.__proto__ is not settable?

Is there implementation support for this change? It seems like Firefox, WebKit and Chromium currently all permit `Location.prototype.__proto__` to be set.

-- 
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/606#issuecomment-453099832

Received on Thursday, 10 January 2019 13:43:12 UTC