Title: [234125] trunk
Revision
234125
Author
[email protected]
Date
2018-07-23 17:35:02 -0700 (Mon, 23 Jul 2018)

Log Message

CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
https://bugs.webkit.org/show_bug.cgi?id=187927
LayoutTests/imported/w3c:

<rdar://problem/42516426>

Reviewed by Chris Dumez.

* web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt:

Source/WebCore:

Reviewed by Chris Dumez.

IDBKeyData is valid only when each key of it is valid.

Test: LayoutTests/storage/indexeddb/index-multientry.html

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::isValid const):
* Modules/indexeddb/IDBKeyData.h:
(WebCore::IDBKeyData::isValid const): Deleted.

LayoutTests:

<rdar://problem/42516426>

Reviewed by Chris Dumez.

Add a new test case in existing test file to cover the crash case and update the expecation accordingly.

* storage/indexeddb/index-multientry-expected.txt:
* storage/indexeddb/index-multientry-private-expected.txt:
* storage/indexeddb/resources/index-multientry.js:
(addData):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (234124 => 234125)


--- trunk/LayoutTests/ChangeLog	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/LayoutTests/ChangeLog	2018-07-24 00:35:02 UTC (rev 234125)
@@ -1,3 +1,18 @@
+2018-07-23  Sihui Liu  <[email protected]>
+
+        CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
+        https://bugs.webkit.org/show_bug.cgi?id=187927
+        <rdar://problem/42516426>
+
+        Reviewed by Chris Dumez.
+
+        Add a new test case in existing test file to cover the crash case and update the expecation accordingly.
+
+        * storage/indexeddb/index-multientry-expected.txt:
+        * storage/indexeddb/index-multientry-private-expected.txt:
+        * storage/indexeddb/resources/index-multientry.js:
+        (addData):
+
 2018-07-23  Basuke Suzuki  <[email protected]>
 
         [Curl] Test gardening

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (234124 => 234125)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-07-24 00:35:02 UTC (rev 234125)
@@ -1,3 +1,13 @@
+2018-07-23  Sihui Liu  <[email protected]>
+
+        CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
+        https://bugs.webkit.org/show_bug.cgi?id=187927
+        <rdar://problem/42516426>
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt:
+
 2018-07-20  Frederic Wang  <[email protected]>
 
         Import new WPT tests for custom elements

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt (234124 => 234125)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt	2018-07-24 00:35:02 UTC (rev 234125)
@@ -2,9 +2,7 @@
 FAIL IDBFactory cmp() static with throwing/invalid keys assert_throws: first key conversion with invalid key should throw DataError function "() => {
             receiver[method](invalid_key, throwing_key('getter 2'));
         }" threw object "getter 2: throwing from getter" that is not a DOMException DataError: property "code" is equal to undefined, expected 0
-FAIL IDBCursor continue() method with throwing/invalid keys assert_throws: key conversion with invalid key should throw DataError function "() => {
-            receiver[method](invalid_key);
-        }" threw object "InvalidStateError: Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end." that is not a DOMException DataError: property "code" is equal to 11, expected 0
+PASS IDBCursor continue() method with throwing/invalid keys 
 PASS IndexedDB: Exceptions thrown during key conversion 
 PASS IDBCursor update() method with throwing/invalid keys 
 PASS IDBKeyRange only() static with throwing/invalid keys 

Modified: trunk/LayoutTests/storage/indexeddb/index-multientry-expected.txt (234124 => 234125)


--- trunk/LayoutTests/storage/indexeddb/index-multientry-expected.txt	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/LayoutTests/storage/indexeddb/index-multientry-expected.txt	2018-07-24 00:35:02 UTC (rev 234125)
@@ -21,6 +21,7 @@
 transaction.objectStore('store').put({x: [4, 5, 6], y: 'b'}, 'bar')
 transaction.objectStore('store').put({x: [7, 7, 8, 7], y: 'c'}, 'baz')
 transaction.objectStore('store').put({x: [null, 9, 9], y: 'd'}, 'bloop')
+transaction.objectStore('store').put({x: [1, [2, null]], y:'e'}, 'oh')
 
 Verifying index: index
 transaction = db.transaction(['store'], 'readonly')
@@ -33,6 +34,12 @@
 cursor.continue()
 cursor = event.target.result
 PASS ex is non-null.
+PASS cursor.key is 1
+PASS cursor.primaryKey is "oh"
+PASS cursor.value.y is "e"
+cursor.continue()
+cursor = event.target.result
+PASS ex is non-null.
 PASS cursor.key is 2
 PASS cursor.primaryKey is "foo"
 PASS cursor.value.y is "a"
@@ -84,7 +91,7 @@
 transaction = db.transaction(['store'])
 transaction.objectStore('store').index('index')
 index.count()
-PASS event.target.result is 9
+PASS event.target.result is 10
 index.count(7)
 PASS event.target.result is 1
 
@@ -119,6 +126,12 @@
 cursor.continue()
 cursor = event.target.result
 PASS ex is non-null.
+PASS cursor.key is 1
+PASS cursor.primaryKey is "oh"
+PASS cursor.value.y is "e"
+cursor.continue()
+cursor = event.target.result
+PASS ex is non-null.
 PASS cursor.key is 2
 PASS cursor.primaryKey is "foo"
 PASS cursor.value.y is "a"
@@ -170,7 +183,7 @@
 transaction = db.transaction(['store'])
 transaction.objectStore('store').index('index')
 index.count()
-PASS event.target.result is 9
+PASS event.target.result is 10
 index.count(7)
 PASS event.target.result is 1
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/storage/indexeddb/index-multientry-private-expected.txt (234124 => 234125)


--- trunk/LayoutTests/storage/indexeddb/index-multientry-private-expected.txt	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/LayoutTests/storage/indexeddb/index-multientry-private-expected.txt	2018-07-24 00:35:02 UTC (rev 234125)
@@ -21,6 +21,7 @@
 transaction.objectStore('store').put({x: [4, 5, 6], y: 'b'}, 'bar')
 transaction.objectStore('store').put({x: [7, 7, 8, 7], y: 'c'}, 'baz')
 transaction.objectStore('store').put({x: [null, 9, 9], y: 'd'}, 'bloop')
+transaction.objectStore('store').put({x: [1, [2, null]], y:'e'}, 'oh')
 
 Verifying index: index
 transaction = db.transaction(['store'], 'readonly')
@@ -33,6 +34,12 @@
 cursor.continue()
 cursor = event.target.result
 PASS ex is non-null.
+PASS cursor.key is 1
+PASS cursor.primaryKey is "oh"
+PASS cursor.value.y is "e"
+cursor.continue()
+cursor = event.target.result
+PASS ex is non-null.
 PASS cursor.key is 2
 PASS cursor.primaryKey is "foo"
 PASS cursor.value.y is "a"
@@ -84,7 +91,7 @@
 transaction = db.transaction(['store'])
 transaction.objectStore('store').index('index')
 index.count()
-PASS event.target.result is 9
+PASS event.target.result is 10
 index.count(7)
 PASS event.target.result is 1
 
@@ -119,6 +126,12 @@
 cursor.continue()
 cursor = event.target.result
 PASS ex is non-null.
+PASS cursor.key is 1
+PASS cursor.primaryKey is "oh"
+PASS cursor.value.y is "e"
+cursor.continue()
+cursor = event.target.result
+PASS ex is non-null.
 PASS cursor.key is 2
 PASS cursor.primaryKey is "foo"
 PASS cursor.value.y is "a"
@@ -170,7 +183,7 @@
 transaction = db.transaction(['store'])
 transaction.objectStore('store').index('index')
 index.count()
-PASS event.target.result is 9
+PASS event.target.result is 10
 index.count(7)
 PASS event.target.result is 1
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/storage/indexeddb/resources/index-multientry.js (234124 => 234125)


--- trunk/LayoutTests/storage/indexeddb/resources/index-multientry.js	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/LayoutTests/storage/indexeddb/resources/index-multientry.js	2018-07-24 00:35:02 UTC (rev 234125)
@@ -37,6 +37,7 @@
     request._onerror_ = unexpectedErrorCallback;
     request = evalAndLog("transaction.objectStore('store').put({x: [null, 9, 9], y: 'd'}, 'bloop')");
     request._onerror_ = unexpectedErrorCallback;
+    request = evalAndLog("transaction.objectStore('store').put({x: [1, [2, null]], y:'e'}, 'oh')");
 }
 
 function verifyIndexes(indexName, callback)
@@ -49,6 +50,7 @@
 
     expected = [
         { key: 1, primaryKey: 'foo', y: 'a' },
+        { key: 1, primaryKey: 'oh', y: 'e' },
         { key: 2, primaryKey: 'foo', y: 'a' },
         { key: 3, primaryKey: 'foo', y: 'a' },
         { key: 4, primaryKey: 'bar', y: 'b' },
@@ -114,7 +116,7 @@
     request = evalAndLog("index.count()");
     request._onsuccess_ = function(event) {
 
-        shouldBe("event.target.result", "9");
+        shouldBe("event.target.result", "10");
 
         request = evalAndLog("index.count(7)");
         request._onsuccess_ = function(event) {

Modified: trunk/Source/WebCore/ChangeLog (234124 => 234125)


--- trunk/Source/WebCore/ChangeLog	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/Source/WebCore/ChangeLog	2018-07-24 00:35:02 UTC (rev 234125)
@@ -1,3 +1,19 @@
+2018-07-23  Sihui Liu  <[email protected]>
+
+        CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
+        https://bugs.webkit.org/show_bug.cgi?id=187927
+
+        Reviewed by Chris Dumez.
+
+        IDBKeyData is valid only when each key of it is valid.
+
+        Test: LayoutTests/storage/indexeddb/index-multientry.html
+
+        * Modules/indexeddb/IDBKeyData.cpp:
+        (WebCore::IDBKeyData::isValid const):
+        * Modules/indexeddb/IDBKeyData.h:
+        (WebCore::IDBKeyData::isValid const): Deleted.
+
 2018-07-23  Ben Richards  <[email protected]>
 
         We should cache the compiled sandbox profile in a data vault

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp (234124 => 234125)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp	2018-07-24 00:35:02 UTC (rev 234125)
@@ -426,6 +426,21 @@
     return result;
 }
 
+bool IDBKeyData::isValid() const
+{
+    if (m_type == KeyType::Invalid)
+        return false;
+    
+    if (m_type == KeyType::Array) {
+        for (auto& key : array()) {
+            if (!key.isValid())
+                return false;
+        }
+    }
+
+    return true;
+}
+
 bool IDBKeyData::operator<(const IDBKeyData& rhs) const
 {
     return compare(rhs) < 0;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h (234124 => 234125)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h	2018-07-24 00:27:13 UTC (rev 234124)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h	2018-07-24 00:35:02 UTC (rev 234125)
@@ -93,7 +93,7 @@
 #endif
 
     bool isNull() const { return m_isNull; }
-    bool isValid() const { return m_type != KeyType::Invalid; }
+    bool isValid() const;
     KeyType type() const { return m_type; }
 
     bool operator<(const IDBKeyData&) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to