2011-05-18 Kinuko Yasuda <kinuko@chromium.org>
authorkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2011 15:31:33 +0000 (15:31 +0000)
committerkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2011 15:31:33 +0000 (15:31 +0000)
        Reviewed by David Levin.

        Expose webkitStorageInfo.requestQuota() for Quota API if QUOTA flag is enabled
        https://bugs.webkit.org/show_bug.cgi?id=59681

        * platform/chromium/test_expectations.txt:
        * platform/gtk/Skipped:
        * platform/mac/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:
        * storage/script-tests/storageinfo-request-quota.js: Added.
        * storage/storageinfo-request-quota-expected.txt: Added.
        * storage/storageinfo-request-quota.html: Added.
2011-05-18  Kinuko Yasuda  <kinuko@chromium.org>

        Reviewed by David Levin.

        Expose webkitStorageInfo.requestQuota() for Quota API if QUOTA flag is enabled
        https://bugs.webkit.org/show_bug.cgi?id=59681

        Test: storage/storageinfo-request-quota.html

        * CMakeLists.txt:
        * CodeGenerators.pri:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * GNUmakefile.am:
        * GNUmakefile.list.am:
        * WebCore.gypi:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * storage/StorageInfo.idl: Added requestQuota().
        * storage/StorageInfoQuotaCallback.idl: Added.

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
LayoutTests/storage/script-tests/storageinfo-request-quota.js [new file with mode: 0644]
LayoutTests/storage/storageinfo-request-quota-expected.txt [new file with mode: 0644]
LayoutTests/storage/storageinfo-request-quota.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/CodeGenerators.pri
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/storage/StorageInfo.idl
Source/WebCore/storage/StorageInfoQuotaCallback.idl [new file with mode: 0644]

index 89513dc..d97946d 100644 (file)
@@ -1,3 +1,19 @@
+2011-05-18  Kinuko Yasuda  <kinuko@chromium.org>
+
+        Reviewed by David Levin.
+
+        Expose webkitStorageInfo.requestQuota() for Quota API if QUOTA flag is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=59681
+
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+        * storage/script-tests/storageinfo-request-quota.js: Added.
+        * storage/storageinfo-request-quota-expected.txt: Added.
+        * storage/storageinfo-request-quota.html: Added.
+
 2011-05-18  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         [Qt][WK2] Skip two failing tests.
index 6f6da6a..f86be87 100644 (file)
@@ -202,6 +202,7 @@ WONTFIX SKIP MAC WIN : platform/chromium/fast/text/chromium-linux-fontconfig-ren
 
 // Quota API is not yet enabled by default.
 BUGCR61676 SKIP : storage/storageinfo-query-usage.html = FAIL
+BUGCR61676 SKIP : storage/storageinfo-request-quota.html = FAIL
 
 // Animation API is disabled
 WONTFIX SKIP : animations/animation-api-1.html = FAIL
index 3e4a8ed..53d9bc4 100644 (file)
@@ -1391,6 +1391,7 @@ fast/canvas/DrawImageSinglePixelStretch.html
 
 # Quota API is not supported.
 storage/storageinfo-query-usage.html
+storage/storageinfo-request-quota.html
 
 # Expose title direction in WebKit API
 # https://bugs.webkit.org/show_bug.cgi?id=58845
index 958cf8a..252685f 100644 (file)
@@ -333,6 +333,7 @@ compositing/overflow/clip-content-under-overflow-controls.html
 
 # Quota API is not supported.
 storage/storageinfo-query-usage.html
+storage/storageinfo-request-quota.html
 
 # Expose title direction in WebKit API
 # https://bugs.webkit.org/show_bug.cgi?id=58845
index 3322bd5..ed17dab 100644 (file)
@@ -2521,6 +2521,7 @@ http/tests/misc/redirect-to-external-url.html
 
 # Quota API is not yet supported.
 storage/storageinfo-query-usage.html
+storage/storageinfo-request-quota.html
 
 # Expose title direction in WebKit API
 # https://bugs.webkit.org/show_bug.cgi?id=58845
index fdccf49..bd0c785 100644 (file)
@@ -1254,6 +1254,7 @@ fast/transforms/selection-bounds-in-transformed-view.html
 
 # Quota API is not supported.
 storage/storageinfo-query-usage.html
+storage/storageinfo-request-quota.html
 
 # Expose title direction in WebKit API
 # https://bugs.webkit.org/show_bug.cgi?id=58845
diff --git a/LayoutTests/storage/script-tests/storageinfo-request-quota.js b/LayoutTests/storage/script-tests/storageinfo-request-quota.js
new file mode 100644 (file)
index 0000000..6ddcbb8
--- /dev/null
@@ -0,0 +1,29 @@
+description("This tests webkitStorageInfo.requestQuota.");
+
+function errorCallback(error)
+{
+    testFailed("Error occurred: " + error);
+    finishJSTest();
+}
+
+var grantedQuota;
+function quotaCallback(newQuota)
+{
+    grantedQuota = newQuota;
+
+    // We must be given 0 quota, the same amount as we requested.
+    shouldBe("grantedQuota", "0");
+
+    finishJSTest();
+}
+
+if (window.webkitStorageInfo) {
+    window.jsTestIsAsync = true;
+
+    // Requesting '0' quota for testing (this request must be almost always granted without showing any platform specific notification UI).
+    webkitStorageInfo.requestQuota(webkitStorageInfo.TEMPORARY, 0, quotaCallback, errorCallback);
+} else
+    debug("This test requires window.webkitStorageInfo.");
+
+window.successfullyParsed = true;
+
diff --git a/LayoutTests/storage/storageinfo-request-quota-expected.txt b/LayoutTests/storage/storageinfo-request-quota-expected.txt
new file mode 100644 (file)
index 0000000..9d6b518
--- /dev/null
@@ -0,0 +1,10 @@
+iThis tests webkitStorageInfo.requestQuota.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS grantedQuota is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/storageinfo-request-quota.html b/LayoutTests/storage/storageinfo-request-quota.html
new file mode 100644 (file)
index 0000000..c320553
--- /dev/null
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script src="../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/fs-test-util.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/storageinfo-request-quota.js"></script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index a662cb4..ed54cc6 100644 (file)
@@ -376,6 +376,7 @@ SET(WebCore_IDL_FILES
     storage/StorageEvent.idl
     storage/StorageInfo.idl
     storage/StorageInfoErrorCallback.idl
+    storage/StorageInfoQuotaCallback.idl
     storage/StorageInfoUsageCallback.idl
 
     webaudio/AudioBuffer.idl
index 5d821e0..c7de9c2 100644 (file)
@@ -1,3 +1,24 @@
+2011-05-18  Kinuko Yasuda  <kinuko@chromium.org>
+
+        Reviewed by David Levin.
+
+        Expose webkitStorageInfo.requestQuota() for Quota API if QUOTA flag is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=59681
+
+        Test: storage/storageinfo-request-quota.html
+
+        * CMakeLists.txt:
+        * CodeGenerators.pri:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * storage/StorageInfo.idl: Added requestQuota().
+        * storage/StorageInfoQuotaCallback.idl: Added.
+
 2011-05-18  Renata Hodovan  <reni@webkit.org>
 
         Reviewed by Nikolas Zimmermann.
index 5b331c3..52f0664 100644 (file)
@@ -361,6 +361,7 @@ IDL_BINDINGS += \
     storage/StorageEvent.idl \
     storage/StorageInfo.idl \
     storage/StorageInfoErrorCallback.idl \
+    storage/StorageInfoQuotaCallback.idl \
     storage/StorageInfoUsageCallback.idl \
     storage/SQLError.idl \
     storage/SQLException.idl \
index c29edfc..7d5e4f9 100644 (file)
 #include "JSStorageEvent.cpp"
 #include "JSStorageInfo.cpp"
 #include "JSStorageInfoErrorCallback.cpp"
+#include "JSStorageInfoQuotaCallback.cpp"
 #include "JSStorageInfoUsageCallback.cpp"
 #include "JSStringCallback.cpp"
 #include "JSStyleMedia.cpp"
index 52bc76c..b165763 100644 (file)
@@ -353,6 +353,7 @@ DOM_CLASSES = \
     StorageEvent \
     StorageInfo \
     StorageInfoErrorCallback \
+    StorageInfoQuotaCallback \
     StorageInfoUsageCallback \
     StringCallback \
     SVGAElement \
index 7316e34..a3f2856 100644 (file)
@@ -256,6 +256,8 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSStorageInfo.h \
        DerivedSources/WebCore/JSStorageInfoErrorCallback.cpp \
        DerivedSources/WebCore/JSStorageInfoErrorCallback.h \
+       DerivedSources/WebCore/JSStorageInfoQuotaCallback.cpp \
+       DerivedSources/WebCore/JSStorageInfoQuotaCallback.h \
        DerivedSources/WebCore/JSStorageInfoUsageCallback.cpp \
        DerivedSources/WebCore/JSStorageInfoUsageCallback.h
 endif # END ENABLE_QUOTA
index 26291ea..81b908c 100644 (file)
@@ -443,6 +443,7 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSStorage.h \
        DerivedSources/WebCore/JSStorageInfo.h \
        DerivedSources/WebCore/JSStorageInfoErrorCallback.h \
+       DerivedSources/WebCore/JSStorageInfoQuotaCallback.h \
        DerivedSources/WebCore/JSStorageInfoUsageCallback.h \
        DerivedSources/WebCore/JSStyleMedia.cpp \
        DerivedSources/WebCore/JSStyleMedia.h \
@@ -3208,6 +3209,7 @@ webcore_sources += \
        Source/WebCore/storage/StorageInfo.cpp \
        Source/WebCore/storage/StorageInfo.h \
        Source/WebCore/storage/StorageInfoErrorCallback.h \
+       Source/WebCore/storage/StorageInfoQuotaCallback.h \
        Source/WebCore/storage/StorageInfoUsageCallback.h \
        Source/WebCore/storage/StorageMap.cpp \
        Source/WebCore/storage/StorageMap.h \
index 2d68d8b..8628dcf 100644 (file)
             'storage/StorageEvent.idl',
             'storage/StorageInfo.idl',
             'storage/StorageInfoErrorCallback.idl',
+            'storage/StorageInfoQuotaCallback.idl',
             'storage/StorageInfoUsageCallback.idl',
             'webaudio/AudioBuffer.idl',
             'webaudio/AudioBufferSourceNode.idl',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorageInfo.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorageInfoErrorCallback.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorageInfoErrorCallback.h',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorageInfoQuotaCallback.cpp',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorageInfoQuotaCallback.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorageInfoUsageCallback.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorageInfoUsageCallback.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStyleMedia.cpp',
index 1288a88..43261b3 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSStorageInfoQuotaCallback.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSStorageInfoQuotaCallback.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSStorageInfoUsageCallback.cpp"
                                >
                        </File>
index 2ec8261..669315d 100644 (file)
                892CF20C134C8BB300AAEDA1 /* JSStorageInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 892CF204134C8BB300AAEDA1 /* JSStorageInfo.h */; };
                892CF20D134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 892CF205134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.cpp */; };
                892CF20E134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 892CF206134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.h */; };
+               892CF20F134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 892CF207134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.cpp */; };
+               892CF210134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 892CF208134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.h */; };
                892CF211134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 892CF209134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.cpp */; };
                892CF212134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 892CF20A134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.h */; };
                893C47A71238908B002B3D86 /* FileCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 893C47A51238908B002B3D86 /* FileCallback.h */; };
                                892CF204134C8BB300AAEDA1 /* JSStorageInfo.h */,
                                892CF205134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.cpp */,
                                892CF206134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.h */,
+                               892CF207134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.cpp */,
+                               892CF208134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.h */,
                                892CF209134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.cpp */,
                                892CF20A134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.h */,
                        );
                                51E0BAEB0DA55D4A00A9E417 /* JSStorageEvent.h in Headers */,
                                892CF20C134C8BB300AAEDA1 /* JSStorageInfo.h in Headers */,
                                892CF20E134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.h in Headers */,
+                               892CF210134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.h in Headers */,
                                892CF212134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.h in Headers */,
                                0FF5026A102BA9430066F39A /* JSStyleMedia.h in Headers */,
                                BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */,
                                51E0BAEA0DA55D4A00A9E417 /* JSStorageEvent.cpp in Sources */,
                                892CF20B134C8BB300AAEDA1 /* JSStorageInfo.cpp in Sources */,
                                892CF20D134C8BB300AAEDA1 /* JSStorageInfoErrorCallback.cpp in Sources */,
+                               892CF20F134C8BB300AAEDA1 /* JSStorageInfoQuotaCallback.cpp in Sources */,
                                892CF211134C8BB300AAEDA1 /* JSStorageInfoUsageCallback.cpp in Sources */,
                                0FF50269102BA9430066F39A /* JSStyleMedia.cpp in Sources */,
                                BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */,
index c75b72b..16af440 100644 (file)
@@ -33,5 +33,6 @@ module storage {
         const unsigned short PERSISTENT = 1;
 
         [CallWith=ScriptExecutionContext] void queryUsageAndQuota(in unsigned short storageType, in [Callback, Optional] StorageInfoUsageCallback usageCallback, in [Callback, Optional] StorageInfoErrorCallback errorCallback);
+        [CallWith=ScriptExecutionContext] void requestQuota(in unsigned short storageType, in unsigned long long newQuotaInBytes, in [Callback, Optional] StorageInfoQuotaCallback quotaCallback, in [Callback, Optional] StorageInfoErrorCallback errorCallback);
     };
 }
diff --git a/Source/WebCore/storage/StorageInfoQuotaCallback.idl b/Source/WebCore/storage/StorageInfoQuotaCallback.idl
new file mode 100644 (file)
index 0000000..1c8e11c
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+    interface [
+        Conditional=QUOTA,
+        Callback
+    ] StorageInfoQuotaCallback {
+        boolean handleEvent(in unsigned long long grantedQuotaInBytes);
+    };
+}