Changeset 207770 in webkit
- Timestamp:
- Oct 24, 2016 11:29:36 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 added
- 4 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207769 r207770 1 2016-10-24 Zan Dobersek <zdobersek@igalia.com> 2 3 [CodeGenerator] Only allow a single interface or standalone dictionary per WebIDL file 4 https://bugs.webkit.org/show_bug.cgi?id=163889 5 6 Reviewed by Chris Dumez. 7 8 Assert that there's only one interface or standalone dictionary 9 per WebIDL input file, and exit from the generator otherwise. 10 11 This avoids potential linking issues where multiple enumeration 12 and dictionary bindings code can be generated if the source 13 WebIDL for them is specified in a file that contains multiple 14 interfaces or standalone dictionaries. 15 16 Additionally, the generator now also exits if it fails to 17 generate code for any interface of standalone dictionary. This 18 should avoid processing WebIDL files that are empty in 19 substance. 20 21 TestException.idl and TestInterface.idl files have their second 22 interfaces removed. In place of those a new testing IDL file is 23 added, TestInterfaceLeadingUnderscore.idl. Like the two removed 24 interfaces, it tests that the leading underscode in the 25 identifier is removed by the generator. 26 27 * bindings/scripts/CodeGenerator.pm: 28 (ProcessDocument): 29 * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: Added. 30 (WebCore::JSTestInterfaceLeadingUnderscorePrototype::create): 31 (WebCore::JSTestInterfaceLeadingUnderscorePrototype::createStructure): 32 (WebCore::JSTestInterfaceLeadingUnderscorePrototype::JSTestInterfaceLeadingUnderscorePrototype): 33 (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::prototypeForStructure): 34 (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties): 35 (WebCore::JSTestInterfaceLeadingUnderscorePrototype::finishCreation): 36 (WebCore::JSTestInterfaceLeadingUnderscore::JSTestInterfaceLeadingUnderscore): 37 (WebCore::JSTestInterfaceLeadingUnderscore::createPrototype): 38 (WebCore::JSTestInterfaceLeadingUnderscore::prototype): 39 (WebCore::JSTestInterfaceLeadingUnderscore::destroy): 40 (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute): 41 (WebCore::jsTestInterfaceLeadingUnderscoreReadonly): 42 (WebCore::jsTestInterfaceLeadingUnderscoreReadonlyGetter): 43 (WebCore::jsTestInterfaceLeadingUnderscoreConstructor): 44 (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor): 45 (WebCore::JSTestInterfaceLeadingUnderscore::getConstructor): 46 (WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots): 47 (WebCore::JSTestInterfaceLeadingUnderscoreOwner::finalize): 48 (WebCore::toJSNewlyCreated): 49 (WebCore::toJS): 50 (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped): 51 * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h: Renamed from Source/WebCore/bindings/scripts/test/JS/JSreadonly.h. 52 (WebCore::JSTestInterfaceLeadingUnderscore::create): 53 (WebCore::JSTestInterfaceLeadingUnderscore::createStructure): 54 (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation): 55 (WebCore::wrapperOwner): 56 (WebCore::wrapperKey): 57 (WebCore::toJS): 58 (WebCore::toJSNewlyCreated): 59 * bindings/scripts/test/JS/JSattribute.cpp: Removed. 60 * bindings/scripts/test/JS/JSattribute.h: Removed. 61 * bindings/scripts/test/JS/JSreadonly.cpp: Removed. 62 * bindings/scripts/test/TestException.idl: 63 * bindings/scripts/test/TestInterface.idl: 64 * bindings/scripts/test/TestInterfaceLeadingUnderscore.idl: Copied from Source/WebCore/bindings/scripts/test/TestException.idl. 65 1 66 2016-10-21 Alex Christensen <achristensen@webkit.org> 2 67 -
trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm
r207768 r207770 206 206 207 207 my $interfaces = $useDocument->interfaces; 208 foreach my $interface (@$interfaces) { 208 if (@$interfaces) { 209 die "Multiple interfaces per document are not supported" if @$interfaces > 1; 210 211 my $interface = @$interfaces[0]; 209 212 print "Generating $useGenerator bindings code for IDL interface \"" . $interface->name . "\"...\n" if $verbose; 210 # FIXME: Repeating each enumeration and dictionaries for every interface would not work if we actually were using211 # multiple interfaces per file, but we aren't, so this is fine for now.212 213 $codeGenerator->GenerateInterface($interface, $defines, $useDocument->enumerations, $useDocument->dictionaries); 213 214 $codeGenerator->WriteData($interface, $useOutputDir, $useOutputHeadersDir); 214 } 215 216 # It is possible to have dictionaries in an IDL file without any interface. 217 unless (@$interfaces) { 218 foreach my $dictionary (@{$useDocument->dictionaries}) { 219 $codeGenerator->GenerateDictionary($dictionary, $useDocument->enumerations); 220 $codeGenerator->WriteData($dictionary, $useOutputDir, $useOutputHeadersDir); 221 } 222 } 215 return; 216 } 217 218 my $dictionaries = $useDocument->dictionaries; 219 if (@$dictionaries) { 220 die "Multiple standalone dictionaries per document are not supported" if @$dictionaries > 1; 221 222 my $dictionary = @$dictionaries[0]; 223 print "Generating $useGenerator bindings code for IDL dictionary \"" . $dictionary->name . "\"...\n" if $verbose; 224 $codeGenerator->GenerateDictionary($dictionary, $useDocument->enumerations); 225 $codeGenerator->WriteData($dictionary, $useOutputDir, $useOutputHeadersDir); 226 return; 227 } 228 229 die "Processing document " . $useDocument->fileName . " did not generate anything" 223 230 } 224 231 -
trunk/Source/WebCore/bindings/scripts/test/TestException.idl
r165676 r207770 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 exception TestException { 29 30 readonly attribute DOMString name; 30 31 }; 31 32 // Identifiers with a leading underscore, which should be removed.33 exception _attribute {34 readonly attribute DOMString _readonly;35 }; -
trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl
r207279 r207770 42 42 43 43 TestInterface implements TestImplements; 44 45 [46 ImplementationLacksVTable47 ] interface _readonly {48 };
Note: See TracChangeset
for help on using the changeset viewer.