Have window.indexedDB.deleteDatabase return an IDBOpenDBRequest.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Sep 2015 20:45:01 +0000 (20:45 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Sep 2015 20:45:01 +0000 (20:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149229

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/deletedatabase-request.html
      storage/indexeddb/modern/deletedatabase-null-name-exception.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBDatabaseIdentifier.cpp: Added.
(WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
* Modules/indexeddb/IDBDatabaseIdentifier.h: Added.
(WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
(WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue):
(WebCore::IDBDatabaseIdentifier::hash):
(WebCore::IDBDatabaseIdentifier::isValid):
(WebCore::IDBDatabaseIdentifier::operator==):
(WebCore::IDBDatabaseIdentifier::databaseName):
(WebCore::IDBDatabaseIdentifierHash::hash):
(WebCore::IDBDatabaseIdentifierHash::equal):
(WebCore::IDBDatabaseIdentifierHashTraits::isEmptyValue):

* Modules/indexeddb/client/IDBFactoryImpl.cpp:
(WebCore::IDBClient::shouldThrowSecurityException):
(WebCore::IDBClient::IDBFactory::getDatabaseNames):
(WebCore::IDBClient::IDBFactory::open):
(WebCore::IDBClient::IDBFactory::deleteDatabase):
* Modules/indexeddb/client/IDBFactoryImpl.h:

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp.
(WebCore::IDBClient::IDBOpenDBRequest::IDBOpenDBRequest):
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp.
(WebCore::IDBClient::IDBOpenDBRequest::create):

* Modules/indexeddb/client/IDBRequestImpl.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp.
(WebCore::IDBClient::IDBRequest::IDBRequest):
(WebCore::IDBClient::IDBRequest::result):
(WebCore::IDBClient::IDBRequest::errorCode):
(WebCore::IDBClient::IDBRequest::error):
(WebCore::IDBClient::IDBRequest::source):
(WebCore::IDBClient::IDBRequest::transaction):
(WebCore::IDBClient::IDBRequest::readyState):
(WebCore::IDBClient::IDBRequest::eventTargetInterface):
(WebCore::IDBClient::IDBRequest::activeDOMObjectName):
(WebCore::IDBClient::IDBRequest::canSuspendForPageCache):
* Modules/indexeddb/client/IDBRequestImpl.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h.

* platform/Logging.h:

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]): Enable IDB in WK1.

LayoutTests:

* platform/mac-wk1/TestExpectations:
* platform/wk2/TestExpectations:
* storage/indexeddb/modern/deletedatabase-null-name-exception-expected.txt: Added.
* storage/indexeddb/modern/deletedatabase-null-name-exception.html: Added.
* storage/indexeddb/modern/deletedatabase-request-expected.txt: Added.
* storage/indexeddb/modern/deletedatabase-request.html: Added.

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/wk2/TestExpectations
LayoutTests/storage/indexeddb/modern/deletedatabase-null-name-exception-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/deletedatabase-null-name-exception.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/deletedatabase-request-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/deletedatabase-request.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h
Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/Logging.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm

index 6ce1bba..b8156bc 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-16  Brady Eidson  <beidson@apple.com>
+
+        Have window.indexedDB.deleteDatabase return an IDBOpenDBRequest.
+        https://bugs.webkit.org/show_bug.cgi?id=149229
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+        * platform/wk2/TestExpectations:
+        * storage/indexeddb/modern/deletedatabase-null-name-exception-expected.txt: Added.
+        * storage/indexeddb/modern/deletedatabase-null-name-exception.html: Added.
+        * storage/indexeddb/modern/deletedatabase-request-expected.txt: Added.
+        * storage/indexeddb/modern/deletedatabase-request.html: Added.
+
 2015-09-16  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, drop dom/xhtml/level3/core/nodegetbaseuri03.xhtml test.
index 67e2d50..7fa7036 100644 (file)
@@ -54,7 +54,7 @@ webkit.org/b/146622 [ Yosemite Debug ] webgl/1.0.2/conformance/more/functions/co
 ########################################
 ### START OF (2) Failures without bug reports
 
-# IndexedDB is not yet enabled in Mac WK1
+# Legacy IndexedDB will never be enabled in Mac WK1.
 storage/indexeddb
 imported/w3c/indexeddb
 fast/history/page-cache-indexed-closed-db.html
@@ -68,8 +68,8 @@ crypto/subtle/rsa-indexeddb.html
 crypto/subtle/rsa-indexeddb-non-exportable.html
 inspector/indexeddb
 
-# But since it is disabled at runtime, we should make sure it is correctly disabled
-storage/indexeddb/properties-disabled-at-runtime.html [ Pass ]
+# But Modern IndexedDB is.
+storage/indexeddb/modern [ Pass ]
 
 # Fails with WebKit1 only.
 editing/secure-input/reset-state-on-navigation.html [ Failure ]
index f6bcd62..fca18ef 100644 (file)
@@ -579,6 +579,9 @@ imported/w3c/indexeddb/idbobjectstore_deleteIndex.htm [ Pass Failure ]
 imported/w3c/indexeddb/idbcursor-direction.htm [ Pass Failure ]
 imported/w3c/indexeddb/idbcursor-key.htm [ Pass Failure ]
 
+# Don't run Modern IDB tests while the feature is under development
+storage/indexeddb/modern [ Skip ]
+
 ### END OF (3) Unclassified failures
 ########################################
 
diff --git a/LayoutTests/storage/indexeddb/modern/deletedatabase-null-name-exception-expected.txt b/LayoutTests/storage/indexeddb/modern/deletedatabase-null-name-exception-expected.txt
new file mode 100644 (file)
index 0000000..c124ea8
--- /dev/null
@@ -0,0 +1,3 @@
+ALERT: TypeError: Not enough arguments
+ALERT: Done
+This test calls deleteDatabase on window.indexedDB with a null database name, making sure there is an exception.
diff --git a/LayoutTests/storage/indexeddb/modern/deletedatabase-null-name-exception.html b/LayoutTests/storage/indexeddb/modern/deletedatabase-null-name-exception.html
new file mode 100644 (file)
index 0000000..76f9ddb
--- /dev/null
@@ -0,0 +1,23 @@
+This test calls deleteDatabase on window.indexedDB with a null database name, making sure there is an exception.
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+try {
+       var request = window.indexedDB.deleteDatabase();
+} catch (e) {
+       alert(e);
+}
+
+done();
+</script>
diff --git a/LayoutTests/storage/indexeddb/modern/deletedatabase-request-expected.txt b/LayoutTests/storage/indexeddb/modern/deletedatabase-request-expected.txt
new file mode 100644 (file)
index 0000000..5c6fecb
--- /dev/null
@@ -0,0 +1,3 @@
+ALERT: [object IDBOpenDBRequest]
+ALERT: Done
+This test calls deleteDatabase on window.indexedDB and verifies that an IDBOpenDBRequest object is returned.
diff --git a/LayoutTests/storage/indexeddb/modern/deletedatabase-request.html b/LayoutTests/storage/indexeddb/modern/deletedatabase-request.html
new file mode 100644 (file)
index 0000000..b10355a
--- /dev/null
@@ -0,0 +1,20 @@
+This test calls deleteDatabase on window.indexedDB and verifies that an IDBOpenDBRequest object is returned.
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var request = window.indexedDB.deleteDatabase("TestDatabase");
+alert(request);
+
+done();
+</script>
index ef16b7e..133de4c 100644 (file)
@@ -850,6 +850,7 @@ set(WebCore_SOURCES
     Modules/indexeddb/IDBCursorWithValue.cpp
     Modules/indexeddb/IDBDatabase.cpp
     Modules/indexeddb/IDBDatabaseException.cpp
+    Modules/indexeddb/IDBDatabaseIdentifier.cpp
     Modules/indexeddb/IDBDatabaseMetadata.cpp
     Modules/indexeddb/IDBEventDispatcher.cpp
     Modules/indexeddb/IDBFactory.cpp
@@ -867,6 +868,8 @@ set(WebCore_SOURCES
     Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
 
     Modules/indexeddb/client/IDBFactoryImpl.cpp
+    Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp
+    Modules/indexeddb/client/IDBRequestImpl.cpp
 
     Modules/indexeddb/legacy/IDBCursorBackend.cpp
     Modules/indexeddb/legacy/IDBCursorBackendOperations.cpp
index 3d705a5..e573602 100644 (file)
@@ -1,3 +1,56 @@
+2015-09-16  Brady Eidson  <beidson@apple.com>
+
+        Have window.indexedDB.deleteDatabase return an IDBOpenDBRequest.
+        https://bugs.webkit.org/show_bug.cgi?id=149229
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/deletedatabase-request.html
+              storage/indexeddb/modern/deletedatabase-null-name-exception.html
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * Modules/indexeddb/IDBDatabaseIdentifier.cpp: Added.
+        (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
+        * Modules/indexeddb/IDBDatabaseIdentifier.h: Added.
+        (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
+        (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue):
+        (WebCore::IDBDatabaseIdentifier::hash):
+        (WebCore::IDBDatabaseIdentifier::isValid):
+        (WebCore::IDBDatabaseIdentifier::operator==):
+        (WebCore::IDBDatabaseIdentifier::databaseName):
+        (WebCore::IDBDatabaseIdentifierHash::hash):
+        (WebCore::IDBDatabaseIdentifierHash::equal):
+        (WebCore::IDBDatabaseIdentifierHashTraits::isEmptyValue):
+
+        * Modules/indexeddb/client/IDBFactoryImpl.cpp:
+        (WebCore::IDBClient::shouldThrowSecurityException):
+        (WebCore::IDBClient::IDBFactory::getDatabaseNames):
+        (WebCore::IDBClient::IDBFactory::open):
+        (WebCore::IDBClient::IDBFactory::deleteDatabase):
+        * Modules/indexeddb/client/IDBFactoryImpl.h:
+
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp.
+        (WebCore::IDBClient::IDBOpenDBRequest::IDBOpenDBRequest):
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp.
+        (WebCore::IDBClient::IDBOpenDBRequest::create):
+
+        * Modules/indexeddb/client/IDBRequestImpl.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp.
+        (WebCore::IDBClient::IDBRequest::IDBRequest):
+        (WebCore::IDBClient::IDBRequest::result):
+        (WebCore::IDBClient::IDBRequest::errorCode):
+        (WebCore::IDBClient::IDBRequest::error):
+        (WebCore::IDBClient::IDBRequest::source):
+        (WebCore::IDBClient::IDBRequest::transaction):
+        (WebCore::IDBClient::IDBRequest::readyState):
+        (WebCore::IDBClient::IDBRequest::eventTargetInterface):
+        (WebCore::IDBClient::IDBRequest::activeDOMObjectName):
+        (WebCore::IDBClient::IDBRequest::canSuspendForPageCache):
+        * Modules/indexeddb/client/IDBRequestImpl.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h.
+
+        * platform/Logging.h:
+
 2015-09-16  Chris Dumez  <cdumez@apple.com>
 
         Add initial support for [Unforgeable] IDL extended attribute
diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp
new file mode 100644 (file)
index 0000000..a0190c1
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. ``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 APPLE INC. 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"
+#include "IDBDatabaseIdentifier.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+IDBDatabaseIdentifier::IDBDatabaseIdentifier(const String& databaseName, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin)
+    : m_databaseName(databaseName)
+    , m_openingOrigin(SecurityOriginData::fromSecurityOrigin(openingOrigin))
+    , m_mainFrameOrigin(SecurityOriginData::fromSecurityOrigin(mainFrameOrigin))
+
+{
+    // The empty string is a valid database name, but a null string is not.
+    ASSERT(!databaseName.isNull());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h
new file mode 100644 (file)
index 0000000..91d50ba
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2015 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. ``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 APPLE INC. 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.
+ */
+
+#ifndef IDBDatabaseIdentifier_h
+#define IDBDatabaseIdentifier_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "SecurityOriginData.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class SecurityOrigin;
+
+class IDBDatabaseIdentifier {
+public:
+    IDBDatabaseIdentifier()
+    {
+    }
+
+    IDBDatabaseIdentifier(WTF::HashTableDeletedValueType)
+    {
+        m_openingOrigin.port = -1;
+        m_mainFrameOrigin.port = -1;
+    }
+
+    bool isHashTableDeletedValue() const
+    {
+        return m_openingOrigin.port == -1 && m_mainFrameOrigin.port == -1;
+    }
+
+    unsigned hash() const
+    {
+        unsigned nameHash = StringHash::hash(m_databaseName);
+        unsigned openingProtocolHash = StringHash::hash(m_openingOrigin.protocol);
+        unsigned openingHostHash = StringHash::hash(m_openingOrigin.host);
+        unsigned mainFrameProtocolHash = StringHash::hash(m_mainFrameOrigin.protocol);
+        unsigned mainFrameHostHash = StringHash::hash(m_mainFrameOrigin.host);
+        
+        unsigned hashCodes[7] = { nameHash, openingProtocolHash, openingHostHash, static_cast<unsigned>(m_openingOrigin.port), mainFrameProtocolHash, mainFrameHostHash, static_cast<unsigned>(m_mainFrameOrigin.port) };
+        return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
+    }
+
+    IDBDatabaseIdentifier(const String& databaseName, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin);
+
+    bool isValid() const
+    {
+        return !m_databaseName.isNull() && m_openingOrigin.port >= 0 && m_mainFrameOrigin.port >= 0;
+    }
+
+    bool operator==(const IDBDatabaseIdentifier& other) const
+    {
+        return other.m_databaseName == m_databaseName
+            && other.m_openingOrigin == m_openingOrigin
+            && other.m_mainFrameOrigin == m_mainFrameOrigin;
+    }
+
+    const String& databaseName() const { return m_databaseName; }
+
+private:
+    String m_databaseName;
+    SecurityOriginData m_openingOrigin;
+    SecurityOriginData m_mainFrameOrigin;
+};
+
+struct IDBDatabaseIdentifierHash {
+    static unsigned hash(const IDBDatabaseIdentifier& a) { return a.hash(); }
+    static bool equal(const IDBDatabaseIdentifier& a, const IDBDatabaseIdentifier& b) { return a == b; }
+    static const bool safeToCompareToEmptyOrDeleted = false;
+};
+
+struct IDBDatabaseIdentifierHashTraits : WTF::SimpleClassHashTraits<IDBDatabaseIdentifier> {
+    static const bool hasIsEmptyValueFunction = true;
+    static bool isEmptyValue(const IDBDatabaseIdentifier& info) { return !info.isValid(); }
+};
+
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct HashTraits<WebCore::IDBDatabaseIdentifier> : WebCore::IDBDatabaseIdentifierHashTraits { };
+template<> struct DefaultHash<WebCore::IDBDatabaseIdentifier> {
+    typedef WebCore::IDBDatabaseIdentifierHash Hash;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBDatabaseIdentifier_h
index b5bc97e..144f1d6 100644 (file)
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "ExceptionCode.h"
+#include "IDBDatabaseIdentifier.h"
+#include "IDBOpenDBRequestImpl.h"
+#include "Logging.h"
+#include "Page.h"
+#include "SchemeRegistry.h"
+#include "SecurityOrigin.h"
+
 namespace WebCore {
 namespace IDBClient {
 
+static bool shouldThrowSecurityException(ScriptExecutionContext* context)
+{
+    ASSERT(is<Document>(*context) || context->isWorkerGlobalScope());
+    if (is<Document>(*context)) {
+        Document& document = downcast<Document>(*context);
+        if (!document.frame())
+            return true;
+        if (!document.page())
+            return true;
+        if (document.page()->usesEphemeralSession() && !SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(document.securityOrigin()->protocol()))
+            return true;
+    }
+
+    if (!context->securityOrigin()->canAccessDatabase(context->topOrigin()))
+        return true;
+
+    return false;
+}
+
 Ref<IDBFactory> IDBFactory::create()
 {
     return adoptRef(*new IDBFactory);
@@ -41,24 +68,45 @@ IDBFactory::IDBFactory()
 
 }
 
-PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext*, ExceptionCode&)
+PassRefPtr<WebCore::IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext*, ExceptionCode&)
 {
     return nullptr;
 }
 
-PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext*, const String&, ExceptionCode&)
+PassRefPtr<WebCore::IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext*, const String&, ExceptionCode&)
 {
     return nullptr;
 }
 
-PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext*, const String&, unsigned long long, ExceptionCode&)
+PassRefPtr<WebCore::IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext*, const String&, unsigned long long, ExceptionCode&)
 {
     return nullptr;
 }
 
-PassRefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ScriptExecutionContext*, const String&, ExceptionCode&)
+PassRefPtr<WebCore::IDBOpenDBRequest> IDBFactory::deleteDatabase(ScriptExecutionContext* context, const String& name, ExceptionCode& ec)
 {
-    return nullptr;
+    LOG(IndexedDB, "IDBFactory::deleteDatabase");
+
+    if (name.isNull()) {
+        ec = TypeError;
+        return nullptr;
+    }
+    
+    if (shouldThrowSecurityException(context)) {
+        ec = SECURITY_ERR;
+        return nullptr;
+    }
+
+    ASSERT(context->securityOrigin());
+    ASSERT(context->topOrigin());
+    IDBDatabaseIdentifier databaseIdentifier(name, *context->securityOrigin(), *context->topOrigin());
+    if (!databaseIdentifier.isValid()) {
+        ec = TypeError;
+        return nullptr;
+    }
+
+    auto request = IDBOpenDBRequest::create(context);
+    return adoptRef(&request.leakRef());
 }
 
 short IDBFactory::cmp(ScriptExecutionContext*, const Deprecated::ScriptValue&, const Deprecated::ScriptValue&, ExceptionCode&)
index 41b50c6..9c709b4 100644 (file)
@@ -37,11 +37,11 @@ class IDBFactory : public WebCore::IDBFactory {
 public:
     static Ref<IDBFactory> create();
 
-    virtual PassRefPtr<IDBRequest> getDatabaseNames(ScriptExecutionContext*, ExceptionCode&) override final;
+    virtual PassRefPtr<WebCore::IDBRequest> getDatabaseNames(ScriptExecutionContext*, ExceptionCode&) override final;
 
-    virtual PassRefPtr<IDBOpenDBRequest> open(ScriptExecutionContext*, const String& name, ExceptionCode&) override final;
-    virtual PassRefPtr<IDBOpenDBRequest> open(ScriptExecutionContext*, const String& name, unsigned long long version, ExceptionCode&) override final;
-    virtual PassRefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext*, const String& name, ExceptionCode&) override final;
+    virtual PassRefPtr<WebCore::IDBOpenDBRequest> open(ScriptExecutionContext*, const String& name, ExceptionCode&) override final;
+    virtual PassRefPtr<WebCore::IDBOpenDBRequest> open(ScriptExecutionContext*, const String& name, unsigned long long version, ExceptionCode&) override final;
+    virtual PassRefPtr<WebCore::IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext*, const String& name, ExceptionCode&) override final;
 
     virtual short cmp(ScriptExecutionContext*, const Deprecated::ScriptValue& first, const Deprecated::ScriptValue& second, ExceptionCode&) override final;
 
diff --git a/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp b/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp
new file mode 100644 (file)
index 0000000..68065f0
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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"
+#include "IDBOpenDBRequestImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+namespace IDBClient {
+
+IDBOpenDBRequest::IDBOpenDBRequest(ScriptExecutionContext* context)
+    : IDBRequest(context)
+{
+    suspendIfNeeded();
+}
+
+} // namespace IDBClient
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h b/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h
new file mode 100644 (file)
index 0000000..366546e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#ifndef IDBOpenDBRequestImpl_h
+#define IDBOpenDBRequestImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBRequestImpl.h"
+
+namespace WebCore {
+namespace IDBClient {
+
+class IDBOpenDBRequest : public IDBRequest {
+public:
+    static Ref<IDBOpenDBRequest> create(ScriptExecutionContext* context)
+    {
+        return adoptRef(*new IDBOpenDBRequest(context));
+    }
+
+private:
+    IDBOpenDBRequest(ScriptExecutionContext*);
+};
+
+} // namespace IDBClient
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBOpenDBRequestImpl_h
diff --git a/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp b/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp
new file mode 100644 (file)
index 0000000..cf7c55a
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2015 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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"
+#include "IDBRequestImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+namespace IDBClient {
+
+IDBRequest::IDBRequest(ScriptExecutionContext* context)
+    : IDBOpenDBRequest(context)
+{
+}
+
+PassRefPtr<IDBAny> IDBRequest::result(ExceptionCode&) const
+{
+    return nullptr;
+}
+
+unsigned short IDBRequest::errorCode(ExceptionCode&) const
+{
+    return 0;
+}
+
+PassRefPtr<DOMError> IDBRequest::error(ExceptionCode&) const
+{
+    return nullptr;
+}
+
+PassRefPtr<IDBAny> IDBRequest::source() const
+{
+    return nullptr;
+}
+
+PassRefPtr<IDBTransaction> IDBRequest::transaction() const
+{
+    return nullptr;
+}
+
+const String& IDBRequest::readyState() const
+{
+    static WTF::NeverDestroyed<String> readyState;
+    return readyState;
+}
+
+EventTargetInterface IDBRequest::eventTargetInterface() const
+{
+    return IDBRequestEventTargetInterfaceType;
+}
+
+const char* IDBRequest::activeDOMObjectName() const
+{
+    return "IDBRequest";
+}
+
+bool IDBRequest::canSuspendForPageCache() const
+{
+    return false;
+}
+    
+} // namespace IDBClient
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h b/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h
new file mode 100644 (file)
index 0000000..0bad7ac
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#ifndef IDBRequestImpl_h
+#define IDBRequestImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBOpenDBRequest.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+namespace IDBClient {
+
+class IDBRequest : public WebCore::IDBOpenDBRequest, public RefCounted<IDBRequest> {
+public:
+    virtual PassRefPtr<IDBAny> result(ExceptionCode&) const override;
+    virtual unsigned short errorCode(ExceptionCode&) const override;
+    virtual PassRefPtr<DOMError> error(ExceptionCode&) const override;
+    virtual PassRefPtr<IDBAny> source() const override;
+    virtual PassRefPtr<IDBTransaction> transaction() const override;
+    virtual const String& readyState() const override;
+
+    // EventTarget
+    virtual EventTargetInterface eventTargetInterface() const override;
+    virtual ScriptExecutionContext* scriptExecutionContext() const override final { return ActiveDOMObject::scriptExecutionContext(); }
+
+    using RefCounted<IDBRequest>::ref;
+    using RefCounted<IDBRequest>::deref;
+
+protected:
+    IDBRequest(ScriptExecutionContext*);
+
+    // ActiveDOMObject.
+    virtual const char* activeDOMObjectName() const override final;
+    virtual bool canSuspendForPageCache() const override final;
+    
+    // EventTarget.
+    virtual void refEventTarget() override final { RefCounted<IDBRequest>::ref(); }
+    virtual void derefEventTarget() override final { RefCounted<IDBRequest>::deref(); }
+};
+
+} // namespace IDBClient
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBRequestImpl_h
index 45699da..85d6be0 100644 (file)
                510192D618B6B9B7007FC7A1 /* ImageControlsRootElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */; };
                5103104F1BA8CC03003329C0 /* IDBFactoryImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5103104A1BA8C6A6003329C0 /* IDBFactoryImpl.cpp */; };
                510310501BA8CC03003329C0 /* IDBFactoryImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5103104B1BA8C6A6003329C0 /* IDBFactoryImpl.h */; };
+               5103105A1BA8DB56003329C0 /* IDBOpenDBRequestImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510310561BA8DB30003329C0 /* IDBOpenDBRequestImpl.cpp */; };
+               5103105B1BA8DB56003329C0 /* IDBOpenDBRequestImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 510310571BA8DB30003329C0 /* IDBOpenDBRequestImpl.h */; };
+               5103105C1BA8DB56003329C0 /* IDBRequestImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510310581BA8DB30003329C0 /* IDBRequestImpl.cpp */; };
+               5103105D1BA8DB56003329C0 /* IDBRequestImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 510310591BA8DB30003329C0 /* IDBRequestImpl.h */; };
+               510310601BA8E0E3003329C0 /* IDBDatabaseIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 5103105F1BA8E090003329C0 /* IDBDatabaseIdentifier.h */; };
+               510310611BA8E10D003329C0 /* IDBDatabaseIdentifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5103105E1BA8E090003329C0 /* IDBDatabaseIdentifier.cpp */; };
                5103C2B11BA22D1A00E26337 /* LegacyAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51645B6E1BA0A76100F789CE /* LegacyAny.cpp */; };
                5103C2B21BA2317400E26337 /* IDBTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51645B501B9F889B00F789CE /* IDBTransaction.cpp */; };
                5103C2B31BA2324D00E26337 /* IDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51645B541B9F88E800F789CE /* IDBCursor.cpp */; };
                510192D818B7D7AB007FC7A1 /* imageControlsMac.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = imageControlsMac.css; sourceTree = "<group>"; };
                5103104A1BA8C6A6003329C0 /* IDBFactoryImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactoryImpl.cpp; sourceTree = "<group>"; };
                5103104B1BA8C6A6003329C0 /* IDBFactoryImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactoryImpl.h; sourceTree = "<group>"; };
+               510310561BA8DB30003329C0 /* IDBOpenDBRequestImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBOpenDBRequestImpl.cpp; sourceTree = "<group>"; };
+               510310571BA8DB30003329C0 /* IDBOpenDBRequestImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBOpenDBRequestImpl.h; sourceTree = "<group>"; };
+               510310581BA8DB30003329C0 /* IDBRequestImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBRequestImpl.cpp; sourceTree = "<group>"; };
+               510310591BA8DB30003329C0 /* IDBRequestImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBRequestImpl.h; sourceTree = "<group>"; };
+               5103105E1BA8E090003329C0 /* IDBDatabaseIdentifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBDatabaseIdentifier.cpp; sourceTree = "<group>"; };
+               5103105F1BA8E090003329C0 /* IDBDatabaseIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBDatabaseIdentifier.h; sourceTree = "<group>"; };
                5106D7BB18BDB76F000AB166 /* ContextMenuContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContextMenuContext.cpp; sourceTree = "<group>"; };
                5106D7BC18BDB76F000AB166 /* ContextMenuContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuContext.h; sourceTree = "<group>"; };
                510A326E18318431003C5326 /* IDBServerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBServerConnection.h; sourceTree = "<group>"; };
                510310421BA8C64C003329C0 /* client */ = {
                        isa = PBXGroup;
                        children = (
+                               510310561BA8DB30003329C0 /* IDBOpenDBRequestImpl.cpp */,
+                               510310571BA8DB30003329C0 /* IDBOpenDBRequestImpl.h */,
+                               510310581BA8DB30003329C0 /* IDBRequestImpl.cpp */,
+                               510310591BA8DB30003329C0 /* IDBRequestImpl.h */,
                                5103104A1BA8C6A6003329C0 /* IDBFactoryImpl.cpp */,
                                5103104B1BA8C6A6003329C0 /* IDBFactoryImpl.h */,
                        );
                                51D71983181106DF0016DC51 /* IDBDatabaseError.h */,
                                51D71984181106DF0016DC51 /* IDBDatabaseException.cpp */,
                                51D71985181106DF0016DC51 /* IDBDatabaseException.h */,
+                               5103105E1BA8E090003329C0 /* IDBDatabaseIdentifier.cpp */,
+                               5103105F1BA8E090003329C0 /* IDBDatabaseIdentifier.h */,
                                5163117C1851242B00534647 /* IDBDatabaseMetadata.cpp */,
                                51C9611A183D2B8000D2002E /* IDBDatabaseMetadata.h */,
                                51D71986181106DF0016DC51 /* IDBEventDispatcher.cpp */,
                                49E912AD0EFAC906009D0CAF /* AnimationList.h in Headers */,
                                31DCD29D1AB4FBDE0072E817 /* AnimationTrigger.h in Headers */,
                                0F580FAF149800D400FB5BD8 /* AnimationUtilities.h in Headers */,
+                               510310601BA8E0E3003329C0 /* IDBDatabaseIdentifier.h in Headers */,
                                93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */,
                                1A8F6BBD0DB55CDC001DB794 /* ApplicationCache.h in Headers */,
                                1A8F6BBF0DB55CDC001DB794 /* ApplicationCacheGroup.h in Headers */,
                                CD3E252418046BCD00E27F56 /* CSSGridTemplateAreasValue.h in Headers */,
                                FB3056C2169E5DAC0096A232 /* CSSGroupingRule.h in Headers */,
                                BC772B3C0C4EA91E0083285F /* CSSHelper.h in Headers */,
+                               5103105D1BA8DB56003329C0 /* IDBRequestImpl.h in Headers */,
                                BC23EE920DAED2BC009FDC91 /* CSSImageGeneratorValue.h in Headers */,
                                9393E600151A99F200066F06 /* CSSImageSetValue.h in Headers */,
                                A80E6CFA0A1989CA007FB8C5 /* CSSImageValue.h in Headers */,
                                C6F420A316B7164E0052A9F2 /* JSMutationCallback.h in Headers */,
                                65DF31FC09D1CC60000BE325 /* JSMutationEvent.h in Headers */,
                                C6F0902D14327D4F00685849 /* JSMutationObserver.h in Headers */,
+                               5103105B1BA8DB56003329C0 /* IDBOpenDBRequestImpl.h in Headers */,
                                C6F08FCA1431000D00685849 /* JSMutationRecord.h in Headers */,
                                BCD9C2C10C17B69E005C90A2 /* JSNamedNodeMap.h in Headers */,
                                A9D247F80D757E3400FDF959 /* JSNavigator.h in Headers */,
                                E14F1C4414B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp in Sources */,
                                A8DF3FCF097FA0FC0052981B /* HTMLFormControlsCollection.cpp in Sources */,
                                A81369D1097374F600D74463 /* HTMLFormElement.cpp in Sources */,
+                               5103105C1BA8DB56003329C0 /* IDBRequestImpl.cpp in Sources */,
                                A871DE230A152AC800B12A68 /* HTMLFrameElement.cpp in Sources */,
                                14FFE31E0AE1963300136BF5 /* HTMLFrameElementBase.cpp in Sources */,
                                93E2425F0B2B509500C732A1 /* HTMLFrameOwnerElement.cpp in Sources */,
                                078E090217D14CEE00420AA1 /* MediaStreamTrack.cpp in Sources */,
                                078E090317D14CEE00420AA1 /* MediaStreamTrackEvent.cpp in Sources */,
                                07FFDE68181AED420072D409 /* MediaStreamTrackPrivate.cpp in Sources */,
+                               510310611BA8E10D003329C0 /* IDBDatabaseIdentifier.cpp in Sources */,
                                076306D217E1478D005A7C4E /* MediaStreamTrackSourcesRequest.cpp in Sources */,
                                CD641EBF1819B36000EE4C41 /* MediaTimeAVFoundation.cpp in Sources */,
                                CD60C0C6193E87C7003C656B /* MediaTimeQTKit.mm in Sources */,
                                498391580F1E776900C23782 /* WebKitCSSMatrix.cpp in Sources */,
                                8AA61CFF144D595B00F37350 /* WebKitCSSRegionRule.cpp in Sources */,
                                BC9ADD800CC4092200098C4C /* WebKitCSSTransformValue.cpp in Sources */,
+                               5103105A1BA8DB56003329C0 /* IDBOpenDBRequestImpl.cpp in Sources */,
                                3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */,
                                1A1414B513A0F0500019996C /* WebKitFontFamilyNames.cpp in Sources */,
                                D7613A501474F13F00DB8606 /* WebKitNamedFlow.cpp in Sources */,
index 1921299..33d1705 100644 (file)
@@ -52,6 +52,7 @@ namespace WebCore {
     M(Gamepad) \
     M(History) \
     M(IconDatabase) \
+    M(IndexedDB) \
     M(Layout) \
     M(Loading) \
     M(Media) \
index 6bf4ce3..651774c 100644 (file)
@@ -1,3 +1,13 @@
+2015-09-16  Brady Eidson  <beidson@apple.com>
+
+        Have window.indexedDB.deleteDatabase return an IDBOpenDBRequest.
+        https://bugs.webkit.org/show_bug.cgi?id=149229
+
+        Reviewed by Alex Christensen.
+
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]): Enable IDB in WK1.
+
 2015-09-15  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add ShadowRoot interface and Element.prototype.attachShadow
index 8f79e26..e9fc862 100644 (file)
@@ -2441,6 +2441,10 @@ static bool needsSelfRetainWhileLoadingQuirk()
     RuntimeEnabledFeatures::sharedFeatures().setGamepadsEnabled([preferences gamepadsEnabled]);
 #endif
 
+#if ENABLE(INDEXED_DATABASE)
+    RuntimeEnabledFeatures::sharedFeatures().setWebkitIndexedDBEnabled(true);
+#endif
+
     NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
     if (timeout > 0)
         settings.setIncrementalRenderingSuppressionTimeoutInSeconds(timeout);