Changeset 207238 in webkit
- Timestamp:
- Oct 12, 2016 1:41:49 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207229 r207238 1 2016-10-12 Chris Dumez <cdumez@apple.com> 2 3 Update more events to stop using legacy [ConstructorTemplate=Event] 4 https://bugs.webkit.org/show_bug.cgi?id=163339 5 6 Reviewed by Ryosuke Niwa. 7 8 Update existing tests to reflect minor behavior changes. 9 10 * fast/events/constructors/storage-event-constructor-expected.txt: 11 * fast/events/constructors/storage-event-constructor.html: 12 * fast/events/constructors/webgl-context-event-constructor-expected.txt: 13 * fast/events/constructors/webgl-context-event-constructor.html: 14 1 15 2016-10-12 Joseph Pecoraro <pecoraro@apple.com> 2 16 -
trunk/LayoutTests/fast/events/constructors/storage-event-constructor-expected.txt
r155401 r207238 6 6 PASS new StorageEvent('eventType').bubbles is false 7 7 PASS new StorageEvent('eventType').cancelable is false 8 PASS new StorageEvent('eventType').key is ""8 PASS new StorageEvent('eventType').key is null 9 9 PASS new StorageEvent('eventType').oldValue is null 10 10 PASS new StorageEvent('eventType').newValue is null … … 17 17 PASS new StorageEvent('eventType', { key: 'abcde' }).key is "abcde" 18 18 PASS new StorageEvent('eventType', { key: '' }).key is "" 19 PASS new StorageEvent('eventType', { key: undefined }).key is "undefined"20 PASS new StorageEvent('eventType', { key: null }).key is "null"19 PASS new StorageEvent('eventType', { key: undefined }).key is null 20 PASS new StorageEvent('eventType', { key: null }).key is null 21 21 PASS new StorageEvent('eventType', { key: false }).key is "false" 22 22 PASS new StorageEvent('eventType', { key: true }).key is "true" … … 30 30 PASS new StorageEvent('eventType', { oldValue: 'abcde' }).oldValue is "abcde" 31 31 PASS new StorageEvent('eventType', { oldValue: '' }).oldValue is "" 32 PASS new StorageEvent('eventType', { oldValue: undefined }).oldValue is "undefined"33 PASS new StorageEvent('eventType', { oldValue: null }).oldValue is "null"32 PASS new StorageEvent('eventType', { oldValue: undefined }).oldValue is null 33 PASS new StorageEvent('eventType', { oldValue: null }).oldValue is null 34 34 PASS new StorageEvent('eventType', { oldValue: false }).oldValue is "false" 35 35 PASS new StorageEvent('eventType', { oldValue: true }).oldValue is "true" … … 43 43 PASS new StorageEvent('eventType', { newValue: 'abcde' }).newValue is "abcde" 44 44 PASS new StorageEvent('eventType', { newValue: '' }).newValue is "" 45 PASS new StorageEvent('eventType', { newValue: undefined }).newValue is "undefined"46 PASS new StorageEvent('eventType', { newValue: null }).newValue is "null"45 PASS new StorageEvent('eventType', { newValue: undefined }).newValue is null 46 PASS new StorageEvent('eventType', { newValue: null }).newValue is null 47 47 PASS new StorageEvent('eventType', { newValue: false }).newValue is "false" 48 48 PASS new StorageEvent('eventType', { newValue: true }).newValue is "true" … … 56 56 PASS new StorageEvent('eventType', { url: 'abcde' }).url is "abcde" 57 57 PASS new StorageEvent('eventType', { url: '' }).url is "" 58 PASS new StorageEvent('eventType', { url: undefined }).url is " undefined"58 PASS new StorageEvent('eventType', { url: undefined }).url is "" 59 59 PASS new StorageEvent('eventType', { url: null }).url is "null" 60 60 PASS new StorageEvent('eventType', { url: false }).url is "false" … … 69 69 PASS new StorageEvent('eventType', { storageArea: localStorage }).storageArea is localStorage 70 70 PASS new StorageEvent('eventType', { storageArea: sessionStorage }).storageArea is sessionStorage 71 PASS new StorageEvent('eventType', { storageArea: test_object }) .storageArea is null72 PASS new StorageEvent('eventType', { storageArea: window }) .storageArea is null73 PASS new StorageEvent('eventType', { storageArea: document }) .storageArea is null71 PASS new StorageEvent('eventType', { storageArea: test_object }) threw exception TypeError: Type error. 72 PASS new StorageEvent('eventType', { storageArea: window }) threw exception TypeError: Type error. 73 PASS new StorageEvent('eventType', { storageArea: document }) threw exception TypeError: Type error. 74 74 PASS new StorageEvent('eventType', { storageArea: undefined }).storageArea is null 75 75 PASS new StorageEvent('eventType', { storageArea: null }).storageArea is null 76 PASS new StorageEvent('eventType', { storageArea: false }) .storageArea is null77 PASS new StorageEvent('eventType', { storageArea: true }) .storageArea is null78 PASS new StorageEvent('eventType', { storageArea: '' }) .storageArea is null79 PASS new StorageEvent('eventType', { storageArea: 'chocolate' }) .storageArea is null80 PASS new StorageEvent('eventType', { storageArea: 12345 }) .storageArea is null81 PASS new StorageEvent('eventType', { storageArea: 18446744073709551615 }) .storageArea is null82 PASS new StorageEvent('eventType', { storageArea: NaN }) .storageArea is null83 PASS new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } }) .storageArea == window is false84 PASS new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea is null76 PASS new StorageEvent('eventType', { storageArea: false }) threw exception TypeError: Type error. 77 PASS new StorageEvent('eventType', { storageArea: true }) threw exception TypeError: Type error. 78 PASS new StorageEvent('eventType', { storageArea: '' }) threw exception TypeError: Type error. 79 PASS new StorageEvent('eventType', { storageArea: 'chocolate' }) threw exception TypeError: Type error. 80 PASS new StorageEvent('eventType', { storageArea: 12345 }) threw exception TypeError: Type error. 81 PASS new StorageEvent('eventType', { storageArea: 18446744073709551615 }) threw exception TypeError: Type error. 82 PASS new StorageEvent('eventType', { storageArea: NaN }) threw exception TypeError: Type error. 83 PASS new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } }) threw exception TypeError: Type error. 84 PASS new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea threw exception TypeError: Type error. 85 85 PASS new StorageEvent('eventType', { get storageArea() { throw 'StorageEvent Error'; } }) threw exception StorageEvent Error. 86 86 PASS new StorageEvent('eventType', { bubbles: true, cancelable: false, key: 'abc', oldValue: 'def', newValue: 'ghi', url: 'jkl', storageArea: localStorage }).bubbles is true -
trunk/LayoutTests/fast/events/constructors/storage-event-constructor.html
r155401 r207238 14 14 shouldBe("new StorageEvent('eventType').bubbles", "false"); 15 15 shouldBe("new StorageEvent('eventType').cancelable", "false"); 16 shouldBe EqualToString("new StorageEvent('eventType').key", "");16 shouldBe("new StorageEvent('eventType').key", "null"); 17 17 // Note: oldValue is nullable. 18 18 shouldBe("new StorageEvent('eventType').oldValue", "null"); … … 37 37 38 38 // Non-strings. 39 shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": undefined })." + attr, "undefined"); 40 shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": null })." + attr, "null"); 39 if (attr == "key" || attr == "oldValue" || attr == "newValue") { 40 // Those members are nullable. 41 shouldBe("new StorageEvent('eventType', { " + attr + ": undefined })." + attr, "null"); 42 shouldBe("new StorageEvent('eventType', { " + attr + ": null })." + attr, "null"); 43 } else { 44 shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": undefined })." + attr, ""); 45 shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": null })." + attr, "null"); 46 } 41 47 shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": false })." + attr, "false"); 42 48 shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": true })." + attr, "true"); … … 57 63 // Non-Storage objects. 58 64 var test_object = {abc: 123}; 59 should Be("new StorageEvent('eventType', { storageArea: test_object }).storageArea", "null");60 should Be("new StorageEvent('eventType', { storageArea: window }).storageArea", "null");61 should Be("new StorageEvent('eventType', { storageArea: document }).storageArea", "null");65 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: test_object })", "TypeError"); 66 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: window })", "TypeError"); 67 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: document })", "TypeError"); 62 68 shouldBe("new StorageEvent('eventType', { storageArea: undefined }).storageArea", "null"); 63 69 shouldBe("new StorageEvent('eventType', { storageArea: null }).storageArea", "null"); 64 should Be("new StorageEvent('eventType', { storageArea: false }).storageArea", "null");65 should Be("new StorageEvent('eventType', { storageArea: true }).storageArea", "null");66 should Be("new StorageEvent('eventType', { storageArea: '' }).storageArea", "null");67 should Be("new StorageEvent('eventType', { storageArea: 'chocolate' }).storageArea", "null");68 should Be("new StorageEvent('eventType', { storageArea: 12345 }).storageArea", "null");69 should Be("new StorageEvent('eventType', { storageArea: 18446744073709551615 }).storageArea", "null");70 should Be("new StorageEvent('eventType', { storageArea: NaN }).storageArea", "null");70 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: false })", "TypeError"); 71 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: true })", "TypeError"); 72 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: '' })", "TypeError"); 73 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: 'chocolate' })", "TypeError"); 74 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: 12345 })", "TypeError"); 75 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: 18446744073709551615 })", "TypeError"); 76 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: NaN })", "TypeError"); 71 77 // Note that valueOf() is not called, when the left hand side is evaluated. 72 should BeFalse("new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } }).storageArea == window");73 should Be("new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea", "null");78 shouldThrowErrorName("new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } })", "TypeError"); 79 shouldThrowErrorName("new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea", "TypeError"); 74 80 shouldThrow("new StorageEvent('eventType', { get storageArea() { throw 'StorageEvent Error'; } })"); 75 81 -
trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor-expected.txt
r101183 r207238 13 13 PASS new WebGLContextEvent('eventType', { statusMessage: 'abcde' }).statusMessage is "abcde" 14 14 PASS new WebGLContextEvent('eventType', { statusMessage: '' }).statusMessage is "" 15 PASS new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage is " undefined"15 PASS new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage is "" 16 16 PASS new WebGLContextEvent('eventType', { statusMessage: null }).statusMessage is "null" 17 17 PASS new WebGLContextEvent('eventType', { statusMessage: false }).statusMessage is "false" -
trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor.html
r155267 r207238 30 30 31 31 // Non-strings. 32 shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage", " undefined");32 shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage", ""); 33 33 shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: null }).statusMessage", "null"); 34 34 shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: false }).statusMessage", "false"); -
trunk/LayoutTests/storage/domstorage/events/basic-expected.txt
r101453 r207238 43 43 storage.clear() 44 44 PASS storageEventList.length is 8 45 PASS storageEventList[7].key is ""45 PASS storageEventList[7].key is null 46 46 PASS storageEventList[7].oldValue is null 47 47 PASS storageEventList[7].newValue is null … … 87 87 storage.clear() 88 88 PASS storageEventList.length is 8 89 PASS storageEventList[7].key is ""89 PASS storageEventList[7].key is null 90 90 PASS storageEventList[7].oldValue is null 91 91 PASS storageEventList[7].newValue is null -
trunk/LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt
r101453 r207238 45 45 storage.clear() 46 46 PASS storageEventList.length is 8 47 PASS storageEventList[7].key is ""47 PASS storageEventList[7].key is null 48 48 PASS storageEventList[7].oldValue is null 49 49 PASS storageEventList[7].newValue is null … … 91 91 storage.clear() 92 92 PASS storageEventList.length is 8 93 PASS storageEventList[7].key is ""93 PASS storageEventList[7].key is null 94 94 PASS storageEventList[7].oldValue is null 95 95 PASS storageEventList[7].newValue is null -
trunk/LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js
r101453 r207238 87 87 { 88 88 shouldBe("storageEventList.length", "8"); 89 shouldBe EqualToString("storageEventList[7].key", "");89 shouldBeNull("storageEventList[7].key"); 90 90 shouldBeNull("storageEventList[7].oldValue"); 91 91 shouldBeNull("storageEventList[7].newValue"); -
trunk/LayoutTests/storage/domstorage/events/script-tests/basic.js
r101453 r207238 87 87 { 88 88 shouldBe("storageEventList.length", "8"); 89 shouldBe EqualToString("storageEventList[7].key", "");89 shouldBeNull("storageEventList[7].key"); 90 90 shouldBeNull("storageEventList[7].oldValue"); 91 91 shouldBeNull("storageEventList[7].newValue"); -
trunk/Source/WebCore/ChangeLog
r207234 r207238 1 2016-10-12 Chris Dumez <cdumez@apple.com> 2 3 Update more events to stop using legacy [ConstructorTemplate=Event] 4 https://bugs.webkit.org/show_bug.cgi?id=163339 5 6 Reviewed by Ryosuke Niwa. 7 8 Update more events to stop using legacy [ConstructorTemplate=Event] 9 and use regular constructors instead. 10 11 No new tests, updated existing tests. 12 13 * bindings/scripts/test/JS/JSTestEventConstructor.cpp: 14 (WebCore::convertDictionary<TestEventConstructor::Init>): 15 (WebCore::JSTestEventConstructorConstructor::construct): 16 (WebCore::JSTestEventConstructorConstructor::prototypeForStructure): 17 (WebCore::JSTestEventConstructor::JSTestEventConstructor): 18 (WebCore::JSTestEventConstructor::createPrototype): 19 (WebCore::JSTestEventConstructorPrototype::create): Deleted. 20 (WebCore::JSTestEventConstructorPrototype::createStructure): Deleted. 21 (WebCore::JSTestEventConstructorPrototype::JSTestEventConstructorPrototype): Deleted. 22 (WebCore::setJSTestEventConstructorConstructor): Deleted. 23 (WebCore::JSTestEventConstructor::getConstructor): Deleted. 24 * bindings/scripts/test/JS/JSTestEventConstructor.h: 25 (WebCore::JSTestEventConstructor::wrapped): 26 (WebCore::JSTestEventConstructor::create): Deleted. 27 (WebCore::toJS): Deleted. 28 (WebCore::toJSNewlyCreated): Deleted. 29 * bindings/scripts/test/TestEventConstructor.idl: 30 * css/CSSFontFaceLoadEvent.cpp: 31 (WebCore::CSSFontFaceLoadEvent::CSSFontFaceLoadEvent): 32 * css/CSSFontFaceLoadEvent.h: 33 * css/CSSFontFaceLoadEvent.idl: 34 * html/canvas/WebGLContextEvent.cpp: 35 (WebCore::WebGLContextEvent::WebGLContextEvent): 36 * html/canvas/WebGLContextEvent.h: 37 * html/canvas/WebGLContextEvent.idl: 38 * storage/StorageEvent.cpp: 39 (WebCore::StorageEvent::create): 40 (WebCore::StorageEvent::StorageEvent): 41 * storage/StorageEvent.h: 42 * storage/StorageEvent.idl: 43 1 44 2016-10-12 Andreas Kling <akling@apple.com> 2 45 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
r207192 r207238 22 22 #include "JSTestEventConstructor.h" 23 23 24 #include "ExceptionCode.h" 24 25 #include "JSDOMBinding.h" 25 26 #include "JSDOMConstructor.h" 26 #include "JSDictionary.h"27 27 #include "URL.h" 28 28 #include <runtime/Error.h> 29 #include <runtime/FunctionPrototype.h>30 29 #include <runtime/JSString.h> 31 30 #include <wtf/GetPtr.h> … … 34 33 35 34 namespace WebCore { 35 36 template<> Optional<TestEventConstructor::Init> convertDictionary<TestEventConstructor::Init>(ExecState& state, JSValue value) 37 { 38 VM& vm = state.vm(); 39 auto throwScope = DECLARE_THROW_SCOPE(vm); 40 bool isNullOrUndefined = value.isUndefinedOrNull(); 41 auto* object = isNullOrUndefined ? nullptr : value.getObject(); 42 if (UNLIKELY(!isNullOrUndefined && !object)) { 43 throwTypeError(&state, throwScope); 44 return Nullopt; 45 } 46 if (UNLIKELY(object && object->type() == RegExpObjectType)) { 47 throwTypeError(&state, throwScope); 48 return Nullopt; 49 } 50 TestEventConstructor::Init result; 51 JSValue bubblesValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "bubbles")); 52 if (!bubblesValue.isUndefined()) { 53 result.bubbles = convert<IDLBoolean>(state, bubblesValue); 54 RETURN_IF_EXCEPTION(throwScope, Nullopt); 55 } else 56 result.bubbles = false; 57 JSValue cancelableValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "cancelable")); 58 if (!cancelableValue.isUndefined()) { 59 result.cancelable = convert<IDLBoolean>(state, cancelableValue); 60 RETURN_IF_EXCEPTION(throwScope, Nullopt); 61 } else 62 result.cancelable = false; 63 JSValue composedValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "composed")); 64 if (!composedValue.isUndefined()) { 65 result.composed = convert<IDLBoolean>(state, composedValue); 66 RETURN_IF_EXCEPTION(throwScope, Nullopt); 67 } else 68 result.composed = false; 69 JSValue attr2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "attr2")); 70 if (!attr2Value.isUndefined()) { 71 result.attr2 = convert<IDLDOMString>(state, attr2Value); 72 RETURN_IF_EXCEPTION(throwScope, Nullopt); 73 } else 74 result.attr2 = ""; 75 JSValue attr3Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "attr3")); 76 if (!attr3Value.isUndefined()) { 77 result.attr3 = convert<IDLDOMString>(state, attr3Value); 78 RETURN_IF_EXCEPTION(throwScope, Nullopt); 79 } else 80 result.attr3 = ""; 81 return WTFMove(result); 82 } 36 83 37 84 // Attributes … … 76 123 VM& vm = state->vm(); 77 124 auto throwScope = DECLARE_THROW_SCOPE(vm); 78 auto* jsConstructor = jsCast<JSTestEventConstructorConstructor*>(state->callee()); 79 ASSERT(jsConstructor); 80 81 if (!jsConstructor->scriptExecutionContext()) 82 return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestEventConstructor"); 83 125 UNUSED_PARAM(throwScope); 126 auto* castedThis = jsCast<JSTestEventConstructorConstructor*>(state->callee()); 127 ASSERT(castedThis); 84 128 if (UNLIKELY(state->argumentCount() < 1)) 85 129 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 86 87 AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state); 130 auto type = state->uncheckedArgument(0).toWTFString(state); 88 131 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 89 90 TestEventConstructorInit eventInit; 91 92 JSValue initializerValue = state->argument(1); 93 if (!initializerValue.isUndefinedOrNull()) { 94 // Given the above test, this will always yield an object. 95 JSObject* initializerObject = initializerValue.toObject(state); 96 ASSERT(!throwScope.exception()); 97 98 // Create the dictionary wrapper from the initializer object. 99 JSDictionary dictionary(state, initializerObject); 100 101 // Attempt to fill in the EventInit. 102 if (!fillTestEventConstructorInit(eventInit, dictionary)) 103 return JSValue::encode(jsUndefined()); 104 } 105 106 Ref<TestEventConstructor> event = TestEventConstructor::createForBindings(eventType, eventInit); 107 return JSValue::encode(createWrapper<TestEventConstructor>(jsConstructor->globalObject(), WTFMove(event))); 108 } 109 110 bool fillTestEventConstructorInit(TestEventConstructorInit& eventInit, JSDictionary& dictionary) 111 { 112 if (!dictionary.tryGetProperty("attr2", eventInit.attr2)) 113 return false; 114 #if ENABLE(SPECIAL_EVENT) 115 if (!dictionary.tryGetProperty("attr3", eventInit.attr3)) 116 return false; 117 #endif 118 return true; 132 auto eventInitDict = convert<IDLDictionary<TestEventConstructor::Init>>(*state, state->argument(1)); 133 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 134 auto object = TestEventConstructor::create(WTFMove(type), eventInitDict.value()); 135 return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))); 119 136 } 120 137 121 138 template<> JSValue JSTestEventConstructorConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) 122 139 { 123 UNUSED_PARAM(vm); 124 return globalObject.functionPrototype(); 140 return JSEvent::getConstructor(vm, &globalObject); 125 141 } 126 142 … … 159 175 160 176 JSTestEventConstructor::JSTestEventConstructor(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestEventConstructor>&& impl) 161 : JS DOMWrapper<TestEventConstructor>(structure, globalObject, WTFMove(impl))177 : JSEvent(structure, globalObject, WTFMove(impl)) 162 178 { 163 179 } … … 165 181 JSObject* JSTestEventConstructor::createPrototype(VM& vm, JSGlobalObject* globalObject) 166 182 { 167 return JSTestEventConstructorPrototype::create(vm, globalObject, JSTestEventConstructorPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));183 return JSTestEventConstructorPrototype::create(vm, globalObject, JSTestEventConstructorPrototype::createStructure(vm, globalObject, JSEvent::prototype(vm, globalObject))); 168 184 } 169 185 … … 171 187 { 172 188 return getDOMPrototype<JSTestEventConstructor>(vm, globalObject); 173 }174 175 void JSTestEventConstructor::destroy(JSC::JSCell* cell)176 {177 JSTestEventConstructor* thisObject = static_cast<JSTestEventConstructor*>(cell);178 thisObject->JSTestEventConstructor::~JSTestEventConstructor();179 189 } 180 190 … … 262 272 { 263 273 return getDOMConstructor<JSTestEventConstructorConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); 264 }265 266 bool JSTestEventConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)267 {268 UNUSED_PARAM(handle);269 UNUSED_PARAM(visitor);270 return false;271 }272 273 void JSTestEventConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)274 {275 auto* jsTestEventConstructor = jsCast<JSTestEventConstructor*>(handle.slot()->asCell());276 auto& world = *static_cast<DOMWrapperWorld*>(context);277 uncacheWrapper(world, &jsTestEventConstructor->wrapped(), jsTestEventConstructor);278 274 } 279 275 … … 316 312 } 317 313 318 TestEventConstructor* JSTestEventConstructor::toWrapped(JSC::JSValue value) 319 { 320 if (auto* wrapper = jsDynamicCast<JSTestEventConstructor*>(value)) 321 return &wrapper->wrapped(); 322 return nullptr; 323 } 324 325 } 314 315 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h
r207192 r207238 21 21 #pragma once 22 22 23 #include "JSDOMWrapper.h" 23 #include "JSDOMConvert.h" 24 #include "JSEvent.h" 24 25 #include "TestEventConstructor.h" 25 #include <wtf/NeverDestroyed.h>26 26 27 27 namespace WebCore { 28 28 29 class JSDictionary; 30 31 class JSTestEventConstructor : public JSDOMWrapper<TestEventConstructor> { 29 class JSTestEventConstructor : public JSEvent { 32 30 public: 33 using Base = JSDOMWrapper<TestEventConstructor>; 31 using Base = JSEvent; 32 using DOMWrapped = TestEventConstructor; 34 33 static JSTestEventConstructor* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestEventConstructor>&& impl) 35 34 { … … 41 40 static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*); 42 41 static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*); 43 static TestEventConstructor* toWrapped(JSC::JSValue);44 static void destroy(JSC::JSCell*);45 42 46 43 DECLARE_INFO; … … 52 49 53 50 static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); 51 TestEventConstructor& wrapped() const 52 { 53 return static_cast<TestEventConstructor&>(Base::wrapped()); 54 } 54 55 protected: 55 56 JSTestEventConstructor(JSC::Structure*, JSDOMGlobalObject&, Ref<TestEventConstructor>&&); … … 63 64 }; 64 65 65 class JSTestEventConstructorOwner : public JSC::WeakHandleOwner {66 public:67 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);68 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);69 };70 71 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestEventConstructor*)72 {73 static NeverDestroyed<JSTestEventConstructorOwner> owner;74 return &owner.get();75 }76 77 inline void* wrapperKey(TestEventConstructor* wrappableObject)78 {79 return wrappableObject;80 }81 82 66 JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEventConstructor&); 83 67 inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestEventConstructor* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); } … … 85 69 inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestEventConstructor>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } 86 70 87 bool fillTestEventConstructorInit(TestEventConstructorInit&, JSDictionary&);88 89 71 template<> struct JSDOMWrapperConverterTraits<TestEventConstructor> { 90 72 using WrapperClass = JSTestEventConstructor; 91 73 }; 74 template<> Optional<TestEventConstructor::Init> convertDictionary<TestEventConstructor::Init>(JSC::ExecState&, JSC::JSValue); 75 92 76 93 77 } // namespace WebCore -
trunk/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl
r198056 r207238 30 30 // changes in its ouput. 31 31 [ 32 Constructor Template=Event33 ] interface TestEventConstructor {32 Constructor(DOMString type, optional TestEventConstructorInit eventInitDict), 33 ] interface TestEventConstructor : Event { 34 34 // Attributes 35 35 readonly attribute DOMString attr1; 36 [InitializedByEventConstructor]readonly attribute DOMString attr2;37 [ InitializedByEventConstructor,Conditional=SPECIAL_EVENT] readonly attribute DOMString attr3;36 readonly attribute DOMString attr2; 37 [Conditional=SPECIAL_EVENT] readonly attribute DOMString attr3; 38 38 }; 39 40 dictionary TestEventConstructorInit : EventInit { 41 DOMString attr2 = ""; 42 [Conditional=SPECIAL_EVENT] DOMString attr3 = ""; 43 }; -
trunk/Source/WebCore/css/CSSFontFaceLoadEvent.cpp
r201113 r207238 47 47 } 48 48 49 CSSFontFaceLoadEvent::CSSFontFaceLoadEvent(const AtomicString& type, const CSSFontFaceLoadEventInit& initializer)50 : Event(type, initializer )49 CSSFontFaceLoadEvent::CSSFontFaceLoadEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted) 50 : Event(type, initializer, isTrusted) 51 51 , m_fontface(initializer.fontface) 52 52 , m_error(initializer.error) -
trunk/Source/WebCore/css/CSSFontFaceLoadEvent.h
r205093 r207238 43 43 class DOMError; 44 44 45 struct CSSFontFaceLoadEventInit : public EventInit {46 RefPtr<CSSFontFaceRule> fontface;47 RefPtr<DOMError> error;48 };49 50 45 class CSSFontFaceLoadEvent final : public Event { 51 46 public: … … 55 50 } 56 51 57 static Ref<CSSFontFaceLoadEvent> create(const AtomicString& type, const CSSFontFaceLoadEventInit& initializer) 52 struct Init : EventInit { 53 RefPtr<CSSFontFaceRule> fontface; 54 RefPtr<DOMError> error; 55 }; 56 57 static Ref<CSSFontFaceLoadEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) 58 58 { 59 return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, initializer ));59 return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, initializer, isTrusted)); 60 60 } 61 61 … … 80 80 CSSFontFaceLoadEvent(); 81 81 CSSFontFaceLoadEvent(const AtomicString&, RefPtr<CSSFontFaceRule>&&, RefPtr<DOMError>&&); 82 CSSFontFaceLoadEvent(const AtomicString&, const CSSFontFaceLoadEventInit&);82 CSSFontFaceLoadEvent(const AtomicString&, const Init&, IsTrusted); 83 83 84 84 RefPtr<CSSFontFaceRule> m_fontface; -
trunk/Source/WebCore/css/CSSFontFaceLoadEvent.idl
r171824 r207238 30 30 31 31 [ 32 NoInterfaceObject,33 32 Conditional=FONT_LOAD_EVENTS, 34 Constructor Template=Event33 Constructor(DOMString type, optional CSSFontFaceLoadEventInit eventInit), 35 34 ] interface CSSFontFaceLoadEvent : Event { 36 [InitializedByEventConstructor] readonly attribute CSSFontFaceRulefontface;37 [InitializedByEventConstructor] readonly attribute DOMErrorerror;35 readonly attribute CSSFontFaceRule? fontface; 36 readonly attribute DOMError? error; 38 37 }; 38 39 dictionary CSSFontFaceLoadEventInit : EventInit { 40 CSSFontFaceRule? fontface = null; 41 DOMError? error = null; 42 }; -
trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp
r196400 r207238 39 39 } 40 40 41 WebGLContextEvent::WebGLContextEvent(const AtomicString& type, const WebGLContextEventInit& initializer)42 : Event(type, initializer )41 WebGLContextEvent::WebGLContextEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted) 42 : Event(type, initializer, isTrusted) 43 43 , m_statusMessage(initializer.statusMessage) 44 44 { -
trunk/Source/WebCore/html/canvas/WebGLContextEvent.h
r197563 r207238 31 31 namespace WebCore { 32 32 33 struct WebGLContextEventInit : public EventInit {34 String statusMessage;35 };36 37 33 class WebGLContextEvent final : public Event { 38 34 public: … … 41 37 return adoptRef(*new WebGLContextEvent(type, canBubble, cancelable, statusMessage)); 42 38 } 43 static Ref<WebGLContextEvent> createForBindings(const AtomicString& type, const WebGLContextEventInit& initializer) 39 40 struct Init : EventInit { 41 String statusMessage; 42 }; 43 44 static Ref<WebGLContextEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) 44 45 { 45 return adoptRef(*new WebGLContextEvent(type, initializer ));46 return adoptRef(*new WebGLContextEvent(type, initializer, isTrusted)); 46 47 } 47 48 virtual ~WebGLContextEvent(); … … 53 54 private: 54 55 WebGLContextEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& statusMessage); 55 WebGLContextEvent(const AtomicString&, const WebGLContextEventInit&);56 WebGLContextEvent(const AtomicString&, const Init&, IsTrusted); 56 57 57 58 String m_statusMessage; -
trunk/Source/WebCore/html/canvas/WebGLContextEvent.idl
r131172 r207238 26 26 [ 27 27 Conditional=WEBGL, 28 Constructor Template=Event28 Constructor(DOMString type, optional WebGLContextEventInit eventInit), 29 29 ] interface WebGLContextEvent : Event { 30 [InitializedByEventConstructor]readonly attribute DOMString statusMessage;30 readonly attribute DOMString statusMessage; 31 31 }; 32 32 33 dictionary WebGLContextEventInit : EventInit { 34 DOMString statusMessage = ""; 35 }; -
trunk/Source/WebCore/storage/StorageEvent.cpp
r196400 r207238 50 50 } 51 51 52 Ref<StorageEvent> StorageEvent::create ForBindings(const AtomicString& type, const StorageEventInit& initializer)52 Ref<StorageEvent> StorageEvent::create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted) 53 53 { 54 return adoptRef(*new StorageEvent(type, initializer ));54 return adoptRef(*new StorageEvent(type, initializer, isTrusted)); 55 55 } 56 56 … … 65 65 } 66 66 67 StorageEvent::StorageEvent(const AtomicString& type, const StorageEventInit& initializer)68 : Event(type, initializer )67 StorageEvent::StorageEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted) 68 : Event(type, initializer, isTrusted) 69 69 , m_key(initializer.key) 70 70 , m_oldValue(initializer.oldValue) -
trunk/Source/WebCore/storage/StorageEvent.h
r196400 r207238 34 34 class Storage; 35 35 36 struct StorageEventInit : public EventInit {37 String key;38 String oldValue;39 String newValue;40 String url;41 RefPtr<Storage> storageArea;42 };43 44 36 class StorageEvent : public Event { 45 37 public: 46 38 static Ref<StorageEvent> create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 47 39 static Ref<StorageEvent> createForBindings(); 48 static Ref<StorageEvent> createForBindings(const AtomicString&, const StorageEventInit&); 40 41 struct Init : EventInit { 42 String key; 43 String oldValue; 44 String newValue; 45 String url; 46 RefPtr<Storage> storageArea; 47 }; 48 49 static Ref<StorageEvent> create(const AtomicString&, const Init&, IsTrusted = IsTrusted::No); 49 50 virtual ~StorageEvent(); 50 51 … … 65 66 StorageEvent(); 66 67 StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 67 StorageEvent(const AtomicString&, const StorageEventInit&);68 StorageEvent(const AtomicString&, const Init&, IsTrusted); 68 69 69 70 String m_key; -
trunk/Source/WebCore/storage/StorageEvent.idl
r204215 r207238 25 25 26 26 [ 27 Constructor Template=Event,27 Constructor(DOMString type, optional StorageEventInit eventInitDict) 28 28 ] interface StorageEvent : Event { 29 [InitializedByEventConstructor] readonly attribute DOMStringkey;30 [InitializedByEventConstructor]readonly attribute DOMString? oldValue;31 [InitializedByEventConstructor]readonly attribute DOMString? newValue;32 [InitializedByEventConstructor]readonly attribute USVString url;33 [InitializedByEventConstructor] readonly attribute StoragestorageArea;29 readonly attribute DOMString? key; 30 readonly attribute DOMString? oldValue; 31 readonly attribute DOMString? newValue; 32 readonly attribute USVString url; 33 readonly attribute Storage? storageArea; 34 34 35 35 // FIXME: Using "undefined" as default parameter value is wrong. … … 47 47 }; 48 48 49 dictionary StorageEventInit : EventInit { 50 DOMString? key = null; 51 DOMString? oldValue = null; 52 DOMString? newValue = null; 53 USVString url = ""; 54 Storage? storageArea = null; 55 };
Note: See TracChangeset
for help on using the changeset viewer.