Changeset 207058 in webkit
- Timestamp:
- Oct 11, 2016 12:11:40 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207052 r207058 1 2016-10-11 Chris Dumez <cdumez@apple.com> 2 3 Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event] 4 https://bugs.webkit.org/show_bug.cgi?id=163266 5 6 Reviewed by Darin Adler. 7 8 Update existing layout test covering the IDBVersionChangeEvent constructor 9 to test to EventInit dictionary members as well. 10 11 * storage/indexeddb/modern/idbversionchangeevent-constructor-expected.txt: 12 * storage/indexeddb/modern/idbversionchangeevent-constructor.html: 13 1 14 2016-10-10 Adam Bergkvist <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com> 2 15 -
trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor-expected.txt
r199774 r207058 20 20 PASS event.oldVersion is 43876528735628 21 21 PASS event.newVersion is 0 22 event = new IDBVersionChangeEvent('bar', { bubbles: true, cancelable: true, composed: true }); 23 PASS event.type is "bar" 24 PASS event.bubbles is true 25 PASS event.cancelable is true 26 PASS event.composed is true 22 27 PASS successfullyParsed is true 23 28 -
trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor.html
r199774 r207058 36 36 shouldBeEqualToNumber("event.newVersion", 0); 37 37 38 evalAndLog("event = new IDBVersionChangeEvent('bar', { bubbles: true, cancelable: true, composed: true });"); 39 shouldBeEqualToString("event.type", "bar"); 40 shouldBeTrue("event.bubbles"); 41 shouldBeTrue("event.cancelable"); 42 shouldBeTrue("event.composed"); 43 38 44 finishJSTest(); 39 45 -
trunk/Source/WebCore/ChangeLog
r207057 r207058 1 2016-10-11 Chris Dumez <cdumez@apple.com> 2 3 Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event] 4 https://bugs.webkit.org/show_bug.cgi?id=163266 5 6 Reviewed by Darin Adler. 7 8 Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event] 9 and use a regular constructor instead, as in the specification: 10 - http://w3c.github.io/IndexedDB/#request-idbversionchangeevent 11 12 This patch also fixes a bug where the IDBVersionChangeEvent was ignoring the 13 EventInit dictionary members passed by the JavaScript (e.g. bubbles). 14 15 No new tests, updated existing test. 16 17 * Modules/indexeddb/IDBVersionChangeEvent.cpp: 18 (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent): 19 * Modules/indexeddb/IDBVersionChangeEvent.h: 20 * Modules/indexeddb/IDBVersionChangeEvent.idl: 21 * bindings/js/JSDOMConvert.h: 22 (WebCore::convertNullable): 23 (WebCore::convert): Deleted. 24 * bindings/scripts/CodeGeneratorJS.pm: 25 (GenerateDefaultValue): 26 (GenerateDictionaryImplementationContent): 27 * bindings/scripts/test/JS/JSTestObj.cpp: 28 (WebCore::convertDictionary<TestObj::Dictionary>): 29 * bindings/scripts/test/TestObj.idl: 30 1 31 2016-10-11 Chris Dumez <cdumez@apple.com> 2 32 -
trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp
r199750 r207058 42 42 } 43 43 44 IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& name, const I DBVersionChangeEventInit& init)45 : Event(name, false /*canBubble*/, false /*cancelable*/)44 IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& name, const Init& init, IsTrusted isTrusted) 45 : Event(name, init, isTrusted) 46 46 , m_oldVersion(init.oldVersion) 47 47 , m_newVersion(init.newVersion) -
trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h
r199774 r207058 34 34 namespace WebCore { 35 35 36 struct IDBVersionChangeEventInit : public EventInit {37 uint64_t oldVersion { 0 };38 Optional<uint64_t> newVersion;39 };40 41 36 class IDBVersionChangeEvent final : public Event { 42 37 public: … … 51 46 } 52 47 53 static Ref<IDBVersionChangeEvent> createForBindings(const AtomicString& type, const IDBVersionChangeEventInit& initializer) 48 struct Init : EventInit { 49 uint64_t oldVersion { 0 }; 50 Optional<uint64_t> newVersion; 51 }; 52 53 static Ref<IDBVersionChangeEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) 54 54 { 55 return adoptRef(*new IDBVersionChangeEvent(type, initializer ));55 return adoptRef(*new IDBVersionChangeEvent(type, initializer, isTrusted)); 56 56 } 57 57 … … 65 65 private: 66 66 IDBVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType); 67 IDBVersionChangeEvent(const AtomicString&, const I DBVersionChangeEventInit&);67 IDBVersionChangeEvent(const AtomicString&, const Init&, IsTrusted); 68 68 69 69 EventInterface eventInterface() const; -
trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.idl
r199889 r207058 24 24 */ 25 25 26 // FIXME: This should be exposed to workers as well. 26 27 [ 27 28 Conditional=INDEXED_DATABASE, 28 29 EnabledAtRuntime=IndexedDB, 29 Constructor Template=Event,30 Constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict), 30 31 ] interface IDBVersionChangeEvent : Event { 31 32 [InitializedByEventConstructor] readonly attribute unsigned long long oldVersion; 32 33 [InitializedByEventConstructor] readonly attribute unsigned long long? newVersion; 33 34 }; 35 36 dictionary IDBVersionChangeEventInit : EventInit { 37 unsigned long long oldVersion = 0; 38 unsigned long long? newVersion = null; 39 }; -
trunk/Source/WebCore/bindings/js/JSDOMConvert.h
r207016 r207058 40 40 template<typename T> T convert(JSC::ExecState&, JSC::JSValue); 41 41 template<typename T> EnableIfIntegralType<T> convert(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration); 42 template<typename T> EnableIfIntegralType<Optional<T>> convertNullable(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration); 42 43 template<typename T> EnableIfFloatingPointType<T> convert(JSC::ExecState&, JSC::JSValue, ShouldAllowNonFinite); 43 44 … … 62 63 { 63 64 return Converter<T>::convert(state, value, configuration); 65 } 66 67 template<typename T> inline EnableIfIntegralType<T, Optional<T>> convertNullable(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration) 68 { 69 return value.isUndefinedOrNull() ? Optional<T>() : Converter<T>::convert(state, value, configuration); 64 70 } 65 71 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r207041 r207058 975 975 my ($interface, $member) = @_; 976 976 977 my $ value = $member->default;977 my $defaultValue = $member->default; 978 978 979 979 if ($codeGenerator->IsEnumType($member->type)) { … … 981 981 # FIXME: Would be nice to report an error if the value is not one of the enumeration values. 982 982 my $className = GetEnumerationClassName($member->type, $interface); 983 my $enumerationValueName = GetEnumerationValueName(substr($value, 1, -1)); 984 $value = $className . "::" . $enumerationValueName; 985 } 986 if ($value eq "null") { 987 $value = $member->type eq "any" ? "jsNull()" : "nullptr"; 988 } 989 $value = "{ }" if $value eq "[]"; 990 $value = "jsUndefined()" if $value eq "undefined"; 991 992 return $value; 983 my $enumerationValueName = GetEnumerationValueName(substr($defaultValue, 1, -1)); 984 return $className . "::" . $enumerationValueName; 985 } 986 if ($defaultValue eq "null") { 987 return "jsNull()" if $member->type eq "any"; 988 return "nullptr" if $codeGenerator->IsWrapperType($member->type); 989 return "String()" if $codeGenerator->IsStringType($member->type); 990 return "Nullopt"; 991 } 992 return "{ }" if $defaultValue eq "[]"; 993 return "jsUndefined()" if $defaultValue eq "undefined"; 994 995 return $defaultValue; 993 996 } 994 997 … … 1132 1135 } else { 1133 1136 my $conversionRuleWithLeadingComma = GenerateConversionRuleWithLeadingComma($interface, $member); 1134 $result .= " result.$key = convert<${nativeType}>(state, ${key}Value${conversionRuleWithLeadingComma});\n"; 1137 my $convertFunction = $member->isNullable ? "convertNullable" : "convert"; 1138 $result .= " result.$key = $convertFunction<${nativeType}>(state, ${key}Value${conversionRuleWithLeadingComma});\n"; 1135 1139 $result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n"; 1136 1140 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r206992 r207058 551 551 } else 552 552 result.largeIntegerWithDefault = 0; 553 JSValue nullableIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableIntegerWithDefault")); 554 if (!nullableIntegerWithDefaultValue.isUndefined()) { 555 result.nullableIntegerWithDefault = convertNullable<int32_t>(state, nullableIntegerWithDefaultValue, NormalConversion); 556 RETURN_IF_EXCEPTION(throwScope, Nullopt); 557 } else 558 result.nullableIntegerWithDefault = Nullopt; 553 559 JSValue nullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableNode")); 554 560 if (!nullableNodeValue.isUndefined()) { … … 557 563 } else 558 564 result.nullableNode = nullptr; 565 JSValue nullableStringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableStringWithDefault")); 566 if (!nullableStringWithDefaultValue.isUndefined()) { 567 result.nullableStringWithDefault = convertNullable<String>(state, nullableStringWithDefaultValue); 568 RETURN_IF_EXCEPTION(throwScope, Nullopt); 569 } else 570 result.nullableStringWithDefault = String(); 559 571 JSValue restrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDouble")); 560 572 if (!restrictedDoubleValue.isUndefined()) { -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r206976 r207058 434 434 DOMString stringWithDefault = "defaultString"; 435 435 DOMString stringWithoutDefault; 436 DOMString? nullableStringWithDefault = null; 436 437 boolean booleanWithDefault = false; 437 438 boolean booleanWithoutDefault; … … 457 458 unsigned long long unsignedLargeInteger; 458 459 unsigned long long unsignedLargeIntegerWithDefault = 0; 460 long? nullableIntegerWithDefault = null; 459 461 Node? nullableNode = null; 460 462 any anyValue;
Note: See TracChangeset
for help on using the changeset viewer.