Title: [191672] trunk
Revision
191672
Author
beid...@apple.com
Date
2015-10-28 10:29:41 -0700 (Wed, 28 Oct 2015)

Log Message

Modern IDB: Implement most readonly attributes of IDBObjectStore.
https://bugs.webkit.org/show_bug.cgi?id=150617

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/objectstore-attributes.html

* Modules/indexeddb/IDBObjectStore.h:

* Modules/indexeddb/client/IDBAnyImpl.cpp:
(WebCore::IDBClient::IDBAny::IDBAny):
* Modules/indexeddb/client/IDBAnyImpl.h:
(WebCore::IDBClient::IDBAny::create):

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::name):
(WebCore::IDBClient::IDBObjectStore::keyPathAny):
(WebCore::IDBClient::IDBObjectStore::keyPath):
(WebCore::IDBClient::IDBObjectStore::transaction):
(WebCore::IDBClient::IDBObjectStore::id): Deleted.
* Modules/indexeddb/client/IDBObjectStoreImpl.h:

* Modules/indexeddb/legacy/LegacyObjectStore.h:
(WebCore::LegacyObjectStore::transaction):

LayoutTests:

* storage/indexeddb/modern/objectstore-attributes-expected.txt: Added.
* storage/indexeddb/modern/objectstore-attributes.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191671 => 191672)


--- trunk/LayoutTests/ChangeLog	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/LayoutTests/ChangeLog	2015-10-28 17:29:41 UTC (rev 191672)
@@ -1,3 +1,13 @@
+2015-10-28  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Implement most readonly attributes of IDBObjectStore.
+        https://bugs.webkit.org/show_bug.cgi?id=150617
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/objectstore-attributes-expected.txt: Added.
+        * storage/indexeddb/modern/objectstore-attributes.html: Added.
+
 2015-10-28  Hunseop Jeong  <hs85.je...@samsung.com>
 
         Unreviewed. EFL gardening: rebaseline more tests after r191623.

Added: trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt (0 => 191672)


--- trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt	2015-10-28 17:29:41 UTC (rev 191672)
@@ -0,0 +1,17 @@
+ALERT: First upgrade needed: Old version - 0 New version - 1
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: TestObjectStore1
+ALERT: TestObjectStore2
+ALERT: true
+ALERT: false
+ALERT: foo
+ALERT: null
+ALERT: [object IDBTransaction]
+ALERT: [object IDBTransaction]
+ALERT: true
+ALERT: true
+ALERT: true
+ALERT: First version change transaction completed
+ALERT: Done
+This test exercises the readonly attributes on an IDBObjectStore.

Added: trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes.html (0 => 191672)


--- trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes.html	2015-10-28 17:29:41 UTC (rev 191672)
@@ -0,0 +1,58 @@
+This test exercises the readonly attributes on an IDBObjectStore.
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var request = window.indexedDB.open("ObjectStoreAttributesTestDatabase");
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+request._onupgradeneeded_ = function(event)
+{
+    alert("First upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+    
+    var tx = request.transaction;
+    var db = event.target.result;
+
+    alert(tx + " - " + tx.mode);
+    alert(db);
+
+    var os1 = db.createObjectStore('TestObjectStore1', { autoIncrement: true , keyPath: "foo" });
+    var os2 = db.createObjectStore('TestObjectStore2', { autoIncrement: false });
+
+    alert(os1.name);
+    alert(os2.name);
+    alert(os1.autoIncrement);
+    alert(os2.autoIncrement);
+    alert(os1.keyPath);
+    alert(os2.keyPath);
+    alert(os1.transaction);
+    alert(os2.transaction);
+    alert(os1.transaction == tx);
+    alert(os2.transaction == tx);
+    alert(os1.transaction == os2.transaction);
+    
+    tx._onabort_ = function(event) {
+        alert("First version change transaction unexpected abort");
+        done();
+    }
+
+    tx._oncomplete_ = function(event) {
+        alert("First version change transaction completed");
+        done();
+    }
+
+    tx._onerror_ = function(event) {
+        alert("First version change transaction unexpected error - " + event);
+        done();
+    }
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (191671 => 191672)


--- trunk/Source/WebCore/ChangeLog	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/Source/WebCore/ChangeLog	2015-10-28 17:29:41 UTC (rev 191672)
@@ -1,3 +1,30 @@
+2015-10-28  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Implement most readonly attributes of IDBObjectStore.
+        https://bugs.webkit.org/show_bug.cgi?id=150617
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/objectstore-attributes.html
+
+        * Modules/indexeddb/IDBObjectStore.h:
+
+        * Modules/indexeddb/client/IDBAnyImpl.cpp:
+        (WebCore::IDBClient::IDBAny::IDBAny):
+        * Modules/indexeddb/client/IDBAnyImpl.h:
+        (WebCore::IDBClient::IDBAny::create):
+
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::name):
+        (WebCore::IDBClient::IDBObjectStore::keyPathAny):
+        (WebCore::IDBClient::IDBObjectStore::keyPath):
+        (WebCore::IDBClient::IDBObjectStore::transaction):
+        (WebCore::IDBClient::IDBObjectStore::id): Deleted.
+        * Modules/indexeddb/client/IDBObjectStoreImpl.h:
+
+        * Modules/indexeddb/legacy/LegacyObjectStore.h:
+        (WebCore::LegacyObjectStore::transaction):
+
 2015-10-28  Hunseop Jeong  <hs85.je...@samsung.com>
 
         Replace 0 and NULL with nullptr in WebCore/editing.

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (191671 => 191672)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2015-10-28 17:29:41 UTC (rev 191672)
@@ -59,12 +59,11 @@
     virtual ~IDBObjectStore() { }
 
     // Implement the IDBObjectStore IDL
-    virtual int64_t id() const = 0;
     virtual const String name() const = 0;
     virtual RefPtr<IDBAny> keyPathAny() const = 0;
     virtual const IDBKeyPath keyPath() const = 0;
     virtual RefPtr<DOMStringList> indexNames() const = 0;
-    virtual RefPtr<IDBTransaction> transaction() const = 0;
+    virtual RefPtr<IDBTransaction> transaction() = 0;
     virtual bool autoIncrement() const = 0;
 
     virtual RefPtr<IDBRequest> add(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCode&) = 0;

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.cpp (191671 => 191672)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.cpp	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.cpp	2015-10-28 17:29:41 UTC (rev 191672)
@@ -48,6 +48,12 @@
 {
 }
 
+IDBAny::IDBAny(const IDBKeyPath& keyPath)
+    : m_type(IDBAny::Type::KeyPath)
+    , m_idbKeyPath(keyPath)
+{
+}
+
 IDBAny::IDBAny(const Deprecated::ScriptValue& value)
     : m_type(IDBAny::Type::ScriptValue)
     , m_scriptValue(value)

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.h (191671 => 191672)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.h	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.h	2015-10-28 17:29:41 UTC (rev 191672)
@@ -47,6 +47,11 @@
         return adoptRef(new IDBAny(WTF::move(objectStore)));
     }
 
+    static RefPtr<IDBAny> create(const IDBKeyPath& keyPath)
+    {
+        return adoptRef(new IDBAny(keyPath));
+    }
+
     static RefPtr<IDBAny> create(const Deprecated::ScriptValue& value)
     {
         return adoptRef(new IDBAny(value));
@@ -73,9 +78,9 @@
 private:
     explicit IDBAny(Ref<IDBDatabase>&&);
     explicit IDBAny(Ref<IDBObjectStore>&&);
+    explicit IDBAny(const IDBKeyPath&);
     explicit IDBAny(const Deprecated::ScriptValue&);
 
-
     IDBAny::Type m_type { IDBAny::Type::Undefined };
     RefPtr<IDBDatabase> m_database;
     RefPtr<IDBObjectStore> m_objectStore;

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (191671 => 191672)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-10-28 17:29:41 UTC (rev 191672)
@@ -56,24 +56,19 @@
 {
 }
 
-int64_t IDBObjectStore::id() const
-{
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
 const String IDBObjectStore::name() const
 {
-    RELEASE_ASSERT_NOT_REACHED();
+    return m_info.name();
 }
 
 RefPtr<WebCore::IDBAny> IDBObjectStore::keyPathAny() const
 {
-    RELEASE_ASSERT_NOT_REACHED();
+    return IDBAny::create(m_info.keyPath());
 }
 
 const IDBKeyPath IDBObjectStore::keyPath() const
 {
-    RELEASE_ASSERT_NOT_REACHED();
+    return m_info.keyPath();
 }
 
 RefPtr<DOMStringList> IDBObjectStore::indexNames() const
@@ -81,9 +76,9 @@
     RELEASE_ASSERT_NOT_REACHED();
 }
 
-RefPtr<WebCore::IDBTransaction> IDBObjectStore::transaction() const
+RefPtr<WebCore::IDBTransaction> IDBObjectStore::transaction()
 {
-    RELEASE_ASSERT_NOT_REACHED();
+    return &m_transaction.get();
 }
 
 bool IDBObjectStore::autoIncrement() const

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h (191671 => 191672)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h	2015-10-28 17:29:41 UTC (rev 191672)
@@ -47,12 +47,11 @@
     virtual ~IDBObjectStore() override final;
 
     // Implement the IDBObjectStore IDL
-    virtual int64_t id() const override final;
     virtual const String name() const override final;
     virtual RefPtr<WebCore::IDBAny> keyPathAny() const override final;
     virtual const IDBKeyPath keyPath() const override final;
     virtual RefPtr<DOMStringList> indexNames() const override final;
-    virtual RefPtr<WebCore::IDBTransaction> transaction() const override final;
+    virtual RefPtr<WebCore::IDBTransaction> transaction() override final;
     virtual bool autoIncrement() const override final;
 
     virtual RefPtr<WebCore::IDBRequest> add(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCode&) override final;

Modified: trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.h (191671 => 191672)


--- trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.h	2015-10-28 17:09:56 UTC (rev 191671)
+++ trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.h	2015-10-28 17:29:41 UTC (rev 191672)
@@ -64,7 +64,7 @@
     RefPtr<IDBAny> keyPathAny() const { return LegacyAny::create(m_metadata.keyPath); }
     const IDBKeyPath keyPath() const { return m_metadata.keyPath; }
     RefPtr<DOMStringList> indexNames() const;
-    RefPtr<IDBTransaction> transaction() const { return m_transaction; }
+    RefPtr<IDBTransaction> transaction() { return m_transaction; }
     bool autoIncrement() const { return m_metadata.autoIncrement; }
 
     RefPtr<IDBRequest> add(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCode&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to