Bug 177422 - [WebIDL] Remove GetterMayThrowException
Summary: [WebIDL] Remove GetterMayThrowException
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-24 18:50 PDT by Sam Weinig
Modified: 2022-02-28 03:27 PST (History)
5 users (show)

See Also:


Attachments
Patch (103.09 KB, patch)
2017-09-24 19:45 PDT, Sam Weinig
youennf: 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-09-24 18:50:46 PDT
[WebIDL] Remove GetterMayThrowException
Comment 1 Sam Weinig 2017-09-24 19:45:16 PDT
Created attachment 321663 [details]
Patch
Comment 2 Build Bot 2017-09-24 19:47:59 PDT
Attachment 321663 [details] did not pass style-queue:


ERROR: Source/WebCore/bindings/js/JSDOMConvertBase.h:171:  This { should be at the end of the previous line  [whitespace/braces] [4]
ERROR: Source/WebCore/bindings/js/JSDOMConvertBase.h:201:  This { should be at the end of the previous line  [whitespace/braces] [4]
Total errors found: 2 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 youenn fablet 2017-09-25 09:12:53 PDT
Comment on attachment 321663 [details]
Patch

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

> Source/WebCore/bindings/js/JSDOMConvertBase.h:101
> +template<typename T, typename U> inline auto toJSNewlyCreated(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!WTF::IsTemplate<std::decay_t<U>, ExceptionOr>::value, JSC::JSValue>;

WTF::IsTemplate<std::decay_t<U>, ExceptionOr>::value is used quite a lot.
Can we add a shorthand for it?

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:-5248
> -        assert("Attributes that throw exceptions are not supported with serializers yet.") if $attribute->extendedAttributes->{GetterMayThrowException} || $attribute->extendedAttributes->{MayThrowException};

Serializers will now be able to trigger exceptions without the binding generator noticing it.
Do we need to add any specific exception handling for serializers, like skip or rethrow?
Maybe add a FIXME for now.

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:6565
> +    my $mayThrowException = ref($context) eq "IDLAttribute" || $context->extendedAttributes->{MayThrowException};

Maybe we can remove mayThrowException declaration here since it is only used in one place.

> Source/WebCore/bindings/scripts/test/TestObj.idl:171
> +    attribute DOMString stringAttrWithGetterException;

Do we really need these anymore?

> Source/WebCore/bindings/scripts/test/TestTypedefs.idl:72
> +    attribute DOMString stringAttrWithGetterException;

Ditto.
Comment 4 Sam Weinig 2017-09-25 10:47:50 PDT
(In reply to youenn fablet from comment #3)
> Comment on attachment 321663 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=321663&action=review
> 
> > Source/WebCore/bindings/js/JSDOMConvertBase.h:101
> > +template<typename T, typename U> inline auto toJSNewlyCreated(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!WTF::IsTemplate<std::decay_t<U>, ExceptionOr>::value, JSC::JSValue>;
> 
> WTF::IsTemplate<std::decay_t<U>, ExceptionOr>::value is used quite a lot.
> Can we add a shorthand for it?
>

I will try.
 
> > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:-5248
> > -        assert("Attributes that throw exceptions are not supported with serializers yet.") if $attribute->extendedAttributes->{GetterMayThrowException} || $attribute->extendedAttributes->{MayThrowException};
> 
> Serializers will now be able to trigger exceptions without the binding
> generator noticing it.
> Do we need to add any specific exception handling for serializers, like skip
> or rethrow?
> Maybe add a FIXME for now.

Yeah, I'll add a FIXME. It will assert at runtime right now. I need to rip out all the this stuff and add the new toJSON / [Default] stuff.

> 
> > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:6565
> > +    my $mayThrowException = ref($context) eq "IDLAttribute" || $context->extendedAttributes->{MayThrowException};
> 
> Maybe we can remove mayThrowException declaration here since it is only used
> in one place.

It's used in two places, so I'll keep it for now.

> 
> > Source/WebCore/bindings/scripts/test/TestObj.idl:171
> > +    attribute DOMString stringAttrWithGetterException;
> 
> Do we really need these anymore?
> 
> > Source/WebCore/bindings/scripts/test/TestTypedefs.idl:72
> > +    attribute DOMString stringAttrWithGetterException;
> 
> Ditto.

No. Will remove.
Comment 5 Sam Weinig 2017-09-25 12:16:16 PDT
Committed r222454: <http://trac.webkit.org/changeset/222454>
Comment 6 Radar WebKit Bug Importer 2017-09-27 12:18:15 PDT
<rdar://problem/34692990>