Changeset 256716 in webkit
- Timestamp:
- Feb 16, 2020, 5:41:27 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 deleted
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r256714 r256716 1 2020-02-16 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Implement EventTarget constructor 4 https://bugs.webkit.org/show_bug.cgi?id=174313 5 6 Reviewed by Darin Adler. 7 8 * fast/dom/dom-constructors-expected.txt: 9 * fast/dom/dom-constructors.html: 10 * platform/ios/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt: Removed. 11 1 12 2020-02-16 Wenson Hsieh <wenson_hsieh@apple.com> 2 13 -
trunk/LayoutTests/fast/dom/dom-constructors-expected.txt
r207767 r256716 9 9 PASS TryAllocate('DocumentType') is 'exception' 10 10 PASS TryAllocate('Element') is 'exception' 11 PASS TryAllocate('EventTarget') is 'exception'12 11 PASS TryAllocate('HTMLDocument') is 'exception' 13 12 PASS TryAllocate('Node') is 'exception' … … 132 131 PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]' 133 132 PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]' 133 PASS TryAllocate('EventTarget') is '[object EventTarget]' 134 PASS TryAllocate('EventTarget') is '[object EventTarget]' 135 PASS TryAllocate('EventTarget') is '[object EventTarget]' 134 136 PASS TryAllocate('Range') is '[object Range]' 135 137 PASS TryAllocate('Range') is '[object Range]' -
trunk/LayoutTests/fast/dom/dom-constructors.html
r207767 r256716 19 19 'DocumentType', 20 20 'Element', 21 'EventTarget',22 21 'HTMLDocument', 23 22 'Node', … … 133 132 'Document', 134 133 'DocumentFragment', 134 'EventTarget', 135 135 'Range', 136 136 'Text', -
trunk/LayoutTests/imported/w3c/ChangeLog
r256649 r256716 1 2020-02-16 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Implement EventTarget constructor 4 https://bugs.webkit.org/show_bug.cgi?id=174313 5 6 Reviewed by Darin Adler. 7 8 * web-platform-tests/WebIDL/ecmascript-binding/constructors-expected.txt: 9 * web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt: 10 * web-platform-tests/dom/events/EventTarget-constructible.any-expected.txt: 11 * web-platform-tests/dom/events/EventTarget-constructible.any.worker-expected.txt: 12 * web-platform-tests/dom/events/event-global-extra.window-expected.txt: 13 * web-platform-tests/dom/idlharness.any.worker-expected.txt: 14 * web-platform-tests/dom/idlharness.window-expected.txt: 15 1 16 2020-02-14 Rossana Monteriso <rmonteriso@igalia.com> 2 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/constructors-expected.txt
r253783 r256716 3 3 PASS Normal constructor in parent window 4 4 PASS Normal constructor in child window 5 FAIL Constructor in child window with normal NewTarget from parent window assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 6 FAIL Constructor in parent window with normal NewTarget from child window assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 7 FAIL Subclass constructor in parent window assert_equals: expected object "[object Object]" but got object "[object DOMParserPrototype]" 8 FAIL Subclass constructor in child window assert_equals: expected object "[object Object]" but got object "[object DOMParserPrototype]" 9 FAIL Subclass constructor in parent window with parent class in child window assert_equals: expected object "[object Object]" but got object "[object DOMParserPrototype]" 10 FAIL Subclass constructor in child window with parent class in parent window assert_equals: expected object "[object Object]" but got object "[object DOMParserPrototype]" 11 FAIL Constructor in child window with bad NewTarget from parent window assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 12 FAIL Constructor in parent window with bad NewTarget from child window assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 5 PASS Constructor in child window with normal NewTarget from parent window 6 PASS Constructor in parent window with normal NewTarget from child window 7 PASS Subclass constructor in parent window 8 PASS Subclass constructor in child window 9 PASS Subclass constructor in parent window with parent class in child window 10 PASS Subclass constructor in child window with parent class in parent window 11 PASS Constructor in child window with bad NewTarget from parent window 12 PASS Constructor in parent window with bad NewTarget from child window 13 13 FAIL Constructor in parent window with bad NewTarget from parent window that's a bound child window function assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 14 14 FAIL Constructor in child window with bad NewTarget from child window that's a bound parent window function assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt
r229544 r256716 42 42 PASS CompositionEvent constructor (argument with default values) 43 43 PASS CompositionEvent constructor (argument with non-default values) 44 FAIL SubclassedEvent constructor (no argument) assert_true: expected true got false 45 FAIL SubclassedEvent constructor (undefined argument) assert_true: expected true got false 46 FAIL SubclassedEvent constructor (null argument) assert_true: expected true got false 47 FAIL SubclassedEvent constructor (empty argument) assert_true: expected true got false 48 FAIL SubclassedEvent constructor (argument with default values) assert_true: expected true got false 49 FAIL SubclassedEvent constructor (argument with non-default values) assert_true: expected true got false 44 PASS SubclassedEvent constructor (no argument) 45 PASS SubclassedEvent constructor (undefined argument) 46 PASS SubclassedEvent constructor (null argument) 47 PASS SubclassedEvent constructor (empty argument) 48 PASS SubclassedEvent constructor (argument with default values) 49 PASS SubclassedEvent constructor (argument with non-default values) 50 50 PASS UIEvent constructor (view argument with wrong type) 51 51 -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventTarget-constructible.any-expected.txt
r220772 r256716 1 1 2 FAIL A constructed EventTarget can be used as expected function is not a constructor (evaluating 'new EventTarget()') 3 FAIL EventTarget can be subclassed function is not a constructor (evaluating 'super(...args)') 2 PASS A constructed EventTarget can be used as expected 3 PASS EventTarget can be subclassed 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventTarget-constructible.any.worker-expected.txt
r220772 r256716 1 1 2 FAIL A constructed EventTarget can be used as expected function is not a constructor (evaluating 'new EventTarget()') 3 FAIL EventTarget can be subclassed function is not a constructor (evaluating 'super(...args)') 2 PASS A constructed EventTarget can be used as expected 3 PASS EventTarget can be subclassed 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/event-global-extra.window-expected.txt
r248647 r256716 1 1 2 FAIL window.event for constructors from another global: EventTarget function is not a constructor (evaluating 'new otherWindow[constructorName]()')2 FAIL window.event for constructors from another global: EventTarget assert_equals: expected (undefined) undefined but got (object) object "[object Event]" 3 3 FAIL window.event for constructors from another global: XMLHttpRequest assert_equals: expected (undefined) undefined but got (object) object "[object Event]" 4 4 PASS window.event and element from another document -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/idlharness.any.worker-expected.txt
r253630 r256716 134 134 PASS EventTarget interface: operation removeEventListener(DOMString, EventListener, [object Object],[object Object]) 135 135 PASS EventTarget interface: operation dispatchEvent(Event) 136 FAIL EventTarget must be primary interface of new EventTarget() assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 137 FAIL Stringification of new EventTarget() assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 138 FAIL EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 139 FAIL EventTarget interface: calling addEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 140 FAIL EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 141 FAIL EventTarget interface: calling removeEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 142 FAIL EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 143 FAIL EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 136 PASS EventTarget must be primary interface of new EventTarget() 137 PASS Stringification of new EventTarget() 138 PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type 139 PASS EventTarget interface: calling addEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError 140 PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type 141 PASS EventTarget interface: calling removeEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError 142 PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type 143 PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError 144 144 PASS EventListener interface: existence and properties of interface object 145 145 PASS AbortController interface: existence and properties of interface object -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/idlharness.window-expected.txt
r254182 r256716 159 159 PASS EventTarget interface: operation removeEventListener(DOMString, EventListener, [object Object],[object Object]) 160 160 PASS EventTarget interface: operation dispatchEvent(Event) 161 FAIL EventTarget must be primary interface of new EventTarget() assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 162 FAIL Stringification of new EventTarget() assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 163 FAIL EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 164 FAIL EventTarget interface: calling addEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 165 FAIL EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 166 FAIL EventTarget interface: calling removeEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 167 FAIL EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 168 FAIL EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new EventTarget()')" 161 PASS EventTarget must be primary interface of new EventTarget() 162 PASS Stringification of new EventTarget() 163 PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type 164 PASS EventTarget interface: calling addEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError 165 PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type 166 PASS EventTarget interface: calling removeEventListener(DOMString, EventListener, [object Object],[object Object]) on new EventTarget() with too few arguments must throw TypeError 167 PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type 168 PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError 169 169 PASS EventListener interface: existence and properties of interface object 170 170 PASS EventListener interface: existence and properties of interface prototype object -
trunk/Source/WebCore/ChangeLog
r256715 r256716 1 2020-02-16 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Implement EventTarget constructor 4 https://bugs.webkit.org/show_bug.cgi?id=174313 5 6 Reviewed by Darin Adler. 7 8 Currently, EventTarget can't be directly constructed or be subclassed in JavaScript. 9 The spec for EventTarget was updated (https://github.com/whatwg/dom/pull/467) to allow 10 constructing and subclassing EventTarget. This feature was shipped in Chrome 64 and Firefox 59. 11 12 This patch introduces EventTargetConcrete class, a user-constructable version of EventTarget, 13 exposed as "EventTarget" to JavaScript. We don't use EventTarget directly because it is an abstract 14 class and making it non-abstract is unfavorable due to size increase of EventTarget and all of its 15 subclasses with code that is mostly unnecessary for them, resulting in a performance decrease. 16 17 To prevent definition of specific to EventTargetConcrete `toJS` and `toJSNewlyCreated` functions, 18 we don't define EventTargetConcrete interface type, but rather tweak make_event_factory.pl to 19 default to base interface (like it does for Event). 20 21 To allow subclassing of all DOM constructors, non-custom ones replace structures of newly created 22 wrapper objects with ones returned by InternalFunction::createSubclassStructure. Per WebIDL spec [1], 23 `setSubclassStructureIfNeeded` helper uses realm of `newTarget` for default prototypes. 24 25 This approach was chosen because a) detecting [[Construct]] with callFrame->newTarget() is 26 unreliable outside constructor, and b) passing `newTarget` down to `createWrapper` via 27 `toJSNewlyCreated` is quite awkward and would result in massive code change. 28 29 [1] https://heycam.github.io/webidl/#internally-create-a-new-object-implementing-the-interface 30 (step 3.3.2) 31 32 Tests: fast/dom/dom-constructors.html 33 imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/constructors.html 34 imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors.html 35 imported/w3c/web-platform-tests/dom/events/EventTarget-constructible.any.html 36 imported/w3c/web-platform-tests/dom/idlharness.window.html 37 38 * Headers.cmake: 39 * Sources.txt: 40 * WebCore.xcodeproj/project.pbxproj: 41 * bindings/js/JSDOMWrapperCache.h: 42 (WebCore::setSubclassStructureIfNeeded): 43 * bindings/js/JSEventTargetCustom.cpp: 44 (WebCore::toJSNewlyCreated): 45 * bindings/scripts/CodeGeneratorJS.pm: 46 (GenerateConstructorDefinition): 47 * bindings/scripts/InFilesCompiler.pm: 48 (generateInterfacesHeader): 49 * bindings/scripts/test/JS/*: Adjust bindings expectations. 50 * dom/EventTarget.cpp: 51 (WebCore::EventTarget::create): 52 * dom/EventTarget.h: 53 * dom/EventTarget.idl: 54 * dom/EventTargetConcrete.cpp: Added. 55 * dom/EventTargetConcrete.h: Added. 56 * dom/make_event_factory.pl: 57 (generateImplementation): 58 1 59 2020-02-16 Brady Eidson <beidson@apple.com> 2 60 -
trunk/Source/WebCore/Headers.cmake
r256621 r256716 404 404 dom/EventQueue.h 405 405 dom/EventTarget.h 406 dom/EventTargetConcrete.h 406 407 dom/Exception.h 407 408 dom/ExceptionCode.h -
trunk/Source/WebCore/Sources.txt
r256658 r256716 883 883 dom/EventPath.cpp 884 884 dom/EventTarget.cpp 885 dom/EventTargetConcrete.cpp 885 886 dom/ExceptionData.cpp 886 887 dom/ExtensionStyleSheets.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r256658 r256716 2519 2519 84A81F3E0FC7DFF000955300 /* SourceAlpha.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F3C0FC7DFF000955300 /* SourceAlpha.h */; }; 2520 2520 84A81F420FC7E02700955300 /* SourceGraphic.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F400FC7E02700955300 /* SourceGraphic.h */; }; 2521 84B349A222F86E7500D47BCF /* EventTargetConcrete.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B349A022F86E7400D47BCF /* EventTargetConcrete.h */; }; 2521 2522 84B6B978120F13E500B8EFAF /* SVGPathSegListSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */; }; 2522 2523 84C5B2FB1216DC810088B53A /* SVGPathTraversalStateBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84C5B2F91216DC810088B53A /* SVGPathTraversalStateBuilder.h */; }; … … 10397 10398 84A81F400FC7E02700955300 /* SourceGraphic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceGraphic.h; sourceTree = "<group>"; }; 10398 10399 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SSLKeyGeneratorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 10400 84B349A022F86E7400D47BCF /* EventTargetConcrete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTargetConcrete.h; sourceTree = "<group>"; }; 10401 84B349A322F86E8200D47BCF /* EventTargetConcrete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTargetConcrete.cpp; sourceTree = "<group>"; }; 10399 10402 84B62684133138F90095A489 /* FontPlatformData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontPlatformData.cpp; sourceTree = "<group>"; }; 10400 10403 84B6B975120F13E500B8EFAF /* SVGPathSegListSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegListSource.cpp; sourceTree = "<group>"; }; … … 28133 28136 E12EDB7A0B308A78002704B6 /* EventTarget.h */, 28134 28137 85AFA7420AAF298400E84305 /* EventTarget.idl */, 28138 84B349A322F86E8200D47BCF /* EventTargetConcrete.cpp */, 28139 84B349A022F86E7400D47BCF /* EventTargetConcrete.h */, 28135 28140 CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */, 28136 28141 93D196321D6CAB8200FC7E47 /* Exception.h */, … … 29794 29799 E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */, 29795 29800 E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */, 29801 84B349A222F86E7500D47BCF /* EventTargetConcrete.h in Headers */, 29796 29802 97AA3CA5145237CC003E1DA6 /* EventTargetHeaders.h in Headers */, 29797 29803 97AA3CA6145237CC003E1DA6 /* EventTargetInterfaces.h in Headers */, -
trunk/Source/WebCore/bindings/js/JSDOMWrapperCache.h
r251425 r256716 202 202 } 203 203 204 template<typename DOMClass> inline void setSubclassStructureIfNeeded(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, JSC::JSObject* jsObject) 205 { 206 JSC::JSObject* newTarget = callFrame->newTarget().getObject(); 207 JSC::JSObject* constructor = callFrame->jsCallee(); 208 if (!newTarget || newTarget == constructor) 209 return; 210 211 using WrapperClass = typename JSDOMWrapperConverterTraits<DOMClass>::WrapperClass; 212 213 JSC::VM& vm = lexicalGlobalObject->vm(); 214 auto scope = DECLARE_THROW_SCOPE(vm); 215 216 auto* newTargetGlobalObject = JSC::jsCast<JSDOMGlobalObject*>(newTarget->globalObject(vm)); 217 auto* baseStructure = getDOMStructure<WrapperClass>(vm, *newTargetGlobalObject); 218 auto* subclassStructure = JSC::InternalFunction::createSubclassStructure(lexicalGlobalObject, constructor, newTarget, baseStructure); 219 RETURN_IF_EXCEPTION(scope, void()); 220 jsObject->setStructure(vm, subclassStructure); 221 } 222 204 223 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp
r251630 r256716 44 44 using namespace JSC; 45 45 46 JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<EventTarget>&& value) 47 { 48 return createWrapper<EventTarget>(globalObject, WTFMove(value)); 49 } 50 46 51 EventTarget* JSEventTarget::toWrapped(VM& vm, JSValue value) 47 52 { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r255365 r256716 7334 7334 push(@$outputArray, " VM& vm = lexicalGlobalObject->vm();\n"); 7335 7335 push(@$outputArray, " auto throwScope = DECLARE_THROW_SCOPE(vm);\n"); 7336 push(@$outputArray, " UNUSED_PARAM(throwScope);\n");7337 7336 push(@$outputArray, " auto* castedThis = jsCast<${constructorClassName}*>(callFrame->jsCallee());\n"); 7338 7337 push(@$outputArray, " ASSERT(castedThis);\n"); … … 7355 7354 7356 7355 my $IDLType = GetIDLType($interface, $interface->type); 7356 my $implType = GetImplClassName($interface); 7357 7357 7358 7358 AddToImplIncludes("JSDOMConvertInterface.h"); … … 7364 7364 push(@constructionConversionArguments, "WTFMove(object)"); 7365 7365 7366 push(@$outputArray, " return JSValue::encode(toJSNewlyCreated<${IDLType}>(" . join(", ", @constructionConversionArguments) . "));\n"); 7366 # FIXME: toJSNewlyCreated should return JSObject* instead of JSValue. 7367 push(@$outputArray, " auto jsValue = toJSNewlyCreated<${IDLType}>(" . join(", ", @constructionConversionArguments) . ");\n"); 7368 push(@$outputArray, " RETURN_IF_EXCEPTION(throwScope, { });\n") if $interface->extendedAttributes->{ConstructorMayThrowException}; 7369 push(@$outputArray, " setSubclassStructureIfNeeded<${implType}>(lexicalGlobalObject, callFrame, asObject(jsValue));\n"); 7370 push(@$outputArray, " RETURN_IF_EXCEPTION(throwScope, { });\n"); 7371 push(@$outputArray, " return JSValue::encode(jsValue);\n"); 7367 7372 push(@$outputArray, "}\n\n"); 7368 7373 } -
trunk/Source/WebCore/bindings/scripts/InFilesCompiler.pm
r233443 r256716 244 244 } 245 245 246 if ($namespace eq "EventTarget") { 247 print F " ${suffix} = $count,\n"; 248 $count++; 249 } 250 246 251 for my $interface (sort keys %unconditionalInterfaces) { 247 252 print F " ${interface}${suffix} = $count,\n"; -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
r255126 r256716 160 160 VM& vm = lexicalGlobalObject->vm(); 161 161 auto throwScope = DECLARE_THROW_SCOPE(vm); 162 UNUSED_PARAM(throwScope);163 162 auto* castedThis = jsCast<JSTestEventConstructorConstructor*>(callFrame->jsCallee()); 164 163 ASSERT(castedThis); … … 170 169 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 171 170 auto object = TestEventConstructor::create(WTFMove(type), WTFMove(eventInitDict)); 172 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestEventConstructor>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 171 auto jsValue = toJSNewlyCreated<IDLInterface<TestEventConstructor>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 172 setSubclassStructureIfNeeded<TestEventConstructor>(lexicalGlobalObject, callFrame, asObject(jsValue)); 173 RETURN_IF_EXCEPTION(throwScope, { }); 174 return JSValue::encode(jsValue); 173 175 } 174 176 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r254252 r256716 259 259 VM& vm = lexicalGlobalObject->vm(); 260 260 auto throwScope = DECLARE_THROW_SCOPE(vm); 261 UNUSED_PARAM(throwScope);262 261 auto* castedThis = jsCast<JSTestInterfaceConstructor*>(callFrame->jsCallee()); 263 262 ASSERT(castedThis); … … 272 271 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 273 272 auto object = TestInterface::create(*context, WTFMove(str1), WTFMove(str2)); 274 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestInterface>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object))); 273 auto jsValue = toJSNewlyCreated<IDLInterface<TestInterface>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); 274 RETURN_IF_EXCEPTION(throwScope, { }); 275 setSubclassStructureIfNeeded<TestInterface>(lexicalGlobalObject, callFrame, asObject(jsValue)); 276 RETURN_IF_EXCEPTION(throwScope, { }); 277 return JSValue::encode(jsValue); 275 278 } 276 279 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp
r255126 r256716 95 95 VM& vm = lexicalGlobalObject->vm(); 96 96 auto throwScope = DECLARE_THROW_SCOPE(vm); 97 UNUSED_PARAM(throwScope);98 97 auto* castedThis = jsCast<JSTestNamedConstructorNamedConstructor*>(callFrame->jsCallee()); 99 98 ASSERT(castedThis); … … 107 106 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 108 107 auto object = TestNamedConstructor::createForJSConstructor(WTFMove(str1), WTFMove(str2), WTFMove(str3)); 109 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestNamedConstructor>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object))); 108 auto jsValue = toJSNewlyCreated<IDLInterface<TestNamedConstructor>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); 109 RETURN_IF_EXCEPTION(throwScope, { }); 110 setSubclassStructureIfNeeded<TestNamedConstructor>(lexicalGlobalObject, callFrame, asObject(jsValue)); 111 RETURN_IF_EXCEPTION(throwScope, { }); 112 return JSValue::encode(jsValue); 110 113 } 111 114 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
r255126 r256716 103 103 VM& vm = lexicalGlobalObject->vm(); 104 104 auto throwScope = DECLARE_THROW_SCOPE(vm); 105 UNUSED_PARAM(throwScope);106 105 auto* castedThis = jsCast<JSTestNodeConstructor*>(callFrame->jsCallee()); 107 106 ASSERT(castedThis); 108 107 auto object = TestNode::create(); 109 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestNode>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 108 auto jsValue = toJSNewlyCreated<IDLInterface<TestNode>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 109 setSubclassStructureIfNeeded<TestNode>(lexicalGlobalObject, callFrame, asObject(jsValue)); 110 RETURN_IF_EXCEPTION(throwScope, { }); 111 return JSValue::encode(jsValue); 110 112 } 111 113 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r255224 r256716 1949 1949 VM& vm = lexicalGlobalObject->vm(); 1950 1950 auto throwScope = DECLARE_THROW_SCOPE(vm); 1951 UNUSED_PARAM(throwScope);1952 1951 auto* castedThis = jsCast<JSTestObjConstructor*>(callFrame->jsCallee()); 1953 1952 ASSERT(castedThis); … … 1964 1963 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 1965 1964 auto object = TestObj::create(document, testCallback.releaseNonNull(), testCallbackFunction.releaseNonNull()); 1966 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestObj>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 1965 auto jsValue = toJSNewlyCreated<IDLInterface<TestObj>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 1966 setSubclassStructureIfNeeded<TestObj>(lexicalGlobalObject, callFrame, asObject(jsValue)); 1967 RETURN_IF_EXCEPTION(throwScope, { }); 1968 return JSValue::encode(jsValue); 1967 1969 } 1968 1970 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
r255126 r256716 82 82 VM& vm = lexicalGlobalObject->vm(); 83 83 auto throwScope = DECLARE_THROW_SCOPE(vm); 84 UNUSED_PARAM(throwScope);85 84 auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(callFrame->jsCallee()); 86 85 ASSERT(castedThis); … … 88 87 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 89 88 auto object = TestOverloadedConstructors::create(*arrayBuffer); 90 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 89 auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 90 setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue)); 91 RETURN_IF_EXCEPTION(throwScope, { }); 92 return JSValue::encode(jsValue); 91 93 } 92 94 … … 95 97 VM& vm = lexicalGlobalObject->vm(); 96 98 auto throwScope = DECLARE_THROW_SCOPE(vm); 97 UNUSED_PARAM(throwScope);98 99 auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(callFrame->jsCallee()); 99 100 ASSERT(castedThis); … … 101 102 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 102 103 auto object = TestOverloadedConstructors::create(arrayBufferView.releaseNonNull()); 103 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 104 auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 105 setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue)); 106 RETURN_IF_EXCEPTION(throwScope, { }); 107 return JSValue::encode(jsValue); 104 108 } 105 109 … … 108 112 VM& vm = lexicalGlobalObject->vm(); 109 113 auto throwScope = DECLARE_THROW_SCOPE(vm); 110 UNUSED_PARAM(throwScope);111 114 auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(callFrame->jsCallee()); 112 115 ASSERT(castedThis); … … 114 117 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 115 118 auto object = TestOverloadedConstructors::create(*blob); 116 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 119 auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 120 setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue)); 121 RETURN_IF_EXCEPTION(throwScope, { }); 122 return JSValue::encode(jsValue); 117 123 } 118 124 … … 121 127 VM& vm = lexicalGlobalObject->vm(); 122 128 auto throwScope = DECLARE_THROW_SCOPE(vm); 123 UNUSED_PARAM(throwScope);124 129 auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(callFrame->jsCallee()); 125 130 ASSERT(castedThis); … … 127 132 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 128 133 auto object = TestOverloadedConstructors::create(WTFMove(string)); 129 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 134 auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 135 setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue)); 136 RETURN_IF_EXCEPTION(throwScope, { }); 137 return JSValue::encode(jsValue); 130 138 } 131 139 … … 134 142 VM& vm = lexicalGlobalObject->vm(); 135 143 auto throwScope = DECLARE_THROW_SCOPE(vm); 136 UNUSED_PARAM(throwScope);137 144 auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(callFrame->jsCallee()); 138 145 ASSERT(castedThis); … … 140 147 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 141 148 auto object = TestOverloadedConstructors::create(WTFMove(longArgs)); 142 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 149 auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 150 setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue)); 151 RETURN_IF_EXCEPTION(throwScope, { }); 152 return JSValue::encode(jsValue); 143 153 } 144 154 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp
r255126 r256716 81 81 VM& vm = lexicalGlobalObject->vm(); 82 82 auto throwScope = DECLARE_THROW_SCOPE(vm); 83 UNUSED_PARAM(throwScope);84 83 auto* castedThis = jsCast<JSTestOverloadedConstructorsWithSequenceConstructor*>(callFrame->jsCallee()); 85 84 ASSERT(castedThis); … … 87 86 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 88 87 auto object = TestOverloadedConstructorsWithSequence::create(WTFMove(sequenceOfStrings)); 89 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 88 auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 89 setSubclassStructureIfNeeded<TestOverloadedConstructorsWithSequence>(lexicalGlobalObject, callFrame, asObject(jsValue)); 90 RETURN_IF_EXCEPTION(throwScope, { }); 91 return JSValue::encode(jsValue); 90 92 } 91 93 … … 94 96 VM& vm = lexicalGlobalObject->vm(); 95 97 auto throwScope = DECLARE_THROW_SCOPE(vm); 96 UNUSED_PARAM(throwScope);97 98 auto* castedThis = jsCast<JSTestOverloadedConstructorsWithSequenceConstructor*>(callFrame->jsCallee()); 98 99 ASSERT(castedThis); … … 100 101 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 101 102 auto object = TestOverloadedConstructorsWithSequence::create(WTFMove(string)); 102 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 103 auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 104 setSubclassStructureIfNeeded<TestOverloadedConstructorsWithSequence>(lexicalGlobalObject, callFrame, asObject(jsValue)); 105 RETURN_IF_EXCEPTION(throwScope, { }); 106 return JSValue::encode(jsValue); 103 107 } 104 108 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp
r255126 r256716 161 161 VM& vm = lexicalGlobalObject->vm(); 162 162 auto throwScope = DECLARE_THROW_SCOPE(vm); 163 UNUSED_PARAM(throwScope);164 163 auto* castedThis = jsCast<JSTestPromiseRejectionEventConstructor*>(callFrame->jsCallee()); 165 164 ASSERT(castedThis); … … 171 170 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 172 171 auto object = TestPromiseRejectionEvent::create(*castedThis->globalObject(), WTFMove(type), WTFMove(eventInitDict)); 173 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestPromiseRejectionEvent>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 172 auto jsValue = toJSNewlyCreated<IDLInterface<TestPromiseRejectionEvent>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 173 setSubclassStructureIfNeeded<TestPromiseRejectionEvent>(lexicalGlobalObject, callFrame, asObject(jsValue)); 174 RETURN_IF_EXCEPTION(throwScope, { }); 175 return JSValue::encode(jsValue); 174 176 } 175 177 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
r255126 r256716 149 149 VM& vm = lexicalGlobalObject->vm(); 150 150 auto throwScope = DECLARE_THROW_SCOPE(vm); 151 UNUSED_PARAM(throwScope);152 151 auto* castedThis = jsCast<JSTestTypedefsConstructor*>(callFrame->jsCallee()); 153 152 ASSERT(castedThis); … … 161 160 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 162 161 auto object = TestTypedefs::create(WTFMove(hello), testCallbackFunction.releaseNonNull(), testCallbackInterface.releaseNonNull()); 163 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestTypedefs>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object))); 162 auto jsValue = toJSNewlyCreated<IDLInterface<TestTypedefs>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object)); 163 setSubclassStructureIfNeeded<TestTypedefs>(lexicalGlobalObject, callFrame, asObject(jsValue)); 164 RETURN_IF_EXCEPTION(throwScope, { }); 165 return JSValue::encode(jsValue); 164 166 } 165 167 -
trunk/Source/WebCore/dom/EventTarget.cpp
r255499 r256716 35 35 #include "DOMWrapperWorld.h" 36 36 #include "EventNames.h" 37 #include "EventTargetConcrete.h" 37 38 #include "HTMLBodyElement.h" 38 39 #include "HTMLHtmlElement.h" … … 59 60 WTF_MAKE_ISO_ALLOCATED_IMPL(EventTargetWithInlineData); 60 61 62 Ref<EventTarget> EventTarget::create(ScriptExecutionContext& context) 63 { 64 return EventTargetConcrete::create(context); 65 } 66 61 67 bool EventTarget::isNode() const 62 68 { -
trunk/Source/WebCore/dom/EventTarget.h
r247860 r256716 55 55 WTF_MAKE_ISO_ALLOCATED(EventTarget); 56 56 public: 57 static Ref<EventTarget> create(ScriptExecutionContext&); 58 57 59 void ref() { refEventTarget(); } 58 60 void deref() { derefEventTarget(); } -
trunk/Source/WebCore/dom/EventTarget.idl
r246490 r256716 20 20 21 21 [ 22 Constructor, 23 ConstructorCallWith=ScriptExecutionContext, 22 24 CustomToJSObject, 23 25 Exposed=(Window,Worker), -
trunk/Source/WebCore/dom/make_event_factory.pl
r251425 r256716 105 105 print F "{\n"; 106 106 print F " switch (impl.${interfaceMethodName}()) {\n"; 107 print F " case EventTargetInterfaceType:\n"; 108 print F " break;\n"; 107 109 } 108 110 … … 140 142 print F " return createWrapper<$namespace>(globalObject, WTFMove(impl));\n"; 141 143 } else { 142 print F " ASSERT_NOT_REACHED();\n"; 143 print F " return JSC::jsNull();\n"; 144 print F " return wrap(state, globalObject, impl);\n"; 144 145 } 145 146 print F "}\n";
Note:
See TracChangeset
for help on using the changeset viewer.