Bug 172480

Summary: [WebIDL] Overloaded functions should throw this object check exception before argument check exception
Product: WebKit Reporter: Sam Weinig <sam>
Component: BindingsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case
none
Patch cdumez: review+

Description Sam Weinig 2017-05-22 17:10:23 PDT
Created attachment 310959 [details]
Test case

Overloaded functions currently do argument checks before the this object check, which leads to the exceptions being thrown in the wrong order.
Comment 1 Sam Weinig 2017-05-26 17:15:31 PDT
Created attachment 311400 [details]
Patch
Comment 2 Chris Dumez 2017-05-26 18:49:54 PDT
Comment on attachment 311400 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311400&action=review

r=me

> Source/WebCore/ChangeLog:13
> +        - Made is so all operations, including static ones, use the trampoline / body model,

made *it* ?

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:4401
> +    assert("[Custom] is not support for overloaded operations.") if $isCustom && $isOverloaded;

*supported*

> Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp:393
> +static inline JSC::EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperationBody2(JSC::ExecState* state, typename IDLOperation<JSTestGlobalObject>::ClassParameter castedThis, JSC::ThrowScope& throwScope)

My personal preference would have been Operation2Body rather than OperationBody2.

> Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp:886
> +static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionSupplementalMethod2Body(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)

Notice that the format here is Method2Body, not MethodBody2.
Comment 3 Sam Weinig 2017-05-26 19:54:04 PDT
Committed r217518: <http://trac.webkit.org/changeset/217518>
Comment 4 Radar WebKit Bug Importer 2017-05-30 20:24:40 PDT
<rdar://problem/32479788>