[Webkit-unassigned] [Bug 139179] HTMLSelectElement add() should support index as second argument

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 23 11:04:29 PST 2014


--- Comment #31 from Chris Dumez <cdumez at apple.com> ---
Before we decide to use custom code, would you mind trying:
[ObjCLegacyUnnamedParameters, RaisesException] void add([Default=Undefined] optional HTMLElement? element, [Default=Undefined] optional HTMLElement? before);
[RaisesException] void add(HTMLElement element, long before);

The order is important, so are the question marks to indicate that the arguments are nullable.

This generate the following code:

EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionAdd(ExecState* exec)
    size_t argsCount = exec->argumentCount();
    JSValue arg0(exec->argument(0));
    JSValue arg1(exec->argument(1));
    if (argsCount == 0 || (argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSHTMLElement::info())))) || (argsCount == 2 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSHTMLElement::info()))) && (arg1.isNull() || (arg1.isObject() && asObject(arg1)->inherits(JSHTMLElement::info())))))
        return jsHTMLSelectElementPrototypeFunctionAdd1(exec);
    if ((argsCount == 2 && (arg0.isObject() && asObject(arg0)->inherits(JSHTMLElement::info()))))
        return jsHTMLSelectElementPrototypeFunctionAdd2(exec);
    return throwVMTypeError(exec);

I did not have much time to look into this but this generated code seems to do what you want, right?

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20141223/007ba947/attachment-0002.html>

More information about the webkit-unassigned mailing list