WebKit Bugzilla
Attachment 358816 Details for
Bug 193328
: Bindings generator emits incorrect code when using VoidCallback as an IDL dictionary attribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193328-20190110120139.patch (text/plain), 5.01 KB, created by
Wenson Hsieh
on 2019-01-10 12:01:40 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-10 12:01:40 PST
Size:
5.01 KB
patch
obsolete
>Subversion Revision: 239772 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d1d06c556eec5c88e2727c195ce2ce8b0d2dd13d..f36b30a6fa0138528fc89a318ef77bade4530ee4 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-01-10 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Bindings generator emits incorrect code when using VoidCallback as an IDL dictionary attribute >+ https://bugs.webkit.org/show_bug.cgi?id=193328 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Currently, when generating the function body of `convertDictionary`, our bindings generator does not pass in an >+ argument to use as the `$globalObjectReference` in `JSValueToNative`, when generating code to convert a wrapped >+ attribute value to the native value. As a result, if the generated IDL type returns `true` from >+ `JSValueToNativeDOMConvertNeedsGlobalObject` (i.e. for callback function types), we will end up using the empty >+ string as the generated expression for the global object. This emits syntactically incorrect code: >+ >+ `convert<IDLCallbackFunction<JSVoidCallback>>(state, someValue, );` >+ >+ To fix this, we pass in a string to use as the global object, which uses the given ExecState to grab the global >+ object. Tested by augmenting TestStandaloneDictionary.idl and its generated expectation. >+ >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (GenerateDictionaryImplementationContent): >+ * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: >+ (WebCore::convertDictionary<DictionaryImplName>): >+ * bindings/scripts/test/TestStandaloneDictionary.idl: >+ > 2019-01-09 Carlos Garcia Campos <cgarcia@igalia.com> > > REGRESSION(r239156): [FreeType] fixed width, and synthetic bold/italic not correctly applied since r239156 >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index a98264b79bd8ad984010ccdfc567400bd98a2648..f92ed2ded991842e233ffedf6c5f57404bac96b6 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -2348,7 +2348,7 @@ sub GenerateDictionaryImplementationContent > # 4.3. If value is not undefined, then: > $result .= " if (!${key}Value.isUndefined()) {\n"; > >- my $nativeValue = JSValueToNative($typeScope, $member, "${key}Value", $member->extendedAttributes->{Conditional}, "&state", "state"); >+ my $nativeValue = JSValueToNative($typeScope, $member, "${key}Value", $member->extendedAttributes->{Conditional}, "&state", "state", "", "*jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())"); > $result .= " result.$implementedAsKey = $nativeValue;\n"; > $result .= " RETURN_IF_EXCEPTION(throwScope, { });\n"; > >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp >index abc7c41c3503561a90d8aee14c1e0374b61a219b..e21259e911f2ca56486fbcdec0c7020bf906ad7b 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp >@@ -25,7 +25,10 @@ > #include "JSTestStandaloneDictionary.h" > > #include "JSDOMConvertBoolean.h" >+#include "JSDOMConvertCallbacks.h" > #include "JSDOMConvertStrings.h" >+#include "JSDOMGlobalObject.h" >+#include "JSVoidCallback.h" > #include <JavaScriptCore/JSCInlines.h> > #include <JavaScriptCore/JSString.h> > #include <wtf/NeverDestroyed.h> >@@ -58,6 +61,17 @@ template<> DictionaryImplName convertDictionary<DictionaryImplName>(ExecState& s > result.boolMember = convert<IDLBoolean>(state, boolMemberValue); > RETURN_IF_EXCEPTION(throwScope, { }); > } >+ JSValue callbackMemberValue; >+ if (isNullOrUndefined) >+ callbackMemberValue = jsUndefined(); >+ else { >+ callbackMemberValue = object->get(&state, Identifier::fromString(&state, "callbackMember")); >+ RETURN_IF_EXCEPTION(throwScope, { }); >+ } >+ if (!callbackMemberValue.isUndefined()) { >+ result.callbackMember = convert<IDLCallbackFunction<JSVoidCallback>>(state, callbackMemberValue, *jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())); >+ RETURN_IF_EXCEPTION(throwScope, { }); >+ } > JSValue enumMemberValue; > if (isNullOrUndefined) > enumMemberValue = jsUndefined(); >diff --git a/Source/WebCore/bindings/scripts/test/TestStandaloneDictionary.idl b/Source/WebCore/bindings/scripts/test/TestStandaloneDictionary.idl >index 77a5894b0a8006f3c669ba8af5d0b13766c8c562..5727bac668d1a9eabae263949f3f12df1f2c7035 100644 >--- a/Source/WebCore/bindings/scripts/test/TestStandaloneDictionary.idl >+++ b/Source/WebCore/bindings/scripts/test/TestStandaloneDictionary.idl >@@ -36,4 +36,5 @@ enum TestEnumInStandaloneDictionaryFile { "enumValue1", "enumValue2" }; > boolean boolMember; > DOMString stringMember; > TestEnumInStandaloneDictionaryFile enumMember; >+ VoidCallback callbackMember; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193328
: 358816