Changeset 98755 in webkit
- Timestamp:
- Oct 28, 2011, 1:20:50 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 15 edited
-
ChangeLog (modified) (1 diff)
-
DerivedSources.make (modified) (1 diff)
-
GNUmakefile.am (modified) (1 diff)
-
GNUmakefile.list.am (modified) (1 diff)
-
WebCore.gyp/WebCore.gyp (modified) (1 diff)
-
WebCore.gypi (modified) (1 diff)
-
WebCore.vcproj/WebCore.vcproj (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
bindings/js/JSDOMBinding.cpp (modified) (4 diffs)
-
bindings/objc/ExceptionHandlers.mm (modified) (1 diff)
-
bindings/scripts/InFilesCompiler.pm (modified) (3 diffs)
-
bindings/v8/V8Proxy.cpp (modified) (5 diffs)
-
dom/ExceptionCodeDescription.in (modified) (1 diff)
-
dom/make_event_factory.pl (modified) (5 diffs)
-
dom/make_exception_code_description.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98752 r98755 1 2011-10-28 Adam Barth <abarth@webkit.org> 2 3 Autogenerate Exception-downcast code in bindings 4 https://bugs.webkit.org/show_bug.cgi?id=71108 5 6 Reviewed by Eric Seidel. 7 8 This patch uses the same generated code style as we're using for Events 9 to generate the downcasts for the Exception types in the bindings. 10 This cause me to refactor more code from make_event_factory.pl into 11 InFilesCompiler.pm. 12 13 After this patch, some of these files and scripts are misnamed. I'll 14 rename them in a followup patch. 15 16 * DerivedSources.make: 17 * GNUmakefile.am: 18 * GNUmakefile.list.am: 19 * WebCore.gyp/WebCore.gyp: 20 * WebCore.gypi: 21 * WebCore.vcproj/WebCore.vcproj: 22 * WebCore.xcodeproj/project.pbxproj: 23 * bindings/js/JSDOMBinding.cpp: 24 (WebCore::setDOMException): 25 * bindings/objc/ExceptionHandlers.mm: 26 (WebCore::raiseDOMException): 27 * bindings/scripts/InFilesCompiler.pm: 28 (initializeFromCommandLine): 29 (compile): 30 (interfaceForItem): 31 (toMacroStyle): 32 (generateInterfacesHeader): 33 (generateHeadersHeader): 34 * bindings/v8/V8Proxy.cpp: 35 (WebCore::V8Proxy::setDOMException): 36 * dom/ExceptionCodeDescription.in: 37 * dom/make_event_factory.pl: 38 (generateCode): 39 (generateImplementation): 40 * dom/make_exception_code_description.pl: 41 (defaultItemFactory): 42 (generateCode): 43 1 44 2011-10-28 Simon Fraser <simon.fraser@apple.com> 2 45 -
trunk/Source/WebCore/DerivedSources.make
r98711 r98755 858 858 perl -I $(WebCore)/bindings/scripts $< --input $(WebCore)/dom/EventTargetFactory.in 859 859 860 ExceptionCodeDescription.cpp ExceptionCodeDescription.h : dom/make_exception_code_description.pl dom/ExceptionCodeDescription.in860 ExceptionCodeDescription.cpp ExceptionCodeDescription.h ExceptionHeaders.h ExceptionInterfaces.h : dom/make_exception_code_description.pl dom/ExceptionCodeDescription.in 861 861 perl -I $(WebCore)/bindings/scripts $< --input $(WebCore)/dom/ExceptionCodeDescription.in 862 862 -
trunk/Source/WebCore/GNUmakefile.am
r98711 r98755 697 697 $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --input $(WebCore)/dom/EventTargetFactory.in --outputDir "$(GENSOURCES_WEBCORE)" 698 698 699 DerivedSources/WebCore/ExceptionCodeDescription.cpp DerivedSources/WebCore/ExceptionCodeDescription.h : $(WebCore)/dom/make_exception_code_description.pl $(WebCore)/dom/ExceptionCodeDescription.in699 DerivedSources/WebCore/ExceptionCodeDescription.cpp DerivedSources/WebCore/ExceptionCodeDescription.h DerivedSources/WebCore/ExceptionHeaders.h DerivedSources/WebCore/ExceptionInterfaces.h: $(WebCore)/dom/make_exception_code_description.pl $(WebCore)/dom/ExceptionCodeDescription.in 700 700 $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --input $(WebCore)/dom/ExceptionCodeDescription.in --outputDir "$(GENSOURCES_WEBCORE)" 701 701 -
trunk/Source/WebCore/GNUmakefile.list.am
r98711 r98755 16 16 DerivedSources/WebCore/EventTargetInterfaces.h \ 17 17 DerivedSources/WebCore/ExceptionCodeDescription.cpp \ 18 DerivedSources/WebCore/ExceptionHeaders.h \ 19 DerivedSources/WebCore/ExceptionInterfaces.h \ 18 20 DerivedSources/WebCore/HTMLElementFactory.cpp \ 19 21 DerivedSources/WebCore/HTMLElementFactory.h \ -
trunk/Source/WebCore/WebCore.gyp/WebCore.gyp
r98711 r98755 705 705 '<(SHARED_INTERMEDIATE_DIR)/webkit/ExceptionCodeDescription.cpp', 706 706 '<(SHARED_INTERMEDIATE_DIR)/webkit/ExceptionCodeDescription.h', 707 '<(SHARED_INTERMEDIATE_DIR)/webkit/ExceptionHeaders.h', 708 '<(SHARED_INTERMEDIATE_DIR)/webkit/ExceptionInterfaces.h', 707 709 ], 708 710 'action': [ -
trunk/Source/WebCore/WebCore.gypi
r98711 r98755 7082 7082 '<(PRODUCT_DIR)/DerivedSources/WebCore/ExceptionCodeDescription.cpp', 7083 7083 '<(PRODUCT_DIR)/DerivedSources/WebCore/ExceptionCodeDescription.h', 7084 '<(PRODUCT_DIR)/DerivedSources/WebCore/ExceptionHeaders.h', 7085 '<(PRODUCT_DIR)/DerivedSources/WebCore/ExceptionInterfaces.h', 7084 7086 '<(PRODUCT_DIR)/DerivedSources/WebCore/HTMLElementFactory.cpp', 7085 7087 '<(PRODUCT_DIR)/DerivedSources/WebCore/HTMLElementFactory.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r98711 r98755 571 571 </File> 572 572 <File 573 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\ExceptionHeaders.h" 574 > 575 </File> 576 <File 577 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\ExceptionInterfaces.h" 578 > 579 </File> 580 <File 573 581 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\HTMLElementFactory.h" 574 582 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r98720 r98755 3212 3212 97665013144FAA4200F6BB51 /* EventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 97665011144FAA4200F6BB51 /* EventFactory.h */; }; 3213 3213 9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */; }; 3214 9767CE0B145ABC13005E64DB /* ExceptionHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 9767CE09145ABC12005E64DB /* ExceptionHeaders.h */; }; 3215 9767CE0C145ABC13005E64DB /* ExceptionInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */; }; 3214 3216 976D6C77122B8A3D001FD1F7 /* AsyncFileWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C58122B8A3D001FD1F7 /* AsyncFileWriter.h */; }; 3215 3217 976D6C78122B8A3D001FD1F7 /* Blob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976D6C59122B8A3D001FD1F7 /* Blob.cpp */; }; … … 10357 10359 97665011144FAA4200F6BB51 /* EventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventFactory.h; sourceTree = "<group>"; }; 10358 10360 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventFactory.cpp; sourceTree = "<group>"; }; 10361 9767CE09145ABC12005E64DB /* ExceptionHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionHeaders.h; sourceTree = "<group>"; }; 10362 9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionInterfaces.h; sourceTree = "<group>"; }; 10359 10363 976D6C58122B8A3D001FD1F7 /* AsyncFileWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AsyncFileWriter.h; path = fileapi/AsyncFileWriter.h; sourceTree = "<group>"; }; 10360 10364 976D6C59122B8A3D001FD1F7 /* Blob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Blob.cpp; path = fileapi/Blob.cpp; sourceTree = "<group>"; }; … … 15186 15190 973DC63D145A9409002842C2 /* ExceptionCodeDescription.cpp */, 15187 15191 973DC63E145A9409002842C2 /* ExceptionCodeDescription.h */, 15192 9767CE09145ABC12005E64DB /* ExceptionHeaders.h */, 15193 9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */, 15188 15194 A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */, 15189 15195 A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */, … … 24530 24536 A0EE0DF6144F825500F80B0D /* WebGLDebugRendererInfo.h in Headers */, 24531 24537 A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */, 24538 9767CE0B145ABC13005E64DB /* ExceptionHeaders.h in Headers */, 24539 9767CE0C145ABC13005E64DB /* ExceptionInterfaces.h in Headers */, 24532 24540 973DC640145A9409002842C2 /* ExceptionCodeDescription.h in Headers */, 24533 24541 97AA3CA5145237CC003E1DA6 /* EventTargetHeaders.h in Headers */, -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r98715 r98755 22 22 #include "JSDOMBinding.h" 23 23 24 #include "DOMCoreException.h"25 24 #include "DOMObjectHashTableMap.h" 26 #include "EventException.h"27 #include "ExceptionBase.h"28 25 #include "ExceptionCode.h" 29 #include "FileException.h" 26 #include "ExceptionHeaders.h" 27 #include "ExceptionInterfaces.h" 30 28 #include "Frame.h" 31 #include "IDBDatabaseException.h"32 #include "JSDOMCoreException.h"33 29 #include "JSDOMWindowCustom.h" 34 #include "JSEventException.h"35 30 #include "JSExceptionBase.h" 36 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)37 #include "JSFileException.h"38 #include "JSOperationNotAllowedException.h"39 #endif40 #include "JSRangeException.h"41 #if ENABLE(SQL_DATABASE)42 #include "JSSQLException.h"43 #endif44 #if ENABLE(SVG)45 #include "JSSVGException.h"46 #endif47 #include "JSXMLHttpRequestException.h"48 #include "JSXPathException.h"49 #include "OperationNotAllowedException.h"50 #include "RangeException.h"51 #include "SQLException.h"52 #include "SVGException.h"53 31 #include "ScriptCallStack.h" 54 #include "XMLHttpRequestException.h"55 #include "XPathException.h"56 32 #include <runtime/DateInstance.h> 57 33 #include <runtime/Error.h> … … 200 176 } 201 177 178 #define TRY_TO_CREATE_EXCEPTION(interfaceName) \ 179 case interfaceName##Type: \ 180 errorObject = toJS(exec, globalObject, interfaceName::create(description)); \ 181 break; 182 202 183 void setDOMException(ExecState* exec, ExceptionCode ec) 203 184 { … … 214 195 JSValue errorObject; 215 196 switch (description.type) { 216 case DOMCoreExceptionType: 217 errorObject = toJS(exec, globalObject, DOMCoreException::create(description)); 218 break; 219 case RangeExceptionType: 220 errorObject = toJS(exec, globalObject, RangeException::create(description)); 221 break; 222 case EventExceptionType: 223 errorObject = toJS(exec, globalObject, EventException::create(description)); 224 break; 225 case XMLHttpRequestExceptionType: 226 errorObject = toJS(exec, globalObject, XMLHttpRequestException::create(description)); 227 break; 228 #if ENABLE(SVG) 229 case SVGExceptionType: 230 errorObject = toJS(exec, globalObject, SVGException::create(description).get()); 231 break; 232 #endif 233 case XPathExceptionType: 234 errorObject = toJS(exec, globalObject, XPathException::create(description)); 235 break; 236 #if ENABLE(SQL_DATABASE) 237 case SQLExceptionType: 238 errorObject = toJS(exec, globalObject, SQLException::create(description)); 239 break; 240 #endif 241 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) 242 case FileExceptionType: 243 errorObject = toJS(exec, globalObject, FileException::create(description)); 244 break; 245 case OperationNotAllowedExceptionType: 246 errorObject = toJS(exec, globalObject, OperationNotAllowedException::create(description)); 247 break; 248 #endif 249 #if ENABLE(INDEXED_DATABASE) 250 case IDBDatabaseExceptionType: 251 errorObject = toJS(exec, globalObject, IDBDatabaseException::create(description)); 252 break; 253 #endif 197 DOM_EXCEPTION_INTERFACES_FOR_EACH(TRY_TO_CREATE_EXCEPTION) 254 198 } 255 199 … … 257 201 throwError(exec, errorObject); 258 202 } 203 204 #undef TRY_TO_CREATE_EXCEPTION 259 205 260 206 DOMWindow* activeDOMWindow(ExecState* exec) -
trunk/Source/WebCore/bindings/objc/ExceptionHandlers.mm
r98715 r98755 47 47 48 48 NSString *exceptionName; 49 // FIXME: We can use the enum to do these comparisons faster. 49 50 if (strcmp(description.typeName, "DOM Range") == 0) 50 51 exceptionName = DOMRangeException; -
trunk/Source/WebCore/bindings/scripts/InFilesCompiler.pm
r98704 r98755 27 27 use strict; 28 28 29 use Config; 30 use Getopt::Long; 31 use File::Path; 32 use File::Spec; 29 33 use IO::File; 30 34 use InFilesParser; 31 35 36 require Config; 37 32 38 package InFilesCompiler; 33 39 40 my $inputFile = ""; 41 my $outputDir = "."; 34 42 my $defaultItemFactory; 35 43 … … 72 80 } 73 81 82 sub initializeFromCommandLine() 83 { 84 ::GetOptions( 85 'input=s' => \$inputFile, 86 'outputDir=s' => \$outputDir, 87 ); 88 89 die "You must specify --input <file>" unless length($inputFile); 90 91 ::mkpath($outputDir); 92 93 # FIXME: Should we provide outputDir via an accessor? 94 return $outputDir; 95 } 96 74 97 sub compile() 75 98 { 76 99 my $object = shift; 77 78 my $inputFile = shift;79 100 my $generateCode = shift; 80 101 … … 123 144 } 124 145 146 sub interfaceForItem($) 147 { 148 my $object = shift; 149 my $itemName = shift; 150 151 my $interfaceName = $parsedItems{$itemName}{"interfaceName"}; 152 $interfaceName = $itemName unless $interfaceName; 153 154 return $interfaceName; 155 } 156 157 sub toMacroStyle($$) 158 { 159 my $object = shift; 160 my $camelCase = shift; 161 162 return "EVENT" if $camelCase eq "Event"; 163 return "EVENT_TARGET" if $camelCase eq "EventTarget"; 164 return "EXCEPTION" if $camelCase eq "Exception"; 165 166 die "Ok, you got me. This script is really just a giant hack. (\$camelCase=${camelCase})"; 167 } 168 169 sub generateInterfacesHeader() 170 { 171 my $object = shift; 172 173 my $F; 174 my $namespace = $parsedParameters{"namespace"}; 175 my $outputFile = "$outputDir/${namespace}Interfaces.h"; 176 177 open F, ">$outputFile" or die "Failed to open file: $!"; 178 179 print F license(); 180 181 print F "#ifndef ${namespace}Interfaces_h\n"; 182 print F "#define ${namespace}Interfaces_h\n"; 183 print F "\n"; 184 185 my %unconditionalInterfaces = (); 186 my %interfacesByConditional = (); 187 188 for my $itemName (sort keys %parsedItems) { 189 my $conditional = $parsedItems{$itemName}{"conditional"}; 190 my $interfaceName = $object->interfaceForItem($itemName); 191 192 if ($conditional) { 193 if (!defined($interfacesByConditional{$conditional})) { 194 $interfacesByConditional{$conditional} = (); 195 } 196 $interfacesByConditional{$conditional}{$interfaceName} = 1; 197 } else { 198 $unconditionalInterfaces{$interfaceName} = 1 199 } 200 } 201 202 my $macroStyledNamespace = $object->toMacroStyle($namespace); 203 204 for my $conditional (sort keys %interfacesByConditional) { 205 print F "#if ENABLE($conditional)\n"; 206 print F "#define DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional(macro) \\\n"; 207 208 for my $interface (sort keys %{ $interfacesByConditional{$conditional} }) { 209 next if defined($unconditionalInterfaces{$interface}); 210 print F " macro($interface) \\\n"; 211 } 212 213 print F "// End of DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional\n"; 214 print F "#else\n"; 215 print F "#define DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional(macro)\n"; 216 print F "#endif\n"; 217 print F "\n"; 218 } 219 220 print F "#define DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH(macro) \\\n"; 221 print F " \\\n"; 222 for my $interface (sort keys %unconditionalInterfaces) { 223 print F " macro($interface) \\\n"; 224 } 225 print F " \\\n"; 226 for my $conditional (sort keys %interfacesByConditional) { 227 print F " DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional(macro) \\\n"; 228 } 229 230 print F "\n"; 231 print F "#endif // ${namespace}Interfaces_h\n"; 232 233 close F; 234 } 235 236 sub generateHeadersHeader() 237 { 238 my $object = shift; 239 240 my $F; 241 my $namespace = $parsedParameters{"namespace"}; 242 my $outputFile = "$outputDir/${namespace}Headers.h"; 243 244 open F, ">$outputFile" or die "Failed to open file: $!"; 245 246 print F license(); 247 248 print F "#ifndef ${namespace}Headers_h\n"; 249 print F "#define ${namespace}Headers_h\n"; 250 print F "\n"; 251 252 my %includedInterfaces = (); 253 254 for my $itemName (sort keys %parsedItems) { 255 my $conditional = $parsedItems{$itemName}{"conditional"}; 256 my $interfaceName = $object->interfaceForItem($itemName); 257 258 next if defined($includedInterfaces{$interfaceName}); 259 $includedInterfaces{$interfaceName} = 1; 260 261 print F "#if ENABLE($conditional)\n" if $conditional; 262 print F "#include \"$interfaceName.h\"\n"; 263 print F "#if USE(JSC)\n"; 264 print F "#include \"JS$interfaceName.h\"\n"; 265 print F "#elif USE(V8)\n"; 266 print F "#include \"V8$interfaceName.h\"\n"; 267 print F "#endif\n"; 268 print F "#endif\n" if $conditional; 269 } 270 271 print F "\n"; 272 print F "#endif // ${namespace}Headers_h\n"; 273 274 close F; 275 } 276 125 277 1; -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r98730 r98755 38 38 #include "Document.h" 39 39 #include "DocumentLoader.h" 40 #include "ExceptionHeaders.h" 41 #include "ExceptionInterfaces.h" 40 42 #include "Frame.h" 41 43 #include "FrameLoaderClient.h" 42 #include "IDBDatabaseException.h"43 44 #include "IDBFactoryBackendInterface.h" 44 45 #include "IDBPendingTransactionMonitor.h" … … 57 58 #include "V8DOMMap.h" 58 59 #include "V8DOMWindow.h" 59 #include "V8EventException.h"60 #include "V8FileException.h"61 60 #include "V8HiddenPropertyName.h" 62 61 #include "V8IsolatedContext.h" 63 #include "V8OperationNotAllowedException.h"64 #include "V8RangeException.h"65 #include "V8SQLException.h"66 #include "V8XMLHttpRequestException.h"67 #include "V8XPathException.h"68 62 #include "WebKitMutationObserver.h" 69 63 #include "WorkerContext.h" 70 64 #include "WorkerContextExecutionProxy.h" 71 72 #if ENABLE(INDEXED_DATABASE)73 #include "V8IDBDatabaseException.h"74 #endif75 76 #if ENABLE(SVG)77 #include "V8SVGException.h"78 #endif79 65 80 66 #include <algorithm> … … 650 636 } 651 637 638 #define TRY_TO_CREATE_EXCEPTION(interfaceName) \ 639 case interfaceName##Type: \ 640 exception = toV8(interfaceName::create(description)); \ 641 break; 642 652 643 void V8Proxy::setDOMException(int ec) 653 644 { … … 659 650 v8::Handle<v8::Value> exception; 660 651 switch (description.type) { 661 case DOMCoreExceptionType: 662 exception = toV8(DOMCoreException::create(description)); 663 break; 664 case RangeExceptionType: 665 exception = toV8(RangeException::create(description)); 666 break; 667 case EventExceptionType: 668 exception = toV8(EventException::create(description)); 669 break; 670 case XMLHttpRequestExceptionType: 671 exception = toV8(XMLHttpRequestException::create(description)); 672 break; 673 #if ENABLE(SVG) 674 case SVGExceptionType: 675 exception = toV8(SVGException::create(description)); 676 break; 677 #endif 678 case XPathExceptionType: 679 exception = toV8(XPathException::create(description)); 680 break; 681 #if ENABLE(SQL_DATABASE) 682 case SQLExceptionType: 683 exception = toV8(SQLException::create(description)); 684 break; 685 #endif 686 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) 687 case FileExceptionType: 688 exception = toV8(FileException::create(description)); 689 break; 690 case OperationNotAllowedExceptionType: 691 exception = toV8(OperationNotAllowedException::create(description)); 692 break; 693 #endif 694 #if ENABLE(INDEXED_DATABASE) 695 case IDBDatabaseExceptionType: 696 exception = toV8(IDBDatabaseException::create(description)); 697 break; 698 #endif 699 default: 700 ASSERT_NOT_REACHED(); 652 DOM_EXCEPTION_INTERFACES_FOR_EACH(TRY_TO_CREATE_EXCEPTION) 701 653 } 702 654 … … 704 656 v8::ThrowException(exception); 705 657 } 658 659 #undef TRY_TO_CREATE_EXCEPTION 706 660 707 661 v8::Handle<v8::Value> V8Proxy::throwError(ErrorType type, const char* message) -
trunk/Source/WebCore/dom/ExceptionCodeDescription.in
r98711 r98755 1 namespace=Exception CodeDescription1 namespace=Exception 2 2 3 3 DOMCoreException -
trunk/Source/WebCore/dom/make_event_factory.pl
r98713 r98755 33 33 use strict; 34 34 35 use Config;36 use Getopt::Long;37 use File::Path;38 use File::Spec;39 use IO::File;40 35 use InFilesCompiler; 41 42 require Config;43 44 my $inputFile = "";45 my $outputDir = ".";46 47 GetOptions(48 'input=s' => \$inputFile,49 'outputDir=s' => \$outputDir,50 );51 52 mkpath($outputDir);53 54 die "You must specify --input <file>" unless length($inputFile);55 36 56 37 my %defaultParameters = ( 57 38 'namespace' => 0 58 39 ); 59 60 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory);61 62 $InCompiler->compile($inputFile, \&generateCode);63 40 64 41 sub defaultItemFactory … … 70 47 } 71 48 72 sub interfaceForEvent($$) 73 { 74 my ($eventName, $parsedItemsRef) = @_; 49 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory); 75 50 76 my %parsedItems = %{ $parsedItemsRef }; 77 78 my $interfaceName = $parsedItems{$eventName}{"interfaceName"}; 79 $interfaceName = $eventName unless $interfaceName; 80 81 return $interfaceName; 82 } 83 84 sub toMacroStyle($) 85 { 86 my ($camelCase) = @_; 87 88 return "EVENT" if $camelCase eq "Event"; 89 return "EVENT_TARGET" if $camelCase eq "EventTarget"; 90 91 die "Ok, you got me. This script is really just a giant hack. (\$camelCase=${camelCase})"; 92 } 51 my $outputDir = $InCompiler->initializeFromCommandLine(); 52 $InCompiler->compile(\&generateCode); 93 53 94 54 sub generateCode() … … 97 57 my $parsedItemsRef = shift; 98 58 99 printFactoryFile($parsedParametersRef, $parsedItemsRef);100 printMacroFile($parsedParametersRef, $parsedItemsRef);101 printHeadersFile($parsedParametersRef, $parsedItemsRef);59 generateImplementation($parsedParametersRef, $parsedItemsRef); 60 $InCompiler->generateInterfacesHeader(); 61 $InCompiler->generateHeadersHeader() 102 62 } 103 63 104 sub printFactoryFile()64 sub generateImplementation() 105 65 { 106 66 my $parsedParametersRef = shift; … … 134 94 for my $eventName (sort keys %parsedEvents) { 135 95 my $conditional = $parsedEvents{$eventName}{"conditional"}; 136 my $interfaceName = interfaceForEvent($eventName, $parsedItemsRef);96 my $interfaceName = $InCompiler->interfaceForItem($eventName); 137 97 138 98 print F "#if ENABLE($conditional)\n" if $conditional; … … 149 109 close F; 150 110 } 151 152 sub printMacroFile()153 {154 my $parsedParametersRef = shift;155 my $parsedItemsRef = shift;156 157 my $F;158 my %parsedEvents = %{ $parsedItemsRef };159 my %parsedParameters = %{ $parsedParametersRef };160 161 my $namespace = $parsedParameters{"namespace"};162 163 my $outputFile = "$outputDir/${namespace}Interfaces.h";164 165 open F, ">$outputFile" or die "Failed to open file: $!";166 167 print F $InCompiler->license();168 169 print F "#ifndef ${namespace}Interfaces_h\n";170 print F "#define ${namespace}Interfaces_h\n";171 print F "\n";172 173 my %unconditionalInterfaces = ();174 my %interfacesByConditional = ();175 176 for my $eventName (sort keys %parsedEvents) {177 my $conditional = $parsedEvents{$eventName}{"conditional"};178 my $interfaceName = interfaceForEvent($eventName, $parsedItemsRef);179 180 if ($conditional) {181 if (!defined($interfacesByConditional{$conditional})) {182 $interfacesByConditional{$conditional} = ();183 }184 $interfacesByConditional{$conditional}{$interfaceName} = 1;185 } else {186 $unconditionalInterfaces{$interfaceName} = 1187 }188 }189 190 my $macroStyledNamespace = toMacroStyle($namespace);191 192 for my $conditional (sort keys %interfacesByConditional) {193 print F "#if ENABLE($conditional)\n";194 print F "#define DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional(macro) \\\n";195 196 for my $interface (sort keys %{ $interfacesByConditional{$conditional} }) {197 next if defined($unconditionalInterfaces{$interface});198 print F " macro($interface) \\\n";199 }200 201 print F "// End of DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional\n";202 print F "#else\n";203 print F "#define DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional(macro)\n";204 print F "#endif\n";205 print F "\n";206 }207 208 print F "#define DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH(macro) \\\n";209 print F " \\\n";210 for my $interface (sort keys %unconditionalInterfaces) {211 print F " macro($interface) \\\n";212 }213 print F " \\\n";214 for my $conditional (sort keys %interfacesByConditional) {215 print F " DOM_${macroStyledNamespace}_INTERFACES_FOR_EACH_$conditional(macro) \\\n";216 }217 218 print F "\n";219 print F "#endif // ${namespace}Interfaces_h\n";220 221 close F;222 }223 224 sub printHeadersFile()225 {226 my $parsedParametersRef = shift;227 my $parsedItemsRef = shift;228 229 my $F;230 my %parsedEvents = %{ $parsedItemsRef };231 my %parsedParameters = %{ $parsedParametersRef };232 233 my $namespace = $parsedParameters{"namespace"};234 235 my $outputFile = "$outputDir/${namespace}Headers.h";236 237 open F, ">$outputFile" or die "Failed to open file: $!";238 239 print F $InCompiler->license();240 241 print F "#ifndef ${namespace}Headers_h\n";242 print F "#define ${namespace}Headers_h\n";243 print F "\n";244 245 my %includedInterfaces = ();246 247 for my $eventName (sort keys %parsedEvents) {248 my $conditional = $parsedEvents{$eventName}{"conditional"};249 my $interfaceName = interfaceForEvent($eventName, $parsedItemsRef);250 251 next if defined($includedInterfaces{$interfaceName});252 $includedInterfaces{$interfaceName} = 1;253 254 print F "#if ENABLE($conditional)\n" if $conditional;255 print F "#include \"$interfaceName.h\"\n";256 print F "#if USE(JSC)\n";257 print F "#include \"JS$interfaceName.h\"\n";258 print F "#elif USE(V8)\n";259 print F "#include \"V8$interfaceName.h\"\n";260 print F "#endif\n";261 print F "#endif\n" if $conditional;262 }263 264 print F "\n";265 print F "#endif // ${namespace}Headers_h\n";266 267 close F;268 } -
trunk/Source/WebCore/dom/make_exception_code_description.pl
r98715 r98755 33 33 use strict; 34 34 35 use Config;36 use Getopt::Long;37 use File::Path;38 use File::Spec;39 use IO::File;40 35 use InFilesCompiler; 41 42 require Config;43 44 my $inputFile;45 my $outputDir = ".";46 47 GetOptions(48 'input=s' => \$inputFile,49 'outputDir=s' => \$outputDir,50 );51 52 mkpath($outputDir);53 54 die "You must specify --input <file>" unless length($inputFile);55 36 56 37 my %defaultParameters = ( … … 58 39 ); 59 40 60 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory);61 62 $InCompiler->compile($inputFile, \&generateCode);63 64 41 sub defaultItemFactory 65 42 { 66 43 return ( 44 'interfaceName' => 0, 67 45 'conditional' => 0 68 46 ); 69 47 } 70 48 49 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory); 50 51 my $outputDir = $InCompiler->initializeFromCommandLine(); 52 $InCompiler->compile(\&generateCode); 53 71 54 sub generateCode() 72 55 { 73 my $parsedParameters = shift;74 my $parsedItems = shift;56 my $parsedParametersRef = shift; 57 my $parsedItemsRef = shift; 75 58 76 generateHeader($parsedParameters, $parsedItems); 77 generateImplementation($parsedParameters, $parsedItems); 59 generateHeader($parsedParametersRef, $parsedItemsRef); 60 generateImplementation($parsedParametersRef, $parsedItemsRef); 61 $InCompiler->generateInterfacesHeader(); 62 $InCompiler->generateHeadersHeader() 78 63 } 79 64
Note:
See TracChangeset
for help on using the changeset viewer.