W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: URLQuery / FormData

From: Jason Orendorff <jason.orendorff@gmail.com>
Date: Mon, 9 Sep 2013 18:05:57 -0500
Message-ID: <CAPh8+Zom1n+NiEOT_08Mnzsx58_ikEyUZZx9Lu-DF2m8r9Qj4Q@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: Jonas Sicking <jonas@sicking.cc>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On Mon, Sep 9, 2013 at 9:59 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> On Mon, Sep 9, 2013 at 1:30 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
>> * get(name) -- always returns an array, with ES6 destructering this
>> should be fine
>
> This seems like optimizing for the rare case.

I agree with Jonas. The application code calling .get() will
ordinarily expect exactly 1 entry, right? And otherwise it usually
expects 0 or 1?

So, there's one specific thing applications will want to be able to
ask of this object, more than anything else. There should be a method
that expresses that.

What to do when .get() finds multiple values? It seems safest to
ignore the extras. Throwing an exception is another possibility, ever
so slightly less safe ISTM (because an attacker might be able to
trigger an exception at certain .get() call sites--not a very likely
attack vector, but still).

-j
Received on Monday, 9 September 2013 23:06:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC