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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 31 10:51:08 PDT 2009


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





--- Comment #4 from Darin Adler <darin at apple.com>  2009-08-31 10:51:08 PDT ---
(In reply to comment #3)
> I presume this is related to the fact that in Chrome some_function.length
> always returns zero instead of the number of arguments it expects?

If you are getting the wrong value for the length property on a function, you
should file a separate bug about it. It's not the same issue.

I'm guessing this is a problem specific to the DOM bindings for the V8
JavaScript engine. I believe the length property works fine for DOM bindings
with WebKit’s own JavaScript engine.

> That's sort of unfortunate. I am building a DOM diffing tool and the fact that
> WebKit is so lax about such things is currently making it less useful than it
> otherwise could be.

I think "so lax about such things" is a misleading way to put it.

Extra arguments are ignored to match the JavaScript language. The language and
its built-in functions all work this way. For example, you can pass extra
arguments to something like the substr() function on a string and they are
ignored, and no exception is raised.

But it seems that the traditional behavior for the DOM functions in other
browsers is not the same as the behavior of the JavaScript function that are
part of the language specification it self. And I this bug is open because we
think it’s worth considering changing to match the other browsers.

> Are the changes required complex? I have zero experience of being a WebKit
> hacker, and the fact that Chrome and Safari use different JavaScript engines is
> discouraging as well - presumably this bug would need to be fixed twice?

The fix should be relatively straightforward. It will just be adding code that
checks numbers of parameters and throws exceptions, both to individual function
bindings and to the automatically-generated function bindings created by the
perl script that reads our DOM IDL files.

A more challenging part is the necessary step writing thorough test cases.

And yes, I think this will need to be fixed twice.

-- 
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