Title: [135752] trunk
Revision
135752
Author
commit-qu...@webkit.org
Date
2012-11-26 12:17:36 -0800 (Mon, 26 Nov 2012)

Log Message

[EFL][WK2] Add setting to enable / disable HTML5 local storage functionality
https://bugs.webkit.org/show_bug.cgi?id=103224

Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-11-26
Reviewed by Laszlo Gombos.

Source/WebKit2:

Add API to ewk_settings to enable / disable the HTML5
local storage functionality. The functionality is
enabled by default.

* UIProcess/API/efl/ewk_settings.cpp:
(ewk_settings_local_storage_enabled_set):
(ewk_settings_local_storage_enabled_get):
* UIProcess/API/efl/ewk_settings.h:
* UIProcess/API/efl/tests/test_ewk2_settings.cpp:
(TEST_F): Add API test for ewk_settings_local_storage_enabled_get / set.

Tools:

Add --local-storage command line argument to MiniBrowser to
explicitely disable HTML5 local storage functionality. This
is useful for testing purposes.

* MiniBrowser/efl/main.c:
(window_create):
(elm_main):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (135751 => 135752)


--- trunk/Source/WebKit2/ChangeLog	2012-11-26 20:02:10 UTC (rev 135751)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-26 20:17:36 UTC (rev 135752)
@@ -1,3 +1,21 @@
+2012-11-26  Christophe Dumez  <christophe.du...@intel.com>
+
+        [EFL][WK2] Add setting to enable / disable HTML5 local storage functionality
+        https://bugs.webkit.org/show_bug.cgi?id=103224
+
+        Reviewed by Laszlo Gombos.
+
+        Add API to ewk_settings to enable / disable the HTML5
+        local storage functionality. The functionality is
+        enabled by default.
+
+        * UIProcess/API/efl/ewk_settings.cpp:
+        (ewk_settings_local_storage_enabled_set):
+        (ewk_settings_local_storage_enabled_get):
+        * UIProcess/API/efl/ewk_settings.h:
+        * UIProcess/API/efl/tests/test_ewk2_settings.cpp:
+        (TEST_F): Add API test for ewk_settings_local_storage_enabled_get / set.
+
 2012-11-26  Rafael Brandao  <rafael.l...@openbossa.org>
 
         [CoordinatedGraphics] Access to LayerTreeRenderer::m_renderQueue should be thread safe

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp (135751 => 135752)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp	2012-11-26 20:02:10 UTC (rev 135751)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp	2012-11-26 20:17:36 UTC (rev 135752)
@@ -332,3 +332,19 @@
 
     return settings->preferences()->_javascript_CanOpenWindowsAutomatically();
 }
+
+Eina_Bool ewk_settings_local_storage_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+    settings->preferences()->setLocalStorageEnabled(enable);
+
+    return true;
+}
+
+Eina_Bool ewk_settings_local_storage_enabled_get(const Ewk_Settings* settings)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+    return settings->preferences()->localStorageEnabled();
+}

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.h (135751 => 135752)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.h	2012-11-26 20:02:10 UTC (rev 135751)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.h	2012-11-26 20:17:36 UTC (rev 135752)
@@ -391,6 +391,39 @@
  */
 EAPI Eina_Bool ewk_settings_scripts_can_open_windows_get(const Ewk_Settings *settings);
 
+/**
+ * Enables/disables the HTML5 local storage functionality.
+ *
+ * Local storage provides simple synchronous storage access.
+ * HTML5 local storage specification is available at
+ * http://dev.w3.org/html5/webstorage/.
+ *
+ * By default, the HTML5 local storage is enabled.
+ *
+ * @param settings settings object to set the HTML5 local storage state
+ * @param enable @c EINA_TRUE to enable HTML5 local storage,
+ *        @c EINA_FALSE to disable
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_settings_local_storage_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
+
+/**
+ * Returns whether the HTML5 local storage functionality is enabled or not.
+ *
+ * Local storage provides simple synchronous storage access.
+ * HTML5 local storage specification is available at
+ * http://dev.w3.org/html5/webstorage/.
+ *
+ * By default, the HTML5 local storage is enabled.
+ *
+ * @param settings settings object to query whether HTML5 local storage is enabled
+ *
+ * @return @c EINA_TRUE if the HTML5 local storage is enabled
+ *         @c EINA_FALSE if disabled or on failure
+ */
+EAPI Eina_Bool ewk_settings_local_storage_enabled_get(const Ewk_Settings *settings);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp (135751 => 135752)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp	2012-11-26 20:02:10 UTC (rev 135751)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp	2012-11-26 20:17:36 UTC (rev 135752)
@@ -207,3 +207,17 @@
     ASSERT_TRUE(ewk_settings_scripts_can_open_windows_set(settings, false));
     ASSERT_FALSE(ewk_settings_scripts_can_open_windows_get(settings));
 }
+
+TEST_F(EWK2UnitTestBase, ewk_settings_local_storage_enabled)
+{
+    Ewk_Settings* settings = ewk_view_settings_get(webView());
+
+    // HTML5 local storage should be enabled by default.
+    ASSERT_TRUE(ewk_settings_local_storage_enabled_get(settings));
+
+    ASSERT_TRUE(ewk_settings_local_storage_enabled_set(settings, false));
+    ASSERT_FALSE(ewk_settings_local_storage_enabled_get(settings));
+
+    ASSERT_TRUE(ewk_settings_local_storage_enabled_set(settings, true));
+    ASSERT_TRUE(ewk_settings_local_storage_enabled_get(settings));
+}

Modified: trunk/Tools/ChangeLog (135751 => 135752)


--- trunk/Tools/ChangeLog	2012-11-26 20:02:10 UTC (rev 135751)
+++ trunk/Tools/ChangeLog	2012-11-26 20:17:36 UTC (rev 135752)
@@ -1,3 +1,18 @@
+2012-11-26  Christophe Dumez  <christophe.du...@intel.com>
+
+        [EFL][WK2] Add setting to enable / disable HTML5 local storage functionality
+        https://bugs.webkit.org/show_bug.cgi?id=103224
+
+        Reviewed by Laszlo Gombos.
+
+        Add --local-storage command line argument to MiniBrowser to
+        explicitely disable HTML5 local storage functionality. This
+        is useful for testing purposes.
+
+        * MiniBrowser/efl/main.c:
+        (window_create):
+        (elm_main):
+
 2012-11-26  Zan Dobersek  <zandober...@gmail.com>
 
         Remove use of deprecated logging from most of webkitpy.tool

Modified: trunk/Tools/MiniBrowser/efl/main.c (135751 => 135752)


--- trunk/Tools/MiniBrowser/efl/main.c	2012-11-26 20:02:10 UTC (rev 135751)
+++ trunk/Tools/MiniBrowser/efl/main.c	2012-11-26 20:17:36 UTC (rev 135752)
@@ -41,6 +41,7 @@
 static char *evas_engine_name = NULL;
 static Eina_Bool encoding_detector_enabled = EINA_FALSE;
 static Eina_Bool frame_flattening_enabled = EINA_FALSE;
+static Eina_Bool local_storage_enabled = EINA_TRUE;
 static int window_width = 800;
 static int window_height = 600;
 /* Default value of device_pixel_ratio is '0' so that we don't set custom device
@@ -78,9 +79,9 @@
     "MiniBrowser",
     "%prog [options] [url]",
     "0.0.1",
-    "(C)2012 Samsung Electronics\n",
+    "(C)2012 Samsung Electronics\n (C)2012 Intel Corporation\n",
     "",
-    "Test Web Browser using the Enlightenment Foundation Libraries of WebKit2",
+    "Test Web Browser using the Enlightenment Foundation Libraries (EFL) port of WebKit2",
     EINA_TRUE, {
         ECORE_GETOPT_STORE_STR
             ('e', "engine", "ecore-evas engine to use."),
@@ -95,6 +96,8 @@
             ('c', "encoding-detector", "enable/disable encoding detector", EINA_FALSE),
         ECORE_GETOPT_STORE_DEF_BOOL
             ('f', "flattening", "frame flattening.", EINA_FALSE),
+        ECORE_GETOPT_STORE_DEF_BOOL
+            ('l', "local-storage", "HTML5 local storage support (enabled by default).", EINA_TRUE),
         ECORE_GETOPT_VERSION
             ('V', "version"),
         ECORE_GETOPT_COPYRIGHT
@@ -1063,6 +1066,8 @@
     ewk_settings_file_access_from_file_urls_allowed_set(settings, EINA_TRUE);
     ewk_settings_encoding_detector_enabled_set(settings, encoding_detector_enabled);
     ewk_settings_frame_flattening_enabled_set(settings, frame_flattening_enabled);
+    ewk_settings_local_storage_enabled_set(settings, local_storage_enabled);
+    info("HTML5 local storage is %s for this view.\n", local_storage_enabled ? "enabled" : "disabled");
     ewk_settings_developer_extras_enabled_set(settings, EINA_TRUE);
     ewk_settings_preferred_minimum_contents_width_set(settings, 0);
 
@@ -1139,6 +1144,7 @@
         ECORE_GETOPT_VALUE_BOOL(quitOption),
         ECORE_GETOPT_VALUE_BOOL(encoding_detector_enabled),
         ECORE_GETOPT_VALUE_BOOL(frame_flattening_enabled),
+        ECORE_GETOPT_VALUE_BOOL(local_storage_enabled),
         ECORE_GETOPT_VALUE_BOOL(quitOption),
         ECORE_GETOPT_VALUE_BOOL(quitOption),
         ECORE_GETOPT_VALUE_BOOL(quitOption),
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to