Title: [87772] trunk
Revision
87772
Author
[email protected]
Date
2011-05-31 22:09:52 -0700 (Tue, 31 May 2011)

Log Message

2011-05-31  Kinuko Yasuda  <[email protected]>

        Reviewed by Kent Tamura.

        [Chromium] webkitStorageInfo methods (for quota API) should not crash when error callback is not given.
        https://bugs.webkit.org/show_bug.cgi?id=61823

        Added a new test for the fix marked the new test 'skipped' on unsupported platforms.

        * platform/chromium/test_expectations.txt:
        * platform/gtk/Skipped:
        * platform/mac/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:
        * storage/storageinfo-no-callbacks-expected.txt: Added.
        * storage/storageinfo-no-callbacks.html: Added.
2011-05-31  Kinuko Yasuda  <[email protected]>

        Reviewed by Kent Tamura.

        [Chromium] webkitStorageInfo methods (for quota API) should not crash when error callback is not given.
        https://bugs.webkit.org/show_bug.cgi?id=61823

        Fixed assertion on errorCallback parameter.

        Test: storage/quotainfo-no-callbacks.html

        * src/StorageInfoChromium.cpp:
        (WebCore::StorageInfo::queryUsageAndQuota):
        (WebCore::StorageInfo::requestQuota):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (87771 => 87772)


--- trunk/LayoutTests/ChangeLog	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/LayoutTests/ChangeLog	2011-06-01 05:09:52 UTC (rev 87772)
@@ -1,3 +1,20 @@
+2011-05-31  Kinuko Yasuda  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        [Chromium] webkitStorageInfo methods (for quota API) should not crash when error callback is not given.
+        https://bugs.webkit.org/show_bug.cgi?id=61823
+
+        Added a new test for the fix marked the new test 'skipped' on unsupported platforms.
+
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+        * storage/storageinfo-no-callbacks-expected.txt: Added.
+        * storage/storageinfo-no-callbacks.html: Added.
+
 2011-05-31  Hironori Bono  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (87771 => 87772)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-06-01 05:09:52 UTC (rev 87772)
@@ -200,9 +200,10 @@
 // TODO: move to platform/chromium-linux/.
 WONTFIX SKIP MAC WIN : platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle.html = FAIL
 
-// Quota API is not yet enabled by default.
-BUGCR61676 SKIP : storage/storageinfo-query-usage.html = FAIL
-BUGCR61676 SKIP : storage/storageinfo-request-quota.html = FAIL
+// Quota API is not supported in DRT yet.
+BUGCR84572 SKIP : storage/storageinfo-query-usage.html = FAIL
+BUGCR84572 SKIP : storage/storageinfo-request-quota.html = FAIL
+BUGCR84572 SKIP : storage/storageinfo-no-callbacks.html = FAIL
 
 // Animation API is disabled
 WONTFIX SKIP : animations/animation-api-1.html = FAIL

Modified: trunk/LayoutTests/platform/gtk/Skipped (87771 => 87772)


--- trunk/LayoutTests/platform/gtk/Skipped	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/LayoutTests/platform/gtk/Skipped	2011-06-01 05:09:52 UTC (rev 87772)
@@ -338,6 +338,7 @@
 # Quota API is not supported.
 storage/storageinfo-query-usage.html
 storage/storageinfo-request-quota.html
+storage/storageinfo-no-callbacks.html
 
 # This platform does not support the Page Visibility API.
 fast/events/page-visibility-iframe-delete-test.html

Modified: trunk/LayoutTests/platform/mac/Skipped (87771 => 87772)


--- trunk/LayoutTests/platform/mac/Skipped	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/LayoutTests/platform/mac/Skipped	2011-06-01 05:09:52 UTC (rev 87772)
@@ -335,6 +335,7 @@
 # Quota API is not supported.
 storage/storageinfo-query-usage.html
 storage/storageinfo-request-quota.html
+storage/storageinfo-no-callbacks.html
 
 # Expose title direction in WebKit API
 # https://bugs.webkit.org/show_bug.cgi?id=58845

Modified: trunk/LayoutTests/platform/qt/Skipped (87771 => 87772)


--- trunk/LayoutTests/platform/qt/Skipped	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/LayoutTests/platform/qt/Skipped	2011-06-01 05:09:52 UTC (rev 87772)
@@ -2455,6 +2455,7 @@
 # Quota API is not yet supported.
 storage/storageinfo-query-usage.html
 storage/storageinfo-request-quota.html
+storage/storageinfo-no-callbacks.html
 
 # Expose title direction in WebKit API
 # https://bugs.webkit.org/show_bug.cgi?id=58845

Modified: trunk/LayoutTests/platform/win/Skipped (87771 => 87772)


--- trunk/LayoutTests/platform/win/Skipped	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/LayoutTests/platform/win/Skipped	2011-06-01 05:09:52 UTC (rev 87772)
@@ -1266,6 +1266,7 @@
 # Quota API is not supported.
 storage/storageinfo-query-usage.html
 storage/storageinfo-request-quota.html
+storage/storageinfo-no-callbacks.html
 
 # Expose title direction in WebKit API
 # https://bugs.webkit.org/show_bug.cgi?id=58845

Added: trunk/LayoutTests/storage/script-tests/storageinfo-no-callbacks.js (0 => 87772)


--- trunk/LayoutTests/storage/script-tests/storageinfo-no-callbacks.js	                        (rev 0)
+++ trunk/LayoutTests/storage/script-tests/storageinfo-no-callbacks.js	2011-06-01 05:09:52 UTC (rev 87772)
@@ -0,0 +1,51 @@
+description("This tests webkitStorageInfo methods do not crash when they are not given optional callbacks parameters.");
+
+var testFinished = false;
+var numberOfExpectedCallbacks = 0;
+
+function callback()
+{
+    testPassed("storageInfo callback called.");
+    --numberOfExpectedCallbacks;
+    checkCompleted();
+}
+
+function checkCompleted()
+{
+    if (numberOfExpectedCallbacks == 0 && testFinished)
+        finishJSTest();
+}
+
+function isValidStorageType(type)
+{
+    return (type == webkitStorageInfo.TEMPORARY || type == webkitStorageInfo.PERSISTENT);
+}
+
+function callStorageInfoMethodsWithFewerParameters(type)
+{
+    webkitStorageInfo.requestQuota(type, 0);
+    webkitStorageInfo.queryUsageAndQuota(type);
+    if (isValidStorageType(type))
+        ++numberOfExpectedCallbacks;
+    webkitStorageInfo.requestQuota(type, 0, callback);
+    if (isValidStorageType(type))
+        ++numberOfExpectedCallbacks;
+    webkitStorageInfo.queryUsageAndQuota(type, callback);
+}
+
+if (window.webkitStorageInfo) {
+    window.jsTestIsAsync = true;
+
+    // Any of the following attempts should not cause crashing.
+    callStorageInfoMethodsWithFewerParameters(webkitStorageInfo.TEMPORARY);
+    callStorageInfoMethodsWithFewerParameters(webkitStorageInfo.PERSISTENT);
+    callStorageInfoMethodsWithFewerParameters(10);
+
+    testFinished = true;
+    checkCompleted();
+
+} else
+    debug("This test requires window.webkitStorageInfo.");
+
+window.successfullyParsed = true;
+
Property changes on: trunk/LayoutTests/storage/script-tests/storageinfo-no-callbacks.js
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/storage/storageinfo-no-callbacks-expected.txt (0 => 87772)


--- trunk/LayoutTests/storage/storageinfo-no-callbacks-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/storageinfo-no-callbacks-expected.txt	2011-06-01 05:09:52 UTC (rev 87772)
@@ -0,0 +1,13 @@
+This tests webkitStorageInfo methods do not crash when they are not given optional callbacks parameters.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS storageInfo callback called.
+PASS storageInfo callback called.
+PASS storageInfo callback called.
+PASS storageInfo callback called.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/storage/storageinfo-no-callbacks-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/storage/storageinfo-no-callbacks.html (0 => 87772)


--- trunk/LayoutTests/storage/storageinfo-no-callbacks.html	                        (rev 0)
+++ trunk/LayoutTests/storage/storageinfo-no-callbacks.html	2011-06-01 05:09:52 UTC (rev 87772)
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/storage/storageinfo-no-callbacks.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebKit/chromium/ChangeLog (87771 => 87772)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-06-01 05:09:52 UTC (rev 87772)
@@ -1,3 +1,18 @@
+2011-05-31  Kinuko Yasuda  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        [Chromium] webkitStorageInfo methods (for quota API) should not crash when error callback is not given.
+        https://bugs.webkit.org/show_bug.cgi?id=61823
+
+        Fixed assertion on errorCallback parameter.
+
+        Test: storage/quotainfo-no-callbacks.html
+
+        * src/StorageInfoChromium.cpp:
+        (WebCore::StorageInfo::queryUsageAndQuota):
+        (WebCore::StorageInfo::requestQuota):
+
 2011-05-31  Daniel Erat  <[email protected]>
 
         Reviewed by Tony Chang.

Modified: trunk/Source/WebKit/chromium/src/StorageInfoChromium.cpp (87771 => 87772)


--- trunk/Source/WebKit/chromium/src/StorageInfoChromium.cpp	2011-06-01 02:40:27 UTC (rev 87771)
+++ trunk/Source/WebKit/chromium/src/StorageInfoChromium.cpp	2011-06-01 05:09:52 UTC (rev 87772)
@@ -52,7 +52,8 @@
 namespace {
 void fireStorageInfoErrorCallback(PassRefPtr<StorageInfoErrorCallback> errorCallback, ExceptionCode ec)
 {
-    ASSERT(errorCallback);
+    if (!errorCallback)
+        return;
     ExceptionCodeDescription description;
     getExceptionCodeDescription(ec, description);
     errorCallback->handleEvent(DOMCoreException::create(description).get());
@@ -71,7 +72,7 @@
         Document* document = static_cast<Document*>(context);
         WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
         webFrame->client()->queryStorageUsageAndQuota(webFrame, static_cast<WebStorageQuotaType>(storageType), new WebStorageQuotaCallbacksImpl(successCallback, errorCallback));
-    } else if (errorCallback) {
+    } else {
         // FIXME: calling this on worker is not yet supported.
         fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR);
     }
@@ -89,7 +90,7 @@
         Document* document = static_cast<Document*>(context);
         WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
         webFrame->client()->requestStorageQuota(webFrame, static_cast<WebStorageQuotaType>(storageType), newQuotaInBytes, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback));
-    } else if (errorCallback) {
+    } else {
         // FIXME: calling this on worker is not yet supported.
         fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to