Modern IDB: LayoutTest imported/w3c/indexeddb/keyorder-private.html is flaky.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Feb 2016 19:46:47 +0000 (19:46 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Feb 2016 19:46:47 +0000 (19:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153438.

Reviewed by Alex Christensen.

Source/WebCore:

Tests: storage/indexeddb/modern/idbkey-array-equality-private.html
       storage/indexeddb/modern/idbkey-array-equality.html

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::loggingString):
(WebCore::IDBKeyData::operator==): Fix obvious bug.

LayoutTests:

* platform/mac-wk1/TestExpectations: Re-enable the flaky test.
* resources/js-test.js:
* storage/indexeddb/modern/idbkey-array-equality-expected.txt: Added.
* storage/indexeddb/modern/idbkey-array-equality-private-expected.txt: Added.
* storage/indexeddb/modern/idbkey-array-equality-private.html: Added.
* storage/indexeddb/modern/idbkey-array-equality.html: Added.
* storage/indexeddb/modern/resources/idbkey-array-equality.js: Added.

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

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/resources/js-test.js
LayoutTests/storage/indexeddb/modern/idbkey-array-equality-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbkey-array-equality-private-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbkey-array-equality-private.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbkey-array-equality.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/resources/idbkey-array-equality.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKeyData.cpp

index ca7fdc9..2683596 100644 (file)
@@ -1,3 +1,18 @@
+2016-02-04  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: LayoutTest imported/w3c/indexeddb/keyorder-private.html is flaky.
+        https://bugs.webkit.org/show_bug.cgi?id=153438.
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations: Re-enable the flaky test.
+        * resources/js-test.js:
+        * storage/indexeddb/modern/idbkey-array-equality-expected.txt: Added.
+        * storage/indexeddb/modern/idbkey-array-equality-private-expected.txt: Added.
+        * storage/indexeddb/modern/idbkey-array-equality-private.html: Added.
+        * storage/indexeddb/modern/idbkey-array-equality.html: Added.
+        * storage/indexeddb/modern/resources/idbkey-array-equality.js: Added.
+
 2016-02-04  Ryan Haddad  <ryanhaddad@apple.com>
 
         Skip two flaky indexeddb tests on Yosemite Release WK2
index 4b2453e..fe68b53 100644 (file)
@@ -64,8 +64,6 @@ webkit.org/b/153039 [ Debug ] inspector/heap/garbageCollected.html [ Pass Timeou
 
 webkit.org/b/153460 [ Debug ] inspector/codemirror/prettyprinting-css-rules.html [ Pass Timeout ]
 
-webkit.org/b/153438 imported/w3c/indexeddb/keyorder-private.html [ Pass Failure ]
-
 ### END OF (1) Failures with bug reports
 ########################################
 
index 7ee25d7..955998e 100644 (file)
@@ -6,7 +6,7 @@ if (self.testRunner) {
         testRunner.dumpAsText();
 
     // If the test file URL ends in "-private.html", enable private browsing.
-    if (window.location.href.endsWith("-private.html"))
+    if (window.location.href.endsWith("-private.html") || self.enablePrivateBrowsing)
         testRunner.setPrivateBrowsingEnabled(true);
 }
 
diff --git a/LayoutTests/storage/indexeddb/modern/idbkey-array-equality-expected.txt b/LayoutTests/storage/indexeddb/modern/idbkey-array-equality-expected.txt
new file mode 100644 (file)
index 0000000..ee0e6d4
--- /dev/null
@@ -0,0 +1,14 @@
+This test makes sure that array IDBKeys are correctly compared for equality during object store additions.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+Successfully added all 500 array keys, without any conflicts.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/modern/idbkey-array-equality-private-expected.txt b/LayoutTests/storage/indexeddb/modern/idbkey-array-equality-private-expected.txt
new file mode 100644 (file)
index 0000000..ee0e6d4
--- /dev/null
@@ -0,0 +1,14 @@
+This test makes sure that array IDBKeys are correctly compared for equality during object store additions.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+Successfully added all 500 array keys, without any conflicts.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/modern/idbkey-array-equality-private.html b/LayoutTests/storage/indexeddb/modern/idbkey-array-equality-private.html
new file mode 100644 (file)
index 0000000..0a9b1bd
--- /dev/null
@@ -0,0 +1,12 @@
+<html>
+<head>
+<script>
+enablePrivateBrowsing = true;
+</script>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+<script src="resources/idbkey-array-equality.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/modern/idbkey-array-equality.html b/LayoutTests/storage/indexeddb/modern/idbkey-array-equality.html
new file mode 100644 (file)
index 0000000..8f5aee7
--- /dev/null
@@ -0,0 +1,9 @@
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+<script src="resources/idbkey-array-equality.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbkey-array-equality.js b/LayoutTests/storage/indexeddb/modern/resources/idbkey-array-equality.js
new file mode 100644 (file)
index 0000000..0065ee9
--- /dev/null
@@ -0,0 +1,33 @@
+description("This test makes sure that array IDBKeys are correctly compared for equality during object store additions.");
+
+indexedDBTest(prepareDatabase);
+
+var iterationCount = 500;
+var successCount = 0;
+function doAdd(objectStore, value)
+{
+    var key = [ 0, value ];
+    var request = objectStore.add("value", key);
+    request.onsuccess = function() {
+        if (++successCount == iterationCount) {
+            debug("Successfully added all 500 array keys, without any conflicts.");
+            finishJSTest();
+        }
+    };
+
+    request.onerror = function(event) {
+        debug("Error putting value into database (" + value + "): " + event.type);
+        finishJSTest();
+    }    
+}
+
+function prepareDatabase(event)
+{    
+    var transaction = event.target.transaction;
+    var database = event.target.result;
+
+    var objectStore = database.createObjectStore("TestObjectStore");
+    
+    for (var i = 0; i < iterationCount; ++i)
+        doAdd(objectStore, i);
+}
index c7196ec..b27aa37 100644 (file)
@@ -1,3 +1,17 @@
+2016-02-04  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: LayoutTest imported/w3c/indexeddb/keyorder-private.html is flaky.
+        https://bugs.webkit.org/show_bug.cgi?id=153438.
+
+        Reviewed by Alex Christensen.
+
+        Tests: storage/indexeddb/modern/idbkey-array-equality-private.html
+               storage/indexeddb/modern/idbkey-array-equality.html
+
+        * Modules/indexeddb/IDBKeyData.cpp:
+        (WebCore::IDBKeyData::loggingString):
+        (WebCore::IDBKeyData::operator==): Fix obvious bug.
+
 2016-02-04  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, fix the EFL clean build after r196123
index 8982bee..e1abd4a 100644 (file)
@@ -276,7 +276,7 @@ String IDBKeyData::loggingString() const
         result = "<string> - " + m_stringValue;
         break;
     case KeyType::Date:
-        return String::format("Date m_type - %f", m_numberValue);
+        return String::format("<date> - %f", m_numberValue);
     case KeyType::Number:
         return String::format("<number> - %f", m_numberValue);
     case KeyType::Max:
@@ -356,13 +356,7 @@ bool IDBKeyData::operator==(const IDBKeyData& other) const
     case KeyType::String:
         return m_stringValue == other.m_stringValue;
     case KeyType::Array:
-        if (m_arrayValue.size() != other.m_arrayValue.size())
-            return false;
-        for (size_t i = 0; i < m_arrayValue.size(); ++i) {
-            if (m_arrayValue[0] != other.m_arrayValue[0])
-                return false;
-        }
-        return true;
+        return m_arrayValue == other.m_arrayValue;
     }
     RELEASE_ASSERT_NOT_REACHED();
 }