IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 05:16:00 +0000 (05:16 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 05:16:00 +0000 (05:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163916

Reviewed by Darin Adler.

Source/WebCore:

IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter:
- https://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabase
- https://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStoreParameters

Align our IDL with the specification.

No new tests, no expected Web-exposed behavior change.

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::createObjectStore):
* Modules/indexeddb/IDBDatabase.h:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBKeyPath.cpp:
(WebCore::IDBKeyPath::IDBKeyPath):
* Modules/indexeddb/IDBKeyPath.h:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::idbKeyPathFromValue): Deleted.
* bindings/js/IDBBindingUtilities.h:
* bindings/js/JSIDBDatabaseCustom.cpp: Removed.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
(GenerateConstructorDefinition):
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::MessageEvent):
(WebCore::MessageEvent::create):
* dom/MessageEvent.h:
* testing/TypeConversions.h:
(WebCore::TypeConversions::setTypeConversionsDictionary):

LayoutTests:

Rebaseline existing tests now that the exception messages differ slightly.

* storage/indexeddb/create-object-store-options-expected.txt:
* storage/indexeddb/create-object-store-options-private-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207806 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/create-object-store-options-expected.txt
LayoutTests/storage/indexeddb/create-object-store-options-private-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBDatabase.h
Source/WebCore/Modules/indexeddb/IDBDatabase.idl
Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp
Source/WebCore/Modules/indexeddb/IDBKeyPath.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/IDBBindingUtilities.cpp
Source/WebCore/bindings/js/IDBBindingUtilities.h
Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp [deleted file]
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/dom/MessageEvent.cpp
Source/WebCore/dom/MessageEvent.h
Source/WebCore/testing/TypeConversions.h

index c70af9d..bdbea74 100644 (file)
@@ -1,3 +1,15 @@
+2016-10-24  Chris Dumez  <cdumez@apple.com>
+
+        IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter
+        https://bugs.webkit.org/show_bug.cgi?id=163916
+
+        Reviewed by Darin Adler.
+
+        Rebaseline existing tests now that the exception messages differ slightly.
+
+        * storage/indexeddb/create-object-store-options-expected.txt:
+        * storage/indexeddb/create-object-store-options-private-expected.txt:
+
 2016-10-24  Alex Christensen  <achristensen@webkit.org>
 
         URLParser should match old URL::parse with %2E in path
index f5b2e52..4cf7918 100644 (file)
@@ -15,10 +15,10 @@ PASS trans.mode is "readwrite"
 trans.objectStore('a').put({'a': 0})
 Expecting TypeError exception from db.createObjectStore('d', 'bar');
 PASS Exception was thrown.
-PASS db.createObjectStore('d', 'bar'); threw TypeError: Not an object.
+PASS db.createObjectStore('d', 'bar'); threw TypeError: Type error
 Expecting TypeError exception from db.createObjectStore('e', false);
 PASS Exception was thrown.
-PASS db.createObjectStore('e', false); threw TypeError: Not an object.
+PASS db.createObjectStore('e', false); threw TypeError: Type error
 trans.objectStore('b').put({'a': 0}, 0)
 trans.objectStore('a').get(0)
 PASS event.target.result.a is {a: 0}
index f5b2e52..4cf7918 100644 (file)
@@ -15,10 +15,10 @@ PASS trans.mode is "readwrite"
 trans.objectStore('a').put({'a': 0})
 Expecting TypeError exception from db.createObjectStore('d', 'bar');
 PASS Exception was thrown.
-PASS db.createObjectStore('d', 'bar'); threw TypeError: Not an object.
+PASS db.createObjectStore('d', 'bar'); threw TypeError: Type error
 Expecting TypeError exception from db.createObjectStore('e', false);
 PASS Exception was thrown.
-PASS db.createObjectStore('e', false); threw TypeError: Not an object.
+PASS db.createObjectStore('e', false); threw TypeError: Type error
 trans.objectStore('b').put({'a': 0}, 0)
 trans.objectStore('a').get(0)
 PASS event.target.result.a is {a: 0}
index 078e145..360f4a9 100644 (file)
@@ -1146,7 +1146,6 @@ set(WebCore_SOURCES
     bindings/js/JSHistoryCustom.cpp
     bindings/js/JSIDBCursorCustom.cpp
     bindings/js/JSIDBCursorWithValueCustom.cpp
-    bindings/js/JSIDBDatabaseCustom.cpp
     bindings/js/JSIDBIndexCustom.cpp
     bindings/js/JSIDBObjectStoreCustom.cpp
     bindings/js/JSIDBRequestCustom.cpp
index 8aefc5d..677b037 100644 (file)
@@ -1,3 +1,40 @@
+2016-10-24  Chris Dumez  <cdumez@apple.com>
+
+        IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter
+        https://bugs.webkit.org/show_bug.cgi?id=163916
+
+        Reviewed by Darin Adler.
+
+        IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter:
+        - https://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabase
+        - https://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStoreParameters
+
+        Align our IDL with the specification.
+
+        No new tests, no expected Web-exposed behavior change.
+
+        * Modules/indexeddb/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::createObjectStore):
+        * Modules/indexeddb/IDBDatabase.h:
+        * Modules/indexeddb/IDBDatabase.idl:
+        * Modules/indexeddb/IDBKeyPath.cpp:
+        (WebCore::IDBKeyPath::IDBKeyPath):
+        * Modules/indexeddb/IDBKeyPath.h:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/IDBBindingUtilities.cpp:
+        (WebCore::idbKeyPathFromValue): Deleted.
+        * bindings/js/IDBBindingUtilities.h:
+        * bindings/js/JSIDBDatabaseCustom.cpp: Removed.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheck):
+        (GenerateConstructorDefinition):
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::MessageEvent):
+        (WebCore::MessageEvent::create):
+        * dom/MessageEvent.h:
+        * testing/TypeConversions.h:
+        (WebCore::TypeConversions::setTypeConversionsDictionary):
+
 2016-10-24  Alex Christensen  <achristensen@webkit.org>
 
         URLParser should match old URL::parse with %2E in path
index 7e7a76a..9e0d288 100644 (file)
@@ -130,13 +130,7 @@ void IDBDatabase::renameIndex(IDBIndex& index, const String& newName)
     m_versionChangeTransaction->renameIndex(index, newName);
 }
 
-ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String&, const Dictionary&)
-{
-    ASSERT_NOT_REACHED();
-    return Exception { IDBDatabaseException::InvalidStateError };
-}
-
-ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
+ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String& name, ObjectStoreParameters&& parameters)
 {
     LOG(IndexedDB, "IDBDatabase::createObjectStore - (%s %s)", m_info.name().utf8().data(), name.utf8().data());
 
@@ -152,14 +146,15 @@ ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String& na
     if (m_info.hasObjectStore(name))
         return Exception { IDBDatabaseException::ConstraintError, ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': An object store with the specified name already exists.") };
 
+    IDBKeyPath keyPath(WTFMove(parameters.keyPath));
     if (!keyPath.isNull() && !keyPath.isValid())
         return Exception { IDBDatabaseException::SyntaxError, ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The keyPath option is not a valid key path.") };
 
-    if (autoIncrement && ((keyPath.type() == IDBKeyPath::Type::String && keyPath.string().isEmpty()) || keyPath.type() == IDBKeyPath::Type::Array))
+    if (parameters.autoIncrement && ((keyPath.type() == IDBKeyPath::Type::String && keyPath.string().isEmpty()) || keyPath.type() == IDBKeyPath::Type::Array))
         return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.") };
 
     // Install the new ObjectStore into the connection's metadata.
-    auto info = m_info.createNewObjectStore(name, keyPath, autoIncrement);
+    auto info = m_info.createNewObjectStore(name, keyPath, parameters.autoIncrement);
 
     // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
     return m_versionChangeTransaction->createObjectStore(info);
index 651c2a9..0b40761 100644 (file)
@@ -34,6 +34,7 @@
 #include "IDBConnectionProxy.h"
 #include "IDBConnectionToServer.h"
 #include "IDBDatabaseInfo.h"
+#include "IDBKeyPath.h"
 
 namespace WebCore {
 
@@ -55,8 +56,13 @@ public:
     uint64_t version() const;
     RefPtr<DOMStringList> objectStoreNames() const;
 
-    ExceptionOr<Ref<IDBObjectStore>> createObjectStore(const String& name, const Dictionary&);
-    ExceptionOr<Ref<IDBObjectStore>> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement);
+    struct ObjectStoreParameters {
+        Optional<IDBKeyPathVariant> keyPath;
+        bool autoIncrement;
+    };
+
+    ExceptionOr<Ref<IDBObjectStore>> createObjectStore(const String& name, ObjectStoreParameters&&);
+
     ExceptionOr<Ref<IDBTransaction>> transaction(const Vector<String>&, const String& mode);
     ExceptionOr<Ref<IDBTransaction>> transaction(const String&, const String& mode);
     ExceptionOr<void> deleteObjectStore(const String& name);
index 5a9a393..85d2ab2 100644 (file)
@@ -34,7 +34,7 @@
     readonly attribute unsigned long long version;
     readonly attribute DOMStringList objectStoreNames;
 
-    [Custom, MayThrowException] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options);
+    [MayThrowException] IDBObjectStore createObjectStore(DOMString name, optional IDBObjectStoreParameters parameters);
     [MayThrowException] void deleteObjectStore(DOMString name);
     [MayThrowException] IDBTransaction transaction(DOMString storeName, optional DOMString mode = "readonly");
     [MayThrowException] IDBTransaction transaction(sequence<DOMString> storeNames, optional DOMString mode = "readonly");
@@ -47,3 +47,8 @@
     attribute EventHandler onerror;
     attribute EventHandler onversionchange;
 };
+
+dictionary IDBObjectStoreParameters {
+    (DOMString or sequence<DOMString>)? keyPath = null;
+    boolean autoIncrement = false;
+};
index 02f83ab..926f89d 100644 (file)
@@ -208,6 +208,20 @@ IDBKeyPath::IDBKeyPath(const Vector<String>& array)
 #endif
 }
 
+IDBKeyPath::IDBKeyPath(Optional<IDBKeyPathVariant>&& variant)
+{
+    if (!variant)
+        return;
+
+    if (WTF::holds_alternative<String>(*variant)) {
+        m_type = Type::String;
+        m_string = WTFMove(WTF::get<String>(*variant));
+    } else {
+        m_type = Type::Array;
+        m_array = WTFMove(WTF::get<Vector<String>>(*variant));
+    }
+}
+
 bool IDBKeyPath::isValid() const
 {
     switch (m_type) {
index 64ad864..d6a21d6 100644 (file)
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include <wtf/Variant.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
+using IDBKeyPathVariant = WTF::Variant<String, Vector<String>>;
+
 class KeyedDecoder;
 class KeyedEncoder;
 
@@ -44,11 +47,13 @@ enum class IDBKeyPathParseError {
 
 void IDBParseKeyPath(const String&, Vector<String>&, IDBKeyPathParseError&);
 
+// FIXME: We should be able to replace IDBKeyPath with IDBKeyPathVariant.
 class IDBKeyPath {
 public:
     IDBKeyPath() { }
     WEBCORE_EXPORT IDBKeyPath(const String&);
     WEBCORE_EXPORT IDBKeyPath(const Vector<String>& array);
+    WEBCORE_EXPORT IDBKeyPath(Optional<IDBKeyPathVariant>&&);
 
     enum class Type { Null, String, Array };
     Type type() const { return m_type; }
index dd67ba7..f940797 100644 (file)
                415071581685067300C3C7B3 /* SelectorFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 415071561685067300C3C7B3 /* SelectorFilter.h */; };
                4150F9F112B6E0E70008C860 /* SliderThumbElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */; };
                4150F9F212B6E0E70008C860 /* SliderThumbElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */; };
+               415670471DBE1533009AC3BB /* PeerConnectionStates.h in Headers */ = {isa = PBXBuildFile; fileRef = 415670461DBE1524009AC3BB /* PeerConnectionStates.h */; };
                4157AF8012F1FB0400A8C6F5 /* MediaControlsApple.h in Headers */ = {isa = PBXBuildFile; fileRef = 4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */; };
                4157AF8112F1FB0400A8C6F5 /* MediaControlsApple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */; };
-               415670471DBE1533009AC3BB /* PeerConnectionStates.h in Headers */ = {isa = PBXBuildFile; fileRef = 415670461DBE1524009AC3BB /* PeerConnectionStates.h */; };
                41614A781DA6423B004AD06F /* HTTPHeaderValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41614A761DA64236004AD06F /* HTTPHeaderValues.cpp */; };
                41614A791DA64241004AD06F /* HTTPHeaderValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 41614A771DA64236004AD06F /* HTTPHeaderValues.h */; };
                4162A450101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A44D101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp */; };
                511EF2C917F0FD3500E4FA16 /* JSIDBRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2B317F0FC4800E4FA16 /* JSIDBRequest.cpp */; };
                511EF2CA17F0FD3500E4FA16 /* JSIDBTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2B417F0FC4800E4FA16 /* JSIDBTransaction.cpp */; };
                511EF2CB17F0FD3500E4FA16 /* JSIDBVersionChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 269239911505E1AA009E57FC /* JSIDBVersionChangeEvent.cpp */; };
-               511EF2D017F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2CD17F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp */; };
                511EF2D117F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2CE17F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp */; };
                5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */; };
                5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                415071561685067300C3C7B3 /* SelectorFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorFilter.h; sourceTree = "<group>"; };
                4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderThumbElement.h; sourceTree = "<group>"; };
                4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SliderThumbElement.cpp; sourceTree = "<group>"; };
+               415670461DBE1524009AC3BB /* PeerConnectionStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeerConnectionStates.h; sourceTree = "<group>"; };
                4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlsApple.h; sourceTree = "<group>"; };
                4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlsApple.cpp; sourceTree = "<group>"; };
-               415670461DBE1524009AC3BB /* PeerConnectionStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeerConnectionStates.h; sourceTree = "<group>"; };
                41614A761DA64236004AD06F /* HTTPHeaderValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderValues.cpp; sourceTree = "<group>"; };
                41614A771DA64236004AD06F /* HTTPHeaderValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPHeaderValues.h; sourceTree = "<group>"; };
                4162A44D101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorkerGlobalScope.cpp; sourceTree = "<group>"; };
                511EF2B217F0FC4800E4FA16 /* JSIDBOpenDBRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSIDBOpenDBRequest.h; sourceTree = "<group>"; };
                511EF2B317F0FC4800E4FA16 /* JSIDBRequest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBRequest.cpp; sourceTree = "<group>"; };
                511EF2B417F0FC4800E4FA16 /* JSIDBTransaction.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransaction.cpp; sourceTree = "<group>"; };
-               511EF2CD17F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBDatabaseCustom.cpp; sourceTree = "<group>"; };
                511EF2CE17F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBObjectStoreCustom.cpp; sourceTree = "<group>"; };
                511FAEA91BDC989A00B4AFE4 /* ThreadSafeDataBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSafeDataBuffer.h; sourceTree = "<group>"; };
                5123AF161890A4CA0031CDC9 /* IDBKeyRangeData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBKeyRangeData.cpp; sourceTree = "<group>"; };
                                D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
                                512BDB4C1C46B0FF006494DF /* JSIDBCursorCustom.cpp */,
                                5141298D1C5FD7E90059E714 /* JSIDBCursorWithValueCustom.cpp */,
-                               511EF2CD17F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp */,
                                5141299A1C6C166D0059E714 /* JSIDBIndexCustom.cpp */,
                                511EF2CE17F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp */,
                                934F31B41CC0737200DB43DC /* JSIDBRequestCustom.cpp */,
                                511EF2C217F0FD3500E4FA16 /* JSIDBCursorWithValue.cpp in Sources */,
                                5141298E1C5FD83A0059E714 /* JSIDBCursorWithValueCustom.cpp in Sources */,
                                511EF2C317F0FD3500E4FA16 /* JSIDBDatabase.cpp in Sources */,
-                               511EF2D017F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp in Sources */,
                                511EF2C417F0FD3500E4FA16 /* JSIDBFactory.cpp in Sources */,
                                511EF2C517F0FD3500E4FA16 /* JSIDBIndex.cpp in Sources */,
                                5141299B1C6C16740059E714 /* JSIDBIndexCustom.cpp in Sources */,
index 7d49187..b63ef3c 100644 (file)
@@ -176,16 +176,6 @@ static Ref<IDBKey> createIDBKeyFromValue(ExecState& exec, JSValue value)
     return IDBKey::createInvalid();
 }
 
-IDBKeyPath idbKeyPathFromValue(ExecState& exec, JSValue keyPathValue)
-{
-    IDBKeyPath keyPath;
-    if (isJSArray(keyPathValue))
-        keyPath = IDBKeyPath(convert<IDLSequence<IDLDOMString>>(exec, keyPathValue));
-    else
-        keyPath = IDBKeyPath(keyPathValue.toWTFString(&exec));
-    return keyPath;
-}
-
 static JSValue getNthValueOnKeyPath(ExecState& exec, JSValue rootValue, const Vector<String>& keyPathElements, size_t index)
 {
     JSValue currentValue(rootValue);
index 31ce8e0..aa4f5c3 100644 (file)
@@ -47,7 +47,6 @@ class IndexKey;
 class JSDOMGlobalObject;
 class ThreadSafeDataBuffer;
 
-IDBKeyPath idbKeyPathFromValue(JSC::ExecState&, JSC::JSValue);
 JSC::JSValue toJS(JSC::ExecState&, JSDOMGlobalObject&, const IDBKeyPath&);
 
 RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&);
diff --git a/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp b/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp
deleted file mode 100644 (file)
index 626ac2f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2012 Michael Pruett <michael@68k.org>
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "JSIDBDatabase.h"
-
-#include "IDBBindingUtilities.h"
-#include "IDBDatabase.h"
-#include "IDBKeyPath.h"
-#include "IDBObjectStore.h"
-#include "JSDOMBinding.h"
-#include "JSDOMStringList.h"
-#include "JSIDBObjectStore.h"
-#include <runtime/Error.h>
-#include <runtime/JSString.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSIDBDatabase::createObjectStore(ExecState& state)
-{
-    VM& vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    if (state.argumentCount() < 1)
-        return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
-    String name = state.argument(0).toString(&state)->value(&state);
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    JSValue optionsValue = state.argument(1);
-    if (!optionsValue.isUndefinedOrNull() && !optionsValue.isObject())
-        return throwTypeError(&state, scope, ASCIILiteral("Not an object."));
-
-    IDBKeyPath keyPath;
-    bool autoIncrement = false;
-    if (!optionsValue.isUndefinedOrNull()) {
-        JSValue keyPathValue = optionsValue.get(&state, Identifier::fromString(&state, "keyPath"));
-        RETURN_IF_EXCEPTION(scope, JSValue());
-
-        if (!keyPathValue.isUndefinedOrNull()) {
-            keyPath = idbKeyPathFromValue(state, keyPathValue);
-            RETURN_IF_EXCEPTION(scope, JSValue());
-        }
-
-        autoIncrement = optionsValue.get(&state, Identifier::fromString(&state, "autoIncrement")).toBoolean(&state);
-        RETURN_IF_EXCEPTION(scope, JSValue());
-    }
-
-    return toJS(state, *globalObject(), scope, wrapped().createObjectStore(name, keyPath, autoIncrement));
-}
-
-}
-
-#endif
index f4d5f1c..83b265a 100644 (file)
@@ -4428,7 +4428,7 @@ sub GenerateParametersCheck
             if ($codeGenerator->IsTypedArrayType($type) and $parameter->type ne "ArrayBuffer") {
                $value = $shouldPassByReference ? "$name.releaseNonNull()" : "WTFMove($name)";
             } elsif ($codeGenerator->IsDictionaryType($type)) {
-                $value = "${name}";
+                $value = "WTFMove($name)";
             }
         }
 
@@ -5866,8 +5866,6 @@ sub GenerateConstructorDefinition
                 last if $index eq $paramIndex;
                 if (ShouldPassWrapperByReference($parameter, $interface)) {
                     push(@constructorArgList, "*" . $parameter->name);
-                } elsif ($codeGenerator->IsDictionaryType($parameter->type)) {
-                    push(@constructorArgList, $parameter->name);
                 } else {
                     push(@constructorArgList, "WTFMove(" . $parameter->name . ")");
                 }
index f37aff4..657532a 100644 (file)
@@ -129,7 +129,7 @@ template<> EncodedJSValue JSC_HOST_CALL JSTestEventConstructorConstructor::const
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto eventInitDict = convert<IDLDictionary<TestEventConstructor::Init>>(*state, state->argument(1));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    auto object = TestEventConstructor::create(WTFMove(type), eventInitDict);
+    auto object = TestEventConstructor::create(WTFMove(type), WTFMove(eventInitDict));
     return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
 }
 
index bc61b23..25f868e 100644 (file)
@@ -8177,7 +8177,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionAttachShadowRootCall
         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto init = convert<IDLDictionary<TestObj::Dictionary>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    impl.attachShadowRoot(init);
+    impl.attachShadowRoot(WTFMove(init));
     return JSValue::encode(jsUndefined());
 }
 
@@ -8197,7 +8197,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOperationWithExterna
         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto dict = convert<IDLDictionary<DictionaryImplName>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    impl.operationWithExternalDictionaryParameter(dict);
+    impl.operationWithExternalDictionaryParameter(WTFMove(dict));
     return JSValue::encode(jsUndefined());
 }
 
index 4e34ea6..713d73d 100644 (file)
@@ -41,7 +41,7 @@ inline MessageEvent::MessageEvent()
 {
 }
 
-inline MessageEvent::MessageEvent(ExecState& state, const AtomicString& type, Init& initializer, IsTrusted isTrusted)
+inline MessageEvent::MessageEvent(ExecState& state, const AtomicString& type, Init&& initializer, IsTrusted isTrusted)
     : Event(type, initializer, isTrusted)
     , m_dataType(DataTypeScriptValue)
     , m_dataAsScriptValue(state.vm(), initializer.data)
@@ -126,9 +126,9 @@ Ref<MessageEvent> MessageEvent::createForBindings()
     return adoptRef(*new MessageEvent);
 }
 
-Ref<MessageEvent> MessageEvent::create(ExecState& state, const AtomicString& type, Init& initializer, IsTrusted isTrusted)
+Ref<MessageEvent> MessageEvent::create(ExecState& state, const AtomicString& type, Init&& initializer, IsTrusted isTrusted)
 {
-    return adoptRef(*new MessageEvent(state, type, initializer, isTrusted));
+    return adoptRef(*new MessageEvent(state, type, WTFMove(initializer), isTrusted));
 }
 
 MessageEvent::~MessageEvent()
index 8535ee3..4e694d4 100644 (file)
@@ -56,7 +56,7 @@ public:
         Optional<MessageEventSource> source;
         Vector<RefPtr<MessagePort>> ports;
     };
-    static Ref<MessageEvent> create(JSC::ExecState&, const AtomicString& type, Init&, IsTrusted = IsTrusted::No);
+    static Ref<MessageEvent> create(JSC::ExecState&, const AtomicString& type, Init&&, IsTrusted = IsTrusted::No);
 
     virtual ~MessageEvent();
 
@@ -91,7 +91,7 @@ public:
     
 private:
     MessageEvent();
-    MessageEvent(JSC::ExecState&, const AtomicString&, Init&, IsTrusted);
+    MessageEvent(JSC::ExecState&, const AtomicString&, Init&&, IsTrusted);
     MessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, Optional<MessageEventSource>&&, Vector<RefPtr<MessagePort>>&&);
     MessageEvent(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId);
     MessageEvent(const String& data, const String& origin);
index 7ef5690..2a45bf4 100644 (file)
@@ -104,12 +104,12 @@ public:
     const TestUnion& testUnion() const { return m_union; }
     void setTestUnion(const TestUnion& value) { m_union = value; }
 
-    void setTypeConversionsDictionary(Dictionary& dictionary)
+    void setTypeConversionsDictionary(Dictionary&& dictionary)
     {
         m_typeConversionsDictionaryLongValue = dictionary.longValue;
-        m_typeConversionsDictionaryStringValue = dictionary.stringValue;
-        m_typeConversionsDictionarySequenceValue = dictionary.sequenceValue;
-        m_typeConversionsDictionaryUnionValue = dictionary.unionValue;
+        m_typeConversionsDictionaryStringValue = WTFMove(dictionary.stringValue);
+        m_typeConversionsDictionarySequenceValue = WTFMove(dictionary.sequenceValue);
+        m_typeConversionsDictionaryUnionValue = WTFMove(dictionary.unionValue);
     }
 
     int typeConversionsDictionaryLongValue() { return m_typeConversionsDictionaryLongValue; }