Changeset 150292 in webkit
- Timestamp:
- May 17, 2013 1:05:51 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150291 r150292 1 2013-05-17 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 3 Get rid of [ConstructorParameters] extended attributes 4 https://bugs.webkit.org/show_bug.cgi?id=116308 5 6 Reviewed by Kentaro Hara. 7 8 Get rid of WebKit-specific [ConstructorParameters] IDL extended attribute. Instead, 9 [CustomConstructor] arguments are now explicitly specified, similarly to [Constructor] 10 arguments and the constructor object's "length" property is now automatically 11 computed for custom constructors as well. 12 13 This is less error-prone as the value is not hardcoded, more consistent with 14 [Constructor] extended attribute and gives more information about the custom constructor 15 in the IDL file. We also get rid of a WebKit-specific IDL attribute which is always 16 nice. 17 18 No new tests, already covered by fast/js/constructor-length.html. 19 20 * Modules/mediastream/MediaStream.idl: 21 * Modules/webaudio/AudioContext.idl: 22 * Modules/websockets/WebSocket.idl: 23 * bindings/scripts/CodeGeneratorJS.pm: 24 (GenerateConstructorHelperMethods): 25 * bindings/scripts/IDLAttributes.txt: 26 * bindings/scripts/IDLParser.pm: 27 (applyTypedefs): 28 (parseAttributeRest): 29 (copyExtendedAttributes): 30 (parseExtendedAttributeRest): 31 (applyExtendedAttributeList): 32 * bindings/scripts/test/JS/JSFloat64Array.cpp: 33 (WebCore::JSFloat64ArrayConstructor::finishCreation): 34 * bindings/scripts/test/TestTypedArray.idl: 35 * dom/MutationObserver.idl: 36 * fileapi/Blob.idl: 37 * html/DOMFormData.idl: 38 * html/canvas/ArrayBuffer.idl: 39 * html/canvas/DataView.idl: 40 * page/WebKitPoint.idl: 41 * workers/SharedWorker.idl: 42 * workers/Worker.idl: 43 1 44 2013-05-17 Alexey Proskuryakov <ap@apple.com> 2 45 -
trunk/Source/WebCore/Modules/mediastream/MediaStream.idl
r149796 r150292 30 30 Constructor(MediaStream stream), 31 31 Constructor(MediaStreamTrack[] tracks), 32 ConstructorParameters=0,33 32 CallWith=ScriptExecutionContext, 34 33 SkipVTableValidation -
trunk/Source/WebCore/Modules/webaudio/AudioContext.idl
r149796 r150292 29 29 ActiveDOMObject, 30 30 CustomConstructor, 31 ConstructorParameters=0,32 31 EventTarget 33 32 ] interface AudioContext { -
trunk/Source/WebCore/Modules/websockets/WebSocket.idl
r150276 r150292 41 41 EventTarget, 42 42 JSNoStaticTables, 43 ConstructorParameters=144 43 ] interface WebSocket { 45 44 readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons. -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r150283 r150292 4203 4203 4204 4204 my $constructorClassName = $generatingNamedConstructor ? "${className}NamedConstructor" : "${className}Constructor"; 4205 my $leastConstructorLength = $interface->extendedAttributes->{"ConstructorParameters"}; 4206 if (!defined $leastConstructorLength) { 4207 if ($codeGenerator->IsConstructorTemplate($interface, "Event") || $codeGenerator->IsConstructorTemplate($interface, "TypedArray")) { 4208 $leastConstructorLength = 1; 4209 } elsif ($interface->extendedAttributes->{"Constructor"}) { 4210 my @constructors = @{$interface->constructors}; 4211 $leastConstructorLength = 255; 4212 foreach my $constructor (@constructors) { 4213 my $constructorLength = GetFunctionLength($constructor); 4214 $leastConstructorLength = $constructorLength if ($constructorLength < $leastConstructorLength); 4215 } 4216 } else { 4217 $leastConstructorLength = 0; 4218 } 4205 my $leastConstructorLength = 0; 4206 if ($codeGenerator->IsConstructorTemplate($interface, "Event") || $codeGenerator->IsConstructorTemplate($interface, "TypedArray")) { 4207 $leastConstructorLength = 1; 4208 } elsif ($interface->extendedAttributes->{"Constructor"} || $interface->extendedAttributes->{"CustomConstructor"}) { 4209 my @constructors = @{$interface->constructors}; 4210 my @customConstructors = @{$interface->customConstructors}; 4211 $leastConstructorLength = 255; 4212 foreach my $constructor (@constructors, @customConstructors) { 4213 my $constructorLength = GetFunctionLength($constructor); 4214 $leastConstructorLength = $constructorLength if ($constructorLength < $leastConstructorLength); 4215 } 4216 } else { 4217 $leastConstructorLength = 0; 4219 4218 } 4220 4219 -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r150276 r150292 29 29 Constructor 30 30 ConstructorConditional=* 31 ConstructorParameters=*32 31 ConstructorRaisesException 33 32 ConstructorTemplate=Event|TypedArray -
trunk/Source/WebCore/bindings/scripts/IDLParser.pm
r149796 r150292 50 50 extendedAttributes => '$', # Extended attributes 51 51 constructors => '@', # Constructors, list of 'domFunction' 52 customConstructors => '@', # Custom constructors, list of 'domFunction' 52 53 isException => '$', # Used for exception interfaces 53 54 isCallback => '$', # Used for callback interfaces … … 383 384 $self->applyTypedefsForSignature($attribute->signature); 384 385 } 385 foreach my $function (@{$definition->functions}, @{$definition->constructors} ) {386 foreach my $function (@{$definition->functions}, @{$definition->constructors}, @{$definition->customConstructors}) { 386 387 $self->applyTypedefsForSignature($function->signature); 387 388 foreach my $signature (@{$function->parameters}) { … … 1167 1168 } 1168 1169 $self->assertTokenValue($self->getToken(), ";", __LINE__); 1170 # CustomConstructor may also be used on attributes. 1171 if (defined $extendedAttributeList->{"CustomConstructors"}) { 1172 delete $extendedAttributeList->{"CustomConstructors"}; 1173 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; 1174 } 1169 1175 $newDataNode->signature->extendedAttributes($extendedAttributeList); 1170 1176 return $newDataNode; … … 1538 1544 push(@{$extendedAttributeList->{"Constructors"}}, $constructor); 1539 1545 } 1546 } elsif ($key eq "CustomConstructor") { 1547 push(@{$extendedAttributeList->{"CustomConstructors"}}, $attr->{$key}); 1548 } elsif ($key eq "CustomConstructors") { 1549 my @customConstructors = @{$attr->{$key}}; 1550 foreach my $customConstructor (@customConstructors) { 1551 push(@{$extendedAttributeList->{"CustomConstructors"}}, $customConstructor); 1552 } 1540 1553 } else { 1541 1554 $extendedAttributeList->{$key} = $attr->{$key}; … … 1624 1637 } 1625 1638 1626 if ($name eq "Constructor" ) {1639 if ($name eq "Constructor" || $name eq "CustomConstructor") { 1627 1640 $attrs->{$name} = []; 1628 1641 } else { … … 2608 2621 push(@{$interface->constructors}, $newDataNode); 2609 2622 } 2623 if (defined $extendedAttributeList->{"CustomConstructors"}) { 2624 my @customConstructorParams = @{$extendedAttributeList->{"CustomConstructors"}}; 2625 my $index = (@customConstructorParams == 1) ? 0 : 1; 2626 foreach my $param (@customConstructorParams) { 2627 my $customConstructor = domFunction->new(); 2628 $customConstructor->signature(domSignature->new()); 2629 $customConstructor->signature->name("CustomConstructor"); 2630 $customConstructor->signature->extendedAttributes($extendedAttributeList); 2631 $customConstructor->parameters($param); 2632 $customConstructor->{overloadedIndex} = $index++; 2633 push(@{$interface->customConstructors}, $customConstructor); 2634 } 2635 delete $extendedAttributeList->{"CustomConstructors"}; 2636 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; 2637 } 2610 2638 $interface->extendedAttributes($extendedAttributeList); 2611 2639 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp
r148696 r150292 91 91 ASSERT(inherits(&s_info)); 92 92 putDirect(exec->vm(), exec->propertyNames().prototype, JSFloat64ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); 93 putDirect(exec->vm(), exec->propertyNames().length, jsNumber(1 23), ReadOnly | DontDelete | DontEnum);93 putDirect(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum); 94 94 } 95 95 -
trunk/Source/WebCore/bindings/scripts/test/TestTypedArray.idl
r149368 r150292 27 27 [ 28 28 ConstructorTemplate=TypedArray, 29 ConstructorParameters=123,30 29 NumericIndexedGetter, 31 30 CustomIndexedSetter, -
trunk/Source/WebCore/dom/MutationObserver.idl
r149368 r150292 30 30 31 31 [ 32 CustomConstructor, 33 ConstructorParameters=1, 32 CustomConstructor(MutationCallback callback), 34 33 CustomIsReachable, 35 34 ImplementationLacksVTable -
trunk/Source/WebCore/fileapi/Blob.idl
r149368 r150292 33 33 CustomToJSObject, 34 34 JSNoStaticTables, 35 CustomConstructor 35 CustomConstructor, 36 CustomConstructor(sequence<any> blobParts, optional BlobPropertyBag options) 36 37 ] interface Blob { 37 38 readonly attribute unsigned long long size; -
trunk/Source/WebCore/html/DOMFormData.idl
r149368 r150292 30 30 31 31 [ 32 CustomConstructor, 33 ConstructorParameters=1, 32 CustomConstructor(optional HTMLFormElement form), 34 33 JSGenerateToNativeObject, 35 34 JSGenerateToJSObject, -
trunk/Source/WebCore/html/canvas/ArrayBuffer.idl
r149368 r150292 26 26 [ 27 27 GenerateIsReachable=Impl, 28 CustomConstructor, 29 ConstructorParameters=1, 28 CustomConstructor(unsigned long length), 30 29 JSNoStaticTables, 31 30 ImplementationNamespace=WTF, -
trunk/Source/WebCore/html/canvas/DataView.idl
r149368 r150292 25 25 26 26 [ 27 CustomConstructor, 28 ConstructorParameters=1, 27 CustomConstructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength), 29 28 CustomToJSObject, 30 29 JSNoStaticTables -
trunk/Source/WebCore/page/WebKitPoint.idl
r148997 r150292 26 26 [ 27 27 CustomConstructor, 28 CustomConstructor(float x, float y), 28 29 ImplementationLacksVTable 29 30 ] interface WebKitPoint { -
trunk/Source/WebCore/workers/SharedWorker.idl
r150276 r150292 33 33 EnabledAtRuntime, 34 34 Conditional=SHARED_WORKERS, 35 CustomConstructor, 36 Constructor(DOMString scriptURL, [Default=NullString] optional DOMString name), 35 CustomConstructor(DOMString scriptURL, [Default=NullString] optional DOMString name), 37 36 CallWith=ScriptExecutionContext, 38 37 ConstructorRaisesException, -
trunk/Source/WebCore/workers/Worker.idl
r149368 r150292 28 28 [ 29 29 Conditional=WORKERS, 30 CustomConstructor, 31 Constructor(DOMString scriptUrl), 30 CustomConstructor(DOMString scriptUrl), 32 31 CallWith=ScriptExecutionContext, 33 32 ConstructorRaisesException,
Note: See TracChangeset
for help on using the changeset viewer.