[Webkit-unassigned] [Bug 21257] JS bindings should throw when too few arguments are passed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 4 10:57:36 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=21257





--- Comment #20 from Ojan Vafai <ojan at chromium.org>  2010-06-04 10:57:33 PST ---
(In reply to comment #18)
> > However, I also like that I can leave out the frequently unnecessary arguments. Can we make many of these optional via the IDL?
> 
> The path for doing that would be via standards bodies.  We should strive for interoperability between browsers rather than adding random WebKit quirks.

If we were to a) make the default being to throw when too few arguments are passed in and b) make the relevant arguments optional, that would be an incremental step in the direction of interoperability with other browsers while still minimizing the risk of causing regressions.

I agree that we should push for these changes in standards bodies. Making previously required arguments optional should be extremely safe. We can move forward with this patch (including making arguments optional) and we could email the appropriate standards bodies. I don't care which order we do that in or we could do so in parallel.

It would be a real shame to just make all these arguments required though. FWIW, I have personally written sites that would break if we did. I can't imagine I'm the only one. And really, it's one of the nicer things about coding just for WebKit that you can use a more concise coding style by leaving out these arguments.

(In reply to comment #17)
> (In reply to comment #16)
> > For example, being able to leave out the third boolean parameter in addEventListener is great. We should maintain that.
> 
> While I appreciate the implications of making previously working code fail, I don't agree that we should maintain this.
> 
> Imagine a web developer using a WebKit-based browser as his main development platform. When he switches to another browser for compatibility testing and his code throws exceptions in "random" places, WebKit starts to look a bit too permissive.

Previously working code failing is only one of my concerns. I'm also worried that we're making the web platform worse. These specific cases are arguments that *should* have been optional from the start. In either case, the fix to your concern about WebKit being too permissive is to bring other browser vendors in agreement to make these arguments optional.

> I like what AP said about the engine helping the developer detect mistakes. So if we do take the route of making these arguments optional, I think we should at least emit some kind of "developer-only" warning when leaving them out.

In general, I do think we should throw when you give too few arguments. I also think that many of the arguments in question should be optional in all browsers.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list