Changeset 207515 in webkit
- Timestamp:
- Oct 18, 2016 7:26:50 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207514 r207515 1 2016-10-18 Chris Dumez <cdumez@apple.com> 2 3 [Web IDL] Kill support for [LegacyConstructorTemplate=Event] / [LegacyInitializedByEventConstructor] 4 https://bugs.webkit.org/show_bug.cgi?id=163630 5 6 Reviewed by Darin Adler. 7 8 Update / rebaseline existing tests to reflect minor behavior changes. 9 10 * fast/events/constructors/event-constructors-expected.txt: 11 * fast/events/constructors/event-constructors.html: 12 * fast/events/constructors/ui-event-constructor-expected.txt: 13 1 14 2016-10-18 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/LayoutTests/fast/events/constructors/event-constructors-expected.txt
r93951 r207515 22 22 PASS (new Event('eventType', undefined)).bubbles is false 23 23 PASS (new Event('eventType', undefined)).cancelable is false 24 PASS (new Event('eventType', 0)).bubbles is false 25 PASS (new Event('eventType', 0)).cancelable is false 24 PASS new Event('eventType', 0) threw exception TypeError: Type error. 26 25 PASS (new Event('eventType', window)).bubbles is false 27 26 PASS (new Event('eventType', window)).cancelable is false -
trunk/LayoutTests/fast/events/constructors/event-constructors.html
r155267 r207515 52 52 53 53 // A number as the initializer. 54 // FIXME: Should this throw? 55 test("new Event('eventType', 0)", false, false); 54 shouldThrowErrorName("new Event('eventType', 0)", "TypeError"); 56 55 57 56 // The window as the initializer. -
trunk/LayoutTests/fast/events/constructors/ui-event-constructor-expected.txt
r203950 r207515 14 14 PASS new UIEvent('eventType', { view: window }).view is window 15 15 PASS new UIEvent('eventType', { view: this }).view is this 16 PASS new UIEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window.17 PASS new UIEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window.16 PASS new UIEvent('eventType', { view: testObject }).view threw exception TypeError: Type error. 17 PASS new UIEvent('eventType', { view: document }).view threw exception TypeError: Type error. 18 18 PASS new UIEvent('eventType', { view: undefined }).view is null 19 19 PASS new UIEvent('eventType', { view: null }).view is null 20 PASS new UIEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window.21 PASS new UIEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window.22 PASS new UIEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window.23 PASS new UIEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window.24 PASS new UIEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window.25 PASS new UIEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window.26 PASS new UIEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window.27 PASS new UIEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window.28 PASS new UIEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window.20 PASS new UIEvent('eventType', { view: false }).view threw exception TypeError: Type error. 21 PASS new UIEvent('eventType', { view: true }).view threw exception TypeError: Type error. 22 PASS new UIEvent('eventType', { view: '' }).view threw exception TypeError: Type error. 23 PASS new UIEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Type error. 24 PASS new UIEvent('eventType', { view: 12345 }).view threw exception TypeError: Type error. 25 PASS new UIEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Type error. 26 PASS new UIEvent('eventType', { view: NaN }).view threw exception TypeError: Type error. 27 PASS new UIEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Type error. 28 PASS new UIEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Type error. 29 29 PASS new UIEvent('eventType', { get view() { throw 'UIEvent Error'; } }) threw exception UIEvent Error. 30 30 PASS new UIEvent('eventType', { detail: 0 }).detail is 0 -
trunk/Source/WebCore/ChangeLog
r207514 r207515 1 2016-10-18 Chris Dumez <cdumez@apple.com> 2 3 [Web IDL] Kill support for [LegacyConstructorTemplate=Event] / [LegacyInitializedByEventConstructor] 4 https://bugs.webkit.org/show_bug.cgi?id=163630 5 6 Reviewed by Darin Adler. 7 8 Kill support for [LegacyConstructorTemplate=Event] / [LegacyInitializedByEventConstructor] in our 9 IDL now that all our events use proper constructors instead. 10 11 * bindings/scripts/CodeGenerator.pm: 12 * bindings/scripts/CodeGeneratorJS.pm: 13 (GenerateHeader): 14 (GenerateConstructorDefinition): 15 (GenerateConstructorHelperMethods): 16 (IsConstructable): 17 * bindings/scripts/IDLAttributes.txt: 18 * dom/Event.h: 19 (WebCore::Event::create): 20 * dom/Event.idl: 21 * dom/UIEvent.h: 22 (WebCore::UIEvent::create): 23 * dom/UIEvent.idl: 24 1 25 2016-10-18 Chris Dumez <cdumez@apple.com> 2 26 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r207479 r207515 1751 1751 463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463EB6201B8789CB0096ED51 /* TagCollection.cpp */; }; 1752 1752 463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; }; 1753 465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */; }; 1754 465307D11DB6EE4A00E4137C /* JSUIEventInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */; }; 1753 1755 465A8E791C8A24CE00E7D3E4 /* RuntimeApplicationChecks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecks.mm */; }; 1754 1756 4669B2871B852A0B000F905F /* JSDOMNamedFlowCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */; }; … … 5977 5979 E125F83D182411E700D84CD9 /* JSCryptoOperationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E125F83B182411E700D84CD9 /* JSCryptoOperationData.cpp */; }; 5978 5980 E125F83E182411E700D84CD9 /* JSCryptoOperationData.h in Headers */ = {isa = PBXBuildFile; fileRef = E125F83C182411E700D84CD9 /* JSCryptoOperationData.h */; }; 5979 5980 5981 E125F8411824253A00D84CD9 /* CryptoAlgorithmAES_CBC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E125F83F1824253A00D84CD9 /* CryptoAlgorithmAES_CBC.cpp */; }; 5981 5982 E125F8421824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h in Headers */ = {isa = PBXBuildFile; fileRef = E125F8401824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h */; }; … … 7328 7329 0F4710AD1DB56AFC002DCEC3 /* DOMRectReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMRectReadOnly.h; sourceTree = "<group>"; }; 7329 7330 0F4710AE1DB56AFC002DCEC3 /* DOMRectReadOnly.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMRectReadOnly.idl; sourceTree = "<group>"; }; 7330 0F4710B51DB56BE8002DCEC3 /* JSDOMRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMRect.cpp;path = JSDOMRect.cpp; sourceTree = "<group>"; };7331 0F4710B61DB56BE8002DCEC3 /* JSDOMRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMRect.h;path = JSDOMRect.h; sourceTree = "<group>"; };7332 0F4710B71DB56BE8002DCEC3 /* JSDOMRectInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMRectInit.cpp;path = JSDOMRectInit.cpp; sourceTree = "<group>"; };7333 0F4710B81DB56BE8002DCEC3 /* JSDOMRectInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMRectInit.h;path = JSDOMRectInit.h; sourceTree = "<group>"; };7334 0F4710B91DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMRectReadOnly.cpp;path = JSDOMRectReadOnly.cpp; sourceTree = "<group>"; };7335 0F4710BA1DB56BE8002DCEC3 /* JSDOMRectReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMRectReadOnly.h;path = JSDOMRectReadOnly.h; sourceTree = "<group>"; };7331 0F4710B51DB56BE8002DCEC3 /* JSDOMRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRect.cpp; sourceTree = "<group>"; }; 7332 0F4710B61DB56BE8002DCEC3 /* JSDOMRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMRect.h; sourceTree = "<group>"; }; 7333 0F4710B71DB56BE8002DCEC3 /* JSDOMRectInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRectInit.cpp; sourceTree = "<group>"; }; 7334 0F4710B81DB56BE8002DCEC3 /* JSDOMRectInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMRectInit.h; sourceTree = "<group>"; }; 7335 0F4710B91DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRectReadOnly.cpp; sourceTree = "<group>"; }; 7336 0F4710BA1DB56BE8002DCEC3 /* JSDOMRectReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMRectReadOnly.h; sourceTree = "<group>"; }; 7336 7337 0F4966991DB408C100A274BB /* DOMPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMPoint.h; sourceTree = "<group>"; }; 7337 7338 0F49669A1DB408C100A274BB /* DOMPoint.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMPoint.idl; sourceTree = "<group>"; }; … … 14697 14698 5EA725CE1ACABCD900EAD17B /* MediaDevices.h */, 14698 14699 5EA725CF1ACABCD900EAD17B /* MediaDevices.idl */, 14699 14700 14700 07ABEF6B1D8A1C5800F21972 /* MediaDevicesEnumerationRequest.cpp */, 14701 07ABEF6D1D8A1C7600F21972 /* MediaDevicesEnumerationRequest.h */, 14701 14702 07394EC71BAB2CCD00BE99CD /* MediaDevicesRequest.cpp */, 14702 14703 07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */, … … 24215 24216 69A6CBAD1C6BE42C00B836E9 /* AccessibilitySVGElement.h in Headers */, 24216 24217 AAC08CF315F941FD00F1E188 /* AccessibilitySVGRoot.h in Headers */, 24218 465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */, 24217 24219 29A8122B0FBB9C1D00510293 /* AccessibilityTable.h in Headers */, 24218 24220 29A812320FBB9C1D00510293 /* AccessibilityTableCell.h in Headers */, … … 28162 28164 1AFFC4541D5E81CB00267A66 /* BlacklistUpdater.mm in Sources */, 28163 28165 976D6C78122B8A3D001FD1F7 /* Blob.cpp in Sources */, 28166 465307D11DB6EE4A00E4137C /* JSUIEventInit.cpp in Sources */, 28164 28167 2EDEF1F3121B0EFC00726DB2 /* BlobData.cpp in Sources */, 28165 28168 E1D31CDC19196020001005A3 /* BlobDataFileReference.cpp in Sources */, -
trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm
r207462 r207515 381 381 } 382 382 383 sub IsConstructorTemplate384 {385 my $object = shift;386 my $interface = shift;387 my $template = shift;388 389 return $interface->extendedAttributes->{"LegacyConstructorTemplate"} && $interface->extendedAttributes->{"LegacyConstructorTemplate"} eq $template;390 }391 392 383 sub IsNumericType 393 384 { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r207505 r207515 1273 1273 1274 1274 AddClassForwardIfNeeded("JSDOMWindowShell") if $interfaceName eq "DOMWindow"; 1275 AddClassForwardIfNeeded("JSDictionary") if $codeGenerator->IsConstructorTemplate($interface, "Event");1276 1275 1277 1276 my $exportMacro = GetExportMacroForJSClass($interface); … … 1724 1723 push(@headerContent, "// Custom constructor\n"); 1725 1724 push(@headerContent, "JSC::EncodedJSValue JSC_HOST_CALL construct${className}(JSC::ExecState&);\n\n"); 1726 }1727 1728 if ($codeGenerator->IsConstructorTemplate($interface, "Event")) {1729 push(@headerContent, "bool fill${interfaceName}Init(${interfaceName}Init&, JSDictionary&);\n\n");1730 1725 } 1731 1726 … … 5704 5699 5705 5700 if (IsConstructable($interface)) { 5706 if ($codeGenerator->IsConstructorTemplate($interface, "Event")) { 5707 $implIncludes{"JSDictionary.h"} = 1; 5708 $implIncludes{"<runtime/Error.h>"} = 1; 5709 5710 push(@$outputArray, <<END); 5711 template<> EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct(ExecState* state) 5712 { 5713 VM& vm = state->vm(); 5714 auto throwScope = DECLARE_THROW_SCOPE(vm); 5715 auto* jsConstructor = jsCast<${constructorClassName}*>(state->callee()); 5716 ASSERT(jsConstructor); 5717 5718 if (!jsConstructor->scriptExecutionContext()) 5719 return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, \"${visibleInterfaceName}\"); 5720 5721 if (UNLIKELY(state->argumentCount() < 1)) 5722 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5723 5724 AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state); 5725 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 5726 5727 ${interfaceName}Init eventInit; 5728 5729 JSValue initializerValue = state->argument(1); 5730 if (!initializerValue.isUndefinedOrNull()) { 5731 // Given the above test, this will always yield an object. 5732 JSObject* initializerObject = initializerValue.toObject(state); 5733 ASSERT(!throwScope.exception()); 5734 5735 // Create the dictionary wrapper from the initializer object. 5736 JSDictionary dictionary(state, initializerObject); 5737 5738 // Attempt to fill in the EventInit. 5739 if (!fill${interfaceName}Init(eventInit, dictionary)) 5740 return JSValue::encode(jsUndefined()); 5741 } 5742 5743 Ref<${interfaceName}> event = ${interfaceName}::createForBindings(eventType, eventInit); 5744 return JSValue::encode(createWrapper<${interfaceName}>(jsConstructor->globalObject(), WTFMove(event))); 5745 } 5746 5747 bool fill${interfaceName}Init(${interfaceName}Init& eventInit, JSDictionary& dictionary) 5748 { 5749 END 5750 5751 if ($interface->parent) { 5752 my $interfaceBase = $interface->parent; 5753 push(@implContent, <<END); 5754 if (!fill${interfaceBase}Init(eventInit, dictionary)) 5755 return false; 5756 5757 END 5758 } 5759 5760 for (my $index = 0; $index < @{$interface->attributes}; $index++) { 5761 my $attribute = @{$interface->attributes}[$index]; 5762 if ($attribute->signature->extendedAttributes->{LegacyInitializedByEventConstructor}) { 5763 my $attributeName = $attribute->signature->name; 5764 my $attributeImplName = $attribute->signature->extendedAttributes->{ImplementedAs} || $attributeName; 5765 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature); 5766 5767 push(@implContent, "#if ${conditionalString}\n") if $conditionalString; 5768 5769 push(@implContent, <<END); 5770 if (!dictionary.tryGetProperty("${attributeName}", eventInit.${attributeImplName})) 5771 return false; 5772 END 5773 push(@implContent, "#endif\n") if $conditionalString; 5774 5775 } 5776 } 5777 5778 push(@$outputArray, <<END); 5779 return true; 5780 } 5781 5782 END 5783 } elsif ($interface->extendedAttributes->{CustomConstructor}) { 5701 if ($interface->extendedAttributes->{CustomConstructor}) { 5784 5702 push(@$outputArray, "template<> JSC::EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct(JSC::ExecState* exec)\n"); 5785 5703 push(@$outputArray, "{\n"); … … 5905 5823 my $constructorClassName = $generatingNamedConstructor ? "${className}NamedConstructor" : "${className}Constructor"; 5906 5824 my $leastConstructorLength = 0; 5907 if ($codeGenerator->IsConstructorTemplate($interface, "Event")) { 5908 $leastConstructorLength = 1; 5909 } elsif ($interface->extendedAttributes->{Constructor} || $interface->extendedAttributes->{CustomConstructor}) { 5825 if ($interface->extendedAttributes->{Constructor} || $interface->extendedAttributes->{CustomConstructor}) { 5910 5826 my @constructors = @{$interface->constructors}; 5911 5827 my @customConstructors = @{$interface->customConstructors}; … … 6015 5931 || $interface->extendedAttributes->{Constructor} 6016 5932 || $interface->extendedAttributes->{NamedConstructor} 6017 || $interface->extendedAttributes->{LegacyConstructorTemplate}6018 5933 || $interface->extendedAttributes->{JSBuiltinConstructor}; 6019 5934 } -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r207355 r207515 93 93 JSGenerateToNativeObject 94 94 JSLegacyParent=* 95 LegacyConstructorTemplate=Event96 LegacyInitializedByEventConstructor97 95 LenientThis 98 96 MasqueradesAsUndefined -
trunk/Source/WebCore/dom/Event.h
r206964 r207515 88 88 } 89 89 90 static Ref<Event> create ForBindings(const AtomicString& type, const EventInit& initializer)91 { 92 return adoptRef(*new Event(type, initializer ));90 static Ref<Event> create(const AtomicString& type, const EventInit& initializer, IsTrusted isTrusted = IsTrusted::No) 91 { 92 return adoptRef(*new Event(type, initializer, isTrusted)); 93 93 } 94 94 … … 194 194 WEBCORE_EXPORT Event(const AtomicString& type, bool canBubble, bool cancelable); 195 195 Event(const AtomicString& type, bool canBubble, bool cancelable, double timestamp); 196 Event(const AtomicString& type, const EventInit&, IsTrusted = IsTrusted::No);196 Event(const AtomicString& type, const EventInit&, IsTrusted); 197 197 198 198 virtual void receivedTarget(); -
trunk/Source/WebCore/dom/Event.idl
r207302 r207515 20 20 21 21 [ 22 LegacyConstructorTemplate=Event,22 Constructor(DOMString type, optional EventInit eventInitDict), 23 23 CustomToJSObject, 24 24 ExportToWrappedFunction, … … 52 52 readonly attribute EventTarget currentTarget; 53 53 readonly attribute unsigned short eventPhase; 54 [LegacyInitializedByEventConstructor]readonly attribute boolean bubbles;55 [LegacyInitializedByEventConstructor]readonly attribute boolean cancelable;56 [ LegacyInitializedByEventConstructor,EnabledAtRuntime=ShadowDOM] readonly attribute boolean composed;54 readonly attribute boolean bubbles; 55 readonly attribute boolean cancelable; 56 [EnabledAtRuntime=ShadowDOM] readonly attribute boolean composed; 57 57 readonly attribute DOMTimeStamp timeStamp; 58 58 -
trunk/Source/WebCore/dom/UIEvent.h
r206971 r207515 43 43 return adoptRef(*new UIEvent); 44 44 } 45 static Ref<UIEvent> create ForBindings(const AtomicString& type, const UIEventInit& initializer)45 static Ref<UIEvent> create(const AtomicString& type, const UIEventInit& initializer, IsTrusted isTrusted = IsTrusted::No) 46 46 { 47 return adoptRef(*new UIEvent(type, initializer ));47 return adoptRef(*new UIEvent(type, initializer, isTrusted)); 48 48 } 49 49 virtual ~UIEvent(); … … 71 71 UIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail); 72 72 UIEvent(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow*, int detail); 73 UIEvent(const AtomicString&, const UIEventInit&, IsTrusted = IsTrusted::No);73 UIEvent(const AtomicString&, const UIEventInit&, IsTrusted); 74 74 75 75 private: -
trunk/Source/WebCore/dom/UIEvent.idl
r207302 r207515 19 19 20 20 [ 21 LegacyConstructorTemplate=Event,21 Constructor(DOMString type, optional UIEventInit eventInitDict) 22 22 ] interface UIEvent : Event { 23 [LegacyInitializedByEventConstructor]readonly attribute DOMWindow view;24 [LegacyInitializedByEventConstructor]readonly attribute long detail;23 readonly attribute DOMWindow view; 24 readonly attribute long detail; 25 25 26 26 // FIXME: Using "undefined" as default parameter value is wrong.
Note: See TracChangeset
for help on using the changeset viewer.