Bug 172480 - [WebIDL] Overloaded functions should throw this object check exception before argument check exception
Summary: [WebIDL] Overloaded functions should throw this object check exception before...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-05-22 17:10 PDT by Sam Weinig
Modified: 2017-05-30 20:24 PDT (History)
2 users (show)

See Also:


Attachments
Test case (645 bytes, text/html)
2017-05-22 17:10 PDT, Sam Weinig
no flags Details
Patch (299.28 KB, patch)
2017-05-26 17:15 PDT, Sam Weinig
cdumez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>