Diff
Modified: trunk/LayoutTests/ChangeLog (207057 => 207058)
--- trunk/LayoutTests/ChangeLog 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/LayoutTests/ChangeLog 2016-10-11 07:11:40 UTC (rev 207058)
@@ -1,3 +1,16 @@
+2016-10-11 Chris Dumez <[email protected]>
+
+ Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163266
+
+ Reviewed by Darin Adler.
+
+ Update existing layout test covering the IDBVersionChangeEvent constructor
+ to test to EventInit dictionary members as well.
+
+ * storage/indexeddb/modern/idbversionchangeevent-constructor-expected.txt:
+ * storage/indexeddb/modern/idbversionchangeevent-constructor.html:
+
2016-10-10 Adam Bergkvist <[email protected]> and Alejandro G. Castro <[email protected]>
WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly
Modified: trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor-expected.txt (207057 => 207058)
--- trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor-expected.txt 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor-expected.txt 2016-10-11 07:11:40 UTC (rev 207058)
@@ -19,6 +19,11 @@
event = new IDBVersionChangeEvent('bar', { oldVersion: 43876528735628, newVersion: 0 });
PASS event.oldVersion is 43876528735628
PASS event.newVersion is 0
+event = new IDBVersionChangeEvent('bar', { bubbles: true, cancelable: true, composed: true });
+PASS event.type is "bar"
+PASS event.bubbles is true
+PASS event.cancelable is true
+PASS event.composed is true
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor.html (207057 => 207058)
--- trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor.html 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbversionchangeevent-constructor.html 2016-10-11 07:11:40 UTC (rev 207058)
@@ -35,6 +35,12 @@
shouldBeEqualToNumber("event.oldVersion", 43876528735628);
shouldBeEqualToNumber("event.newVersion", 0);
+evalAndLog("event = new IDBVersionChangeEvent('bar', { bubbles: true, cancelable: true, composed: true });");
+shouldBeEqualToString("event.type", "bar");
+shouldBeTrue("event.bubbles");
+shouldBeTrue("event.cancelable");
+shouldBeTrue("event.composed");
+
finishJSTest();
</script>
Modified: trunk/Source/WebCore/ChangeLog (207057 => 207058)
--- trunk/Source/WebCore/ChangeLog 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/ChangeLog 2016-10-11 07:11:40 UTC (rev 207058)
@@ -1,5 +1,35 @@
2016-10-11 Chris Dumez <[email protected]>
+ Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163266
+
+ Reviewed by Darin Adler.
+
+ Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event]
+ and use a regular constructor instead, as in the specification:
+ - http://w3c.github.io/IndexedDB/#request-idbversionchangeevent
+
+ This patch also fixes a bug where the IDBVersionChangeEvent was ignoring the
+ EventInit dictionary members passed by the _javascript_ (e.g. bubbles).
+
+ No new tests, updated existing test.
+
+ * Modules/indexeddb/IDBVersionChangeEvent.cpp:
+ (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
+ * Modules/indexeddb/IDBVersionChangeEvent.h:
+ * Modules/indexeddb/IDBVersionChangeEvent.idl:
+ * bindings/js/JSDOMConvert.h:
+ (WebCore::convertNullable):
+ (WebCore::convert): Deleted.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateDefaultValue):
+ (GenerateDictionaryImplementationContent):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::convertDictionary<TestObj::Dictionary>):
+ * bindings/scripts/test/TestObj.idl:
+
+2016-10-11 Chris Dumez <[email protected]>
+
Update WebKitPlaybackTargetAvailabilityEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163265
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp (207057 => 207058)
--- trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp 2016-10-11 07:11:40 UTC (rev 207058)
@@ -41,8 +41,8 @@
m_newVersion = Nullopt;
}
-IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& name, const IDBVersionChangeEventInit& init)
- : Event(name, false /*canBubble*/, false /*cancelable*/)
+IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& name, const Init& init, IsTrusted isTrusted)
+ : Event(name, init, isTrusted)
, m_oldVersion(init.oldVersion)
, m_newVersion(init.newVersion)
{
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h (207057 => 207058)
--- trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h 2016-10-11 07:11:40 UTC (rev 207058)
@@ -33,11 +33,6 @@
namespace WebCore {
-struct IDBVersionChangeEventInit : public EventInit {
- uint64_t oldVersion { 0 };
- Optional<uint64_t> newVersion;
-};
-
class IDBVersionChangeEvent final : public Event {
public:
static Ref<IDBVersionChangeEvent> create(uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType)
@@ -50,9 +45,14 @@
return adoptRef(*new IDBVersionChangeEvent(requestIdentifier, oldVersion, newVersion, eventType));
}
- static Ref<IDBVersionChangeEvent> createForBindings(const AtomicString& type, const IDBVersionChangeEventInit& initializer)
+ struct Init : EventInit {
+ uint64_t oldVersion { 0 };
+ Optional<uint64_t> newVersion;
+ };
+
+ static Ref<IDBVersionChangeEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
{
- return adoptRef(*new IDBVersionChangeEvent(type, initializer));
+ return adoptRef(*new IDBVersionChangeEvent(type, initializer, isTrusted));
}
const IDBResourceIdentifier& requestIdentifier() const { return m_requestIdentifier; }
@@ -64,7 +64,7 @@
private:
IDBVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType);
- IDBVersionChangeEvent(const AtomicString&, const IDBVersionChangeEventInit&);
+ IDBVersionChangeEvent(const AtomicString&, const Init&, IsTrusted);
EventInterface eventInterface() const;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.idl (207057 => 207058)
--- trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.idl 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.idl 2016-10-11 07:11:40 UTC (rev 207058)
@@ -23,11 +23,17 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+// FIXME: This should be exposed to workers as well.
[
Conditional=INDEXED_DATABASE,
EnabledAtRuntime=IndexedDB,
- ConstructorTemplate=Event,
+ Constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict),
] interface IDBVersionChangeEvent : Event {
[InitializedByEventConstructor] readonly attribute unsigned long long oldVersion;
[InitializedByEventConstructor] readonly attribute unsigned long long? newVersion;
};
+
+dictionary IDBVersionChangeEventInit : EventInit {
+ unsigned long long oldVersion = 0;
+ unsigned long long? newVersion = null;
+};
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (207057 => 207058)
--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h 2016-10-11 07:11:40 UTC (rev 207058)
@@ -39,6 +39,7 @@
template<typename T> T convert(JSC::ExecState&, JSC::JSValue);
template<typename T> EnableIfIntegralType<T> convert(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration);
+template<typename T> EnableIfIntegralType<Optional<T>> convertNullable(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration);
template<typename T> EnableIfFloatingPointType<T> convert(JSC::ExecState&, JSC::JSValue, ShouldAllowNonFinite);
template<typename T> Optional<T> convertDictionary(JSC::ExecState&, JSC::JSValue);
@@ -63,6 +64,11 @@
return Converter<T>::convert(state, value, configuration);
}
+template<typename T> inline EnableIfIntegralType<T, Optional<T>> convertNullable(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ return value.isUndefinedOrNull() ? Optional<T>() : Converter<T>::convert(state, value, configuration);
+}
+
template<typename T> inline EnableIfFloatingPointType<T> convert(JSC::ExecState& state, JSC::JSValue value, ShouldAllowNonFinite allow)
{
return Converter<T>::convert(state, value, allow);
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (207057 => 207058)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-10-11 07:11:40 UTC (rev 207058)
@@ -974,22 +974,25 @@
{
my ($interface, $member) = @_;
- my $value = $member->default;
+ my $defaultValue = $member->default;
if ($codeGenerator->IsEnumType($member->type)) {
# FIXME: Would be nice to report an error if the value does not have quote marks around it.
# FIXME: Would be nice to report an error if the value is not one of the enumeration values.
my $className = GetEnumerationClassName($member->type, $interface);
- my $enumerationValueName = GetEnumerationValueName(substr($value, 1, -1));
- $value = $className . "::" . $enumerationValueName;
+ my $enumerationValueName = GetEnumerationValueName(substr($defaultValue, 1, -1));
+ return $className . "::" . $enumerationValueName;
}
- if ($value eq "null") {
- $value = $member->type eq "any" ? "jsNull()" : "nullptr";
+ if ($defaultValue eq "null") {
+ return "jsNull()" if $member->type eq "any";
+ return "nullptr" if $codeGenerator->IsWrapperType($member->type);
+ return "String()" if $codeGenerator->IsStringType($member->type);
+ return "Nullopt";
}
- $value = "{ }" if $value eq "[]";
- $value = "jsUndefined()" if $value eq "undefined";
+ return "{ }" if $defaultValue eq "[]";
+ return "jsUndefined()" if $defaultValue eq "undefined";
- return $value;
+ return $defaultValue;
}
sub ShouldAllowNonFiniteForFloatingPointType
@@ -1131,7 +1134,8 @@
$result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
} else {
my $conversionRuleWithLeadingComma = GenerateConversionRuleWithLeadingComma($interface, $member);
- $result .= " result.$key = convert<${nativeType}>(state, ${key}Value${conversionRuleWithLeadingComma});\n";
+ my $convertFunction = $member->isNullable ? "convertNullable" : "convert";
+ $result .= " result.$key = $convertFunction<${nativeType}>(state, ${key}Value${conversionRuleWithLeadingComma});\n";
$result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
}
# Value is undefined.
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (207057 => 207058)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-11 07:11:40 UTC (rev 207058)
@@ -550,6 +550,12 @@
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
result.largeIntegerWithDefault = 0;
+ JSValue nullableIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableIntegerWithDefault"));
+ if (!nullableIntegerWithDefaultValue.isUndefined()) {
+ result.nullableIntegerWithDefault = convertNullable<int32_t>(state, nullableIntegerWithDefaultValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ result.nullableIntegerWithDefault = Nullopt;
JSValue nullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableNode"));
if (!nullableNodeValue.isUndefined()) {
result.nullableNode = convertWrapperType<Node, JSNode>(state, nullableNodeValue, IsNullable::Yes);
@@ -556,6 +562,12 @@
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
result.nullableNode = nullptr;
+ JSValue nullableStringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableStringWithDefault"));
+ if (!nullableStringWithDefaultValue.isUndefined()) {
+ result.nullableStringWithDefault = convertNullable<String>(state, nullableStringWithDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ result.nullableStringWithDefault = String();
JSValue restrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDouble"));
if (!restrictedDoubleValue.isUndefined()) {
result.restrictedDouble = convert<double>(state, restrictedDoubleValue, ShouldAllowNonFinite::No);
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (207057 => 207058)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-10-11 07:09:54 UTC (rev 207057)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-10-11 07:11:40 UTC (rev 207058)
@@ -433,6 +433,7 @@
TestEnumType enumerationValueWithEmptyStringDefault = "";
DOMString stringWithDefault = "defaultString";
DOMString stringWithoutDefault;
+ DOMString? nullableStringWithDefault = null;
boolean booleanWithDefault = false;
boolean booleanWithoutDefault;
sequence<DOMString> sequenceOfStrings;
@@ -456,6 +457,7 @@
long long largeIntegerWithDefault = 0;
unsigned long long unsignedLargeInteger;
unsigned long long unsignedLargeIntegerWithDefault = 0;
+ long? nullableIntegerWithDefault = null;
Node? nullableNode = null;
any anyValue;
any anyValueWithNullDefault = null;