Title: [117258] trunk
Revision
117258
Author
[email protected]
Date
2012-05-16 04:26:49 -0700 (Wed, 16 May 2012)

Log Message

[EFL] EFL's LayoutTestController does not implement setApplicationCacheOriginQuota
https://bugs.webkit.org/show_bug.cgi?id=85585

Patch by Christophe Dumez <[email protected]> on 2012-05-16
Reviewed by Gustavo Noronha Silva.

Source/WebKit/efl:

Add new function to Ewk_Security_Origin to set the application cache
quota. Implement reachedApplicationCacheOriginQuota in
ChromeClientEfl. Add function to the Ewk_View to report that the
application cache quota was reached.

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::reachedApplicationCacheOriginQuota):
* ewk/ewk_security_origin.cpp:
(ewk_security_origin_application_cache_quota_set):
* ewk/ewk_security_origin.h:
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(ewk_view_exceeded_application_cache_quota):
* ewk/ewk_view.h:
* ewk/ewk_view_private.h:

Tools:

Implement setApplicationCacheOriginQuota in EFL's
LayoutTestController.

* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(DumpRenderTreeChrome::resetDefaultsToConsistentValues):
* DumpRenderTree/efl/DumpRenderTreeView.cpp:
(onExceededApplicationCacheQuota):
(drtViewAdd):
* DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
(LayoutTestController::setApplicationCacheOriginQuota):

LayoutTests:

Unskip the test cases that require implementation of
setApplicationCacheOriginQuota in EFL's LayoutTestController.

* platform/efl/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117257 => 117258)


--- trunk/LayoutTests/ChangeLog	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/LayoutTests/ChangeLog	2012-05-16 11:26:49 UTC (rev 117258)
@@ -1,5 +1,17 @@
 2012-05-16  Christophe Dumez  <[email protected]>
 
+        [EFL] EFL's LayoutTestController does not implement setApplicationCacheOriginQuota
+        https://bugs.webkit.org/show_bug.cgi?id=85585
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Unskip the test cases that require implementation of
+        setApplicationCacheOriginQuota in EFL's LayoutTestController.
+
+        * platform/efl/Skipped:
+
+2012-05-16  Christophe Dumez  <[email protected]>
+
         [EFL] A few tests need expected result or rebaselining
         https://bugs.webkit.org/show_bug.cgi?id=86595
 

Modified: trunk/LayoutTests/platform/efl/Skipped (117257 => 117258)


--- trunk/LayoutTests/platform/efl/Skipped	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/LayoutTests/platform/efl/Skipped	2012-05-16 11:26:49 UTC (rev 117258)
@@ -277,24 +277,25 @@
 # EFL's LayoutTestController does not implement setCacheModel
 fast/dom/HTMLScriptElement/nested-execution.html
 
-# EFL's LayoutTestController does not implement setApplicationCacheOriginQuota
-http/tests/appcache
+# EFL's LayoutTestController does not implement setDomainRelaxationForbiddenForURLScheme
+http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
 
+# EFL's LayoutTestController overridePreference does not implement WebKitUsePreHTML5ParserQuirks preference
+fast/parser/pre-html5-parser-quirks.html
+
+# Fallback resource wasn't used for a redirect to a resource with another origin
+http/tests/appcache/fallback.html
+
 # EFL's LayoutTestController does not implement clearApplicationCacheForOrigin
-http/tests/appcache
+http/tests/appcache/origin-delete.html
+http/tests/appcache/origin-usage.html
 
-# EFL's LayoutTestController does not implement originsWithApplicationCache
-http/tests/appcache
-
 # EFL's LayoutTestController does not implement applicationCacheDiskUsageForOrigin
-http/tests/appcache
+http/tests/appcache/origin-usage.html
 
-# EFL's LayoutTestController does not implement setDomainRelaxationForbiddenForURLScheme
-http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
+# EFL's LayoutTestController does not implement originsWithApplicationCache
+http/tests/appcache/origins-with-appcache.html
 
-# EFL's LayoutTestController overridePreference does not implement WebKitUsePreHTML5ParserQuirks preference
-fast/parser/pre-html5-parser-quirks.html
-
 # EFL's LayoutTestController overridePreference does not implement WebKitOfflineWebApplicationCacheEnabled preference
 http/tests/appcache/disabled.html
 

Modified: trunk/Source/WebKit/efl/ChangeLog (117257 => 117258)


--- trunk/Source/WebKit/efl/ChangeLog	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-05-16 11:26:49 UTC (rev 117258)
@@ -1,3 +1,26 @@
+2012-05-16  Christophe Dumez  <[email protected]>
+
+        [EFL] EFL's LayoutTestController does not implement setApplicationCacheOriginQuota
+        https://bugs.webkit.org/show_bug.cgi?id=85585
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Add new function to Ewk_Security_Origin to set the application cache
+        quota. Implement reachedApplicationCacheOriginQuota in
+        ChromeClientEfl. Add function to the Ewk_View to report that the
+        application cache quota was reached.
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::reachedApplicationCacheOriginQuota):
+        * ewk/ewk_security_origin.cpp:
+        (ewk_security_origin_application_cache_quota_set):
+        * ewk/ewk_security_origin.h:
+        * ewk/ewk_view.cpp:
+        (_Ewk_View_Private_Data):
+        (ewk_view_exceeded_application_cache_quota):
+        * ewk/ewk_view.h:
+        * ewk/ewk_view_private.h:
+
 2012-05-16  Mikhail Pozdnyakov  <[email protected]>
 
         [EFL] EFL's LayoutTestController  evaluateScriptInIsolatedWorld implementation

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp (117257 => 117258)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2012-05-16 11:26:49 UTC (rev 117258)
@@ -34,6 +34,7 @@
 #include "config.h"
 #include "ChromeClientEfl.h"
 
+#include "ApplicationCacheStorage.h"
 #include "FileChooser.h"
 #include "FileIconLoader.h"
 #include "FloatRect.h"
@@ -53,6 +54,7 @@
 #include "WindowFeatures.h"
 #include "ewk_frame_private.h"
 #include "ewk_private.h"
+#include "ewk_security_origin_private.h"
 #include "ewk_view_private.h"
 #include <Ecore_Evas.h>
 #include <Evas.h>
@@ -395,9 +397,16 @@
     notImplemented();
 }
 
-void ChromeClientEfl::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
+void ChromeClientEfl::reachedApplicationCacheOriginQuota(SecurityOrigin* origin, int64_t totalSpaceNeeded)
 {
-    notImplemented();
+    Ewk_Security_Origin* ewkOrigin = ewk_security_origin_new(origin);
+    int64_t defaultOriginQuota = WebCore::cacheStorage().defaultOriginQuota();
+
+    int64_t newQuota = ewk_view_exceeded_application_cache_quota(m_view, ewkOrigin, defaultOriginQuota, totalSpaceNeeded);
+    if (newQuota)
+        ewk_security_origin_application_cache_quota_set(ewkOrigin, newQuota);
+
+    ewk_security_origin_free(ewkOrigin);
 }
 
 #if ENABLE(TOUCH_EVENTS)

Modified: trunk/Source/WebKit/efl/ewk/ewk_security_origin.cpp (117257 => 117258)


--- trunk/Source/WebKit/efl/ewk/ewk_security_origin.cpp	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Source/WebKit/efl/ewk/ewk_security_origin.cpp	2012-05-16 11:26:49 UTC (rev 117258)
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "ewk_security_origin.h"
 
+#include "ApplicationCacheStorage.h"
 #include "DatabaseTracker.h"
 #include "SecurityOrigin.h"
 #include "ewk_private.h"
@@ -79,6 +80,11 @@
 #endif
 }
 
+void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin* origin, int64_t quota)
+{
+    WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin->securityOrigin.get(), quota);
+}
+
 void ewk_security_origin_free(Ewk_Security_Origin* origin)
 {
     origin->securityOrigin = 0;

Modified: trunk/Source/WebKit/efl/ewk/ewk_security_origin.h (117257 => 117258)


--- trunk/Source/WebKit/efl/ewk/ewk_security_origin.h	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Source/WebKit/efl/ewk/ewk_security_origin.h	2012-05-16 11:26:49 UTC (rev 117258)
@@ -110,6 +110,14 @@
 EAPI void         ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin *o, uint64_t quota);
 
 /**
+ * Sets the application cache usage quota for a security origin.
+ *
+ * @param o security origin object
+ * @param quota the usage quota in bytes
+ */
+EAPI void         ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin *o, int64_t quota);
+
+/**
  * Release all resources allocated by a security origin object.
  *
  * @param o security origin object

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (117257 => 117258)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-05-16 11:26:49 UTC (rev 117258)
@@ -3499,6 +3499,30 @@
 
 /**
  * @internal
+ * This is called whenever the application is asking to store data to the cache and the
+ * quota allocated to that application is exceeded. Browser may use this to increase the
+ * size of quota before the originating operation fails.
+ *
+ * @param ewkView View.
+ * @param origin Security origin.
+ * @param defaultOriginQuota Default quota for origin.
+ * @param totalSpaceNeeded The total space needed in the cache in order to fulfill
+ * application's requirement.
+ */
+int64_t ewk_view_exceeded_application_cache_quota(Evas_Object* ewkView, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded)
+{
+    DBG("ewkView=%p", ewkView);
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, 0);
+    if (!smartData->api->exceeded_application_cache_quota)
+        return 0;
+
+    INF("defaultOriginQuota=%" PRIu64 " totalSpaceNeeded=%" PRIu64, defaultOriginQuota, totalSpaceNeeded);
+    return smartData->api->exceeded_application_cache_quota(smartData, origin, defaultOriginQuota, totalSpaceNeeded);
+}
+
+/**
+ * @internal
  * This is called whenever the web site shown in @param frame is asking to store data
  * to the database @param databaseName and the quota allocated to that web site
  * is exceeded. Browser may use this to increase the size of quota before the

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (117257 => 117258)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-05-16 11:26:49 UTC (rev 117258)
@@ -174,6 +174,7 @@
     Eina_Bool (*run_javascript_confirm)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message);
     Eina_Bool (*run_javascript_prompt)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message, const char *defaultValue, char **value);
     Eina_Bool (*should_interrupt_javascript)(Ewk_View_Smart_Data *sd);
+    uint64_t (*exceeded_application_cache_quota)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin* origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded);
     uint64_t (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size);
 
     Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames);
@@ -186,7 +187,7 @@
  * The version you have to put into the version field
  * in the @a Ewk_View_Smart_Class structure.
  */
-#define EWK_VIEW_SMART_CLASS_VERSION 4UL
+#define EWK_VIEW_SMART_CLASS_VERSION 5UL
 
 /**
  * Initializes a whole @a Ewk_View_Smart_Class structure.

Modified: trunk/Source/WebKit/efl/ewk/ewk_view_private.h (117257 => 117258)


--- trunk/Source/WebKit/efl/ewk/ewk_view_private.h	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Source/WebKit/efl/ewk/ewk_view_private.h	2012-05-16 11:26:49 UTC (rev 117258)
@@ -89,6 +89,7 @@
 bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, Evas_Object* frame, const char* message);
 bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, char** value);
 bool ewk_view_should_interrupt_javascript(Evas_Object* ewkView);
+int64_t ewk_view_exceeded_application_cache_quota(Evas_Object* ewkView, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded);
 uint64_t ewk_view_exceeded_database_quota(Evas_Object* ewkView, Evas_Object* frame, const char* databaseName, uint64_t currentSize, uint64_t expectedSize);
 
 bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const Vector<String>& acceptMIMETypes, Eina_List** selectedFilenames);

Modified: trunk/Tools/ChangeLog (117257 => 117258)


--- trunk/Tools/ChangeLog	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Tools/ChangeLog	2012-05-16 11:26:49 UTC (rev 117258)
@@ -1,3 +1,21 @@
+2012-05-16  Christophe Dumez  <[email protected]>
+
+        [EFL] EFL's LayoutTestController does not implement setApplicationCacheOriginQuota
+        https://bugs.webkit.org/show_bug.cgi?id=85585
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Implement setApplicationCacheOriginQuota in EFL's
+        LayoutTestController.
+
+        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+        (DumpRenderTreeChrome::resetDefaultsToConsistentValues):
+        * DumpRenderTree/efl/DumpRenderTreeView.cpp:
+        (onExceededApplicationCacheQuota):
+        (drtViewAdd):
+        * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+        (LayoutTestController::setApplicationCacheOriginQuota):
+
 2012-05-16  Mikhail Pozdnyakov  <[email protected]>
 
         [EFL] EFL's LayoutTestController  evaluateScriptInIsolatedWorld implementation

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp (117257 => 117258)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-05-16 11:26:49 UTC (rev 117258)
@@ -211,6 +211,7 @@
     ewk_settings_web_database_default_quota_set(5 * 1024 * 1024);
 
     ewk_settings_memory_cache_clear();
+    ewk_settings_application_cache_clear();
 
     ewk_view_setting_private_browsing_set(mainView(), EINA_FALSE);
     ewk_view_setting_spatial_navigation_set(mainView(), EINA_FALSE);

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp (117257 => 117258)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp	2012-05-16 11:26:49 UTC (rev 117258)
@@ -120,6 +120,27 @@
     return 5 * 1024 * 1024;
 }
 
+static uint64_t onExceededApplicationCacheQuota(Ewk_View_Smart_Data*, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded)
+{
+    if (gLayoutTestController->dumpApplicationCacheDelegateCallbacks()) {
+        // For example, numbers from 30000 - 39999 will output as 30000.
+        // Rounding up or down does not really matter for these tests. It's
+        // sufficient to just get a range of 10000 to determine if we were
+        // above or below a threshold.
+        int64_t truncatedSpaceNeeded = (totalSpaceNeeded / 10000) * 10000;
+        printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i} totalSpaceNeeded:~%llu\n",
+               ewk_security_origin_protocol_get(origin),
+               ewk_security_origin_host_get(origin),
+               ewk_security_origin_port_get(origin),
+               truncatedSpaceNeeded);
+    }
+
+    if (gLayoutTestController->disallowIncreaseForApplicationCacheQuota())
+        return 0;
+
+    return defaultOriginQuota;
+}
+
 static bool shouldUseSingleBackingStore()
 {
     const char* useSingleBackingStore = getenv("DRT_USE_SINGLE_BACKING_STORE");
@@ -147,6 +168,7 @@
     api.run_javascript_prompt = onJavaScriptPrompt;
     api.window_create = onWindowCreate;
     api.window_close = onWindowClose;
+    api.exceeded_application_cache_quota = onExceededApplicationCacheQuota;
     api.exceeded_database_quota = onExceededDatabaseQuota;
 
     return evas_object_smart_add(evas, evas_smart_class_new(&api.sc));

Modified: trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp (117257 => 117258)


--- trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-05-16 11:20:21 UTC (rev 117257)
+++ trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-05-16 11:26:49 UTC (rev 117258)
@@ -543,10 +543,11 @@
     ewk_settings_application_cache_clear();
 }
 
-void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long)
+void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota)
 {
-    // FIXME: Implement to support application cache quotas.
-    notImplemented();
+    Ewk_Security_Origin* origin = ewk_frame_security_origin_get(browser->mainFrame());
+    ewk_security_origin_application_cache_quota_set(origin, quota);
+    ewk_security_origin_free(origin);
 }
 
 void LayoutTestController::clearApplicationCacheForOrigin(OpaqueJSString*)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to