W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2012

Re: [whatwg] URL: URLQuery

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 13 Oct 2012 12:03:10 -0400
Message-ID: <507990BE.6010706@mit.edu>
To: whatwg@lists.whatwg.org
On 10/13/12 11:53 AM, Glenn Maynard wrote:
> You mean, people putting extra properties on things like Object.prototype
> or DOMStringMap.prototype, and breaking code doing for(a in {})?  I don't
> find that to be a problem: that's nuts, so I don't do it.

Yes, but lots of libraries do.  But even that's not the real problem.

> Unless the suggestion is that Object.getPrototypeOf(query.values) === null?
>>
>
> That, or making the prototype immutable, as if Object.freeze was called on
> it.

Making the proto immutable is not good enough.

Consider code that wants to extract a "toString" URL parameter.  How do 
you propose it go about doing that in a setup where query.values is a 
normal object with a proto chain that chains up to Object.prototype?

Note that there are lots of other property names that have the same problem.

It's not clear to me to what extent implementing as a proxy can mitigate 
this.  I suppose you could write has() and get() traps that ignore the 
proto chain, even if you for some reason want that proto chain to be 
there....

-Boris
Received on Saturday, 13 October 2012 16:03:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT