[Webkit-unassigned] [Bug 240219] foo(optional unsigned long long offset = 0) IDL functions don't work when called like foo(undefined) or foo()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 15 11:47:12 PDT 2022


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

--- Comment #4 from Myles C. Maxfield <mmaxfield at apple.com> ---
Created attachment 459381

  --> https://bugs.webkit.org/attachment.cgi?id=459381&action=review

Test file

Here is a test file demonstrating the problem. (You have to open it in DumpRenderTree; it's not hooked up into WK2 yet, and is intentionally disabled in Minibrowser.) The IDL has:

Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size);

And if you call it like

buffer.mapAsync(GPUMapMode.WRITE);

then our generated bindings code does this:

auto offset = convert<IDLEnforceRangeAdaptor<IDLUnsignedLongLong>>(*lexicalGlobalObject, argument1.value());

which gets sent to:

double JSValue::toNumberSlowCase(JSGlobalObject* globalObject) const
{
    ...
    return isUndefined() ? PNaN : 0; // null and false both convert to 0.
}

and then sent to

static double enforceRange(JSGlobalObject& lexicalGlobalObject, double x, double minimum, double maximum)
{
    ...
    if (std::isnan(x) || std::isinf(x)) {
        throwTypeError(&lexicalGlobalObject, scope, rangeErrorString(x, minimum, maximum));
        return 0;
    }
    ...
}

-- 
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/20220515/58121160/attachment.htm>


More information about the webkit-unassigned mailing list