Title: [188353] trunk
Revision
188353
Author
[email protected]
Date
2015-08-12 13:20:37 -0700 (Wed, 12 Aug 2015)

Log Message

Web Inspector: Not receiving responses for async request IndexedDB.requestDatabaseNames
https://bugs.webkit.org/show_bug.cgi?id=147844

Patch by Joseph Pecoraro <[email protected]> on 2015-08-12
Reviewed by Brian Burg.

Source/WebKit2:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
(WebKit::WebIDBFactoryBackend::getDatabaseNames):
This method should not return without calling either the success
or error callbacks. In this case, it can succeed with an empty list.

LayoutTests:

* inspector/indexeddb/requestDatabaseNames-expected.txt: Added.
* inspector/indexeddb/requestDatabaseNames.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (188352 => 188353)


--- trunk/LayoutTests/ChangeLog	2015-08-12 20:20:26 UTC (rev 188352)
+++ trunk/LayoutTests/ChangeLog	2015-08-12 20:20:37 UTC (rev 188353)
@@ -1,3 +1,13 @@
+2015-08-12  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Not receiving responses for async request IndexedDB.requestDatabaseNames
+        https://bugs.webkit.org/show_bug.cgi?id=147844
+
+        Reviewed by Brian Burg.
+
+        * inspector/indexeddb/requestDatabaseNames-expected.txt: Added.
+        * inspector/indexeddb/requestDatabaseNames.html: Added.
+
 2015-08-11  Matt Rajca  <[email protected]>
 
         Media Session: test Play/Pause media control events delivered to Default media sessions

Added: trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames-expected.txt (0 => 188353)


--- trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames-expected.txt	2015-08-12 20:20:37 UTC (rev 188353)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: line 10: Created Database 'Database1'
+CONSOLE MESSAGE: line 10: Created Database 'Database2'
+
+PASS: No IndexedDB databases should exist initially
+Created Database 'Database1'
+PASS: A single IndexedDB database should exist
+["Database1"]
+Created Database 'Database2'
+PASS: Two IndexedDB databases should exist
+["Database1","Database2"]
+

Added: trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html (0 => 188353)


--- trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html	2015-08-12 20:20:37 UTC (rev 188353)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function createDatabase(name)
+{
+    let request = window.indexedDB.open(name, 1);
+    request.addEventListener('success', function() {
+        console.log(`Created Database '${name}'`);
+    });
+}
+
+function test()
+{
+    var steps = [
+        {
+            action: function() {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially");
+                    InspectorTest.evaluateInPage("createDatabase('Database1')");
+                });
+            }
+        },
+        {
+            action: function() {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 1, "A single IndexedDB database should exist");
+                    InspectorTest.log(JSON.stringify(names));
+                    InspectorTest.evaluateInPage("createDatabase('Database2')");
+                });
+            }
+        },
+        {
+            action: function() {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 2, "Two IndexedDB databases should exist");
+                    InspectorTest.log(JSON.stringify(names));
+                    next();
+                });
+            }
+        }
+    ];
+
+    function next() {
+        let step = steps.shift();
+        if (!step) {
+            InspectorTest.completeTest();
+            return;
+        }
+        step.action();
+    }
+
+    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) {
+        InspectorTest.log(event.data.message.messageText);
+        next();
+    });
+
+    InspectorTest.log("");
+    next();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (188352 => 188353)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-08-12 20:20:26 UTC (rev 188352)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-08-12 20:20:37 UTC (rev 188353)
@@ -65,6 +65,7 @@
 http/tests/security/no-indexeddb-from-sandbox.html
 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 ]

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Test.js (188352 => 188353)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Test.js	2015-08-12 20:20:26 UTC (rev 188352)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Test.js	2015-08-12 20:20:37 UTC (rev 188353)
@@ -155,6 +155,16 @@
     this.evaluateInPage("InspectorTestProxy.debugLog(unescape('" + escape(JSON.stringify(message)) + "'))");
 }
 
+// Appends a message in the test document if there was an error, and attempts to complete the test.
+InspectorTest.expectNoError = function(error)
+{
+    if (error) {
+        InspectorTest.log("PROTOCOL ERROR: " + error);
+        InspectorTest.completeTest();
+        throw "PROTOCOL ERROR";
+    }
+}
+
 InspectorTest.completeTest = function()
 {
     if (InspectorTest.dumpMessagesToConsole)

Modified: trunk/Source/WebKit2/ChangeLog (188352 => 188353)


--- trunk/Source/WebKit2/ChangeLog	2015-08-12 20:20:26 UTC (rev 188352)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-12 20:20:37 UTC (rev 188353)
@@ -1,3 +1,15 @@
+2015-08-12  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Not receiving responses for async request IndexedDB.requestDatabaseNames
+        https://bugs.webkit.org/show_bug.cgi?id=147844
+
+        Reviewed by Brian Burg.
+
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
+        (WebKit::WebIDBFactoryBackend::getDatabaseNames):
+        This method should not return without calling either the success
+        or error callbacks. In this case, it can succeed with an empty list.
+
 2015-08-12  Enrica Casucci  <[email protected]>
 
         Element interaction should not be canceled when the menu is already being shown.

Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp (188352 => 188353)


--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp	2015-08-12 20:20:26 UTC (rev 188352)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp	2015-08-12 20:20:37 UTC (rev 188353)
@@ -98,15 +98,14 @@
         return;
     }
 
-    auto recentNameIterator = sharedRecentDatabaseNameMap().find(securityOriginIdentifier);
-    if (recentNameIterator == sharedRecentDatabaseNameMap().end())
-        return;
-
     RefPtr<DOMStringList> databaseNames = DOMStringList::create();
 
-    HashSet<String>& foundNames = recentNameIterator->value;
-    for (const String& name : foundNames)
-        databaseNames->append(name);
+    auto recentNameIterator = sharedRecentDatabaseNameMap().find(securityOriginIdentifier);
+    if (recentNameIterator != sharedRecentDatabaseNameMap().end()) {
+        HashSet<String>& foundNames = recentNameIterator->value;
+        for (const String& name : foundNames)
+            databaseNames->append(name);
+    }
 
     callbacks->onSuccess(databaseNames.release());
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to