Changeset 135752 in webkit


Ignore:
Timestamp:
Nov 26, 2012, 12:17:36 PM (12 years ago)
Author:
commit-queue@webkit.org
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 Dumez> 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):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r135748 r135752  
     12012-11-26  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [EFL][WK2] Add setting to enable / disable HTML5 local storage functionality
     4        https://bugs.webkit.org/show_bug.cgi?id=103224
     5
     6        Reviewed by Laszlo Gombos.
     7
     8        Add API to ewk_settings to enable / disable the HTML5
     9        local storage functionality. The functionality is
     10        enabled by default.
     11
     12        * UIProcess/API/efl/ewk_settings.cpp:
     13        (ewk_settings_local_storage_enabled_set):
     14        (ewk_settings_local_storage_enabled_get):
     15        * UIProcess/API/efl/ewk_settings.h:
     16        * UIProcess/API/efl/tests/test_ewk2_settings.cpp:
     17        (TEST_F): Add API test for ewk_settings_local_storage_enabled_get / set.
     18
    1192012-11-26  Rafael Brandao  <rafael.lobo@openbossa.org>
    220
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp

    r135117 r135752  
    333333    return settings->preferences()->javaScriptCanOpenWindowsAutomatically();
    334334}
     335
     336Eina_Bool ewk_settings_local_storage_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
     337{
     338    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
     339
     340    settings->preferences()->setLocalStorageEnabled(enable);
     341
     342    return true;
     343}
     344
     345Eina_Bool ewk_settings_local_storage_enabled_get(const Ewk_Settings* settings)
     346{
     347    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
     348
     349    return settings->preferences()->localStorageEnabled();
     350}
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.h

    r135117 r135752  
    392392EAPI Eina_Bool ewk_settings_scripts_can_open_windows_get(const Ewk_Settings *settings);
    393393
     394/**
     395 * Enables/disables the HTML5 local storage functionality.
     396 *
     397 * Local storage provides simple synchronous storage access.
     398 * HTML5 local storage specification is available at
     399 * http://dev.w3.org/html5/webstorage/.
     400 *
     401 * By default, the HTML5 local storage is enabled.
     402 *
     403 * @param settings settings object to set the HTML5 local storage state
     404 * @param enable @c EINA_TRUE to enable HTML5 local storage,
     405 *        @c EINA_FALSE to disable
     406 *
     407 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
     408 */
     409EAPI Eina_Bool ewk_settings_local_storage_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
     410
     411/**
     412 * Returns whether the HTML5 local storage functionality is enabled or not.
     413 *
     414 * Local storage provides simple synchronous storage access.
     415 * HTML5 local storage specification is available at
     416 * http://dev.w3.org/html5/webstorage/.
     417 *
     418 * By default, the HTML5 local storage is enabled.
     419 *
     420 * @param settings settings object to query whether HTML5 local storage is enabled
     421 *
     422 * @return @c EINA_TRUE if the HTML5 local storage is enabled
     423 *         @c EINA_FALSE if disabled or on failure
     424 */
     425EAPI Eina_Bool ewk_settings_local_storage_enabled_get(const Ewk_Settings *settings);
     426
    394427#ifdef __cplusplus
    395428}
  • trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp

    r135349 r135752  
    208208    ASSERT_FALSE(ewk_settings_scripts_can_open_windows_get(settings));
    209209}
     210
     211TEST_F(EWK2UnitTestBase, ewk_settings_local_storage_enabled)
     212{
     213    Ewk_Settings* settings = ewk_view_settings_get(webView());
     214
     215    // HTML5 local storage should be enabled by default.
     216    ASSERT_TRUE(ewk_settings_local_storage_enabled_get(settings));
     217
     218    ASSERT_TRUE(ewk_settings_local_storage_enabled_set(settings, false));
     219    ASSERT_FALSE(ewk_settings_local_storage_enabled_get(settings));
     220
     221    ASSERT_TRUE(ewk_settings_local_storage_enabled_set(settings, true));
     222    ASSERT_TRUE(ewk_settings_local_storage_enabled_get(settings));
     223}
  • trunk/Tools/ChangeLog

    r135744 r135752  
     12012-11-26  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [EFL][WK2] Add setting to enable / disable HTML5 local storage functionality
     4        https://bugs.webkit.org/show_bug.cgi?id=103224
     5
     6        Reviewed by Laszlo Gombos.
     7
     8        Add --local-storage command line argument to MiniBrowser to
     9        explicitely disable HTML5 local storage functionality. This
     10        is useful for testing purposes.
     11
     12        * MiniBrowser/efl/main.c:
     13        (window_create):
     14        (elm_main):
     15
    1162012-11-26  Zan Dobersek  <zandobersek@gmail.com>
    217
  • trunk/Tools/MiniBrowser/efl/main.c

    r135372 r135752  
    4242static Eina_Bool encoding_detector_enabled = EINA_FALSE;
    4343static Eina_Bool frame_flattening_enabled = EINA_FALSE;
     44static Eina_Bool local_storage_enabled = EINA_TRUE;
    4445static int window_width = 800;
    4546static int window_height = 600;
     
    7980    "%prog [options] [url]",
    8081    "0.0.1",
    81     "(C)2012 Samsung Electronics\n",
     82    "(C)2012 Samsung Electronics\n (C)2012 Intel Corporation\n",
    8283    "",
    83     "Test Web Browser using the Enlightenment Foundation Libraries of WebKit2",
     84    "Test Web Browser using the Enlightenment Foundation Libraries (EFL) port of WebKit2",
    8485    EINA_TRUE, {
    8586        ECORE_GETOPT_STORE_STR
     
    9697        ECORE_GETOPT_STORE_DEF_BOOL
    9798            ('f', "flattening", "frame flattening.", EINA_FALSE),
     99        ECORE_GETOPT_STORE_DEF_BOOL
     100            ('l', "local-storage", "HTML5 local storage support (enabled by default).", EINA_TRUE),
    98101        ECORE_GETOPT_VERSION
    99102            ('V', "version"),
     
    10641067    ewk_settings_encoding_detector_enabled_set(settings, encoding_detector_enabled);
    10651068    ewk_settings_frame_flattening_enabled_set(settings, frame_flattening_enabled);
     1069    ewk_settings_local_storage_enabled_set(settings, local_storage_enabled);
     1070    info("HTML5 local storage is %s for this view.\n", local_storage_enabled ? "enabled" : "disabled");
    10661071    ewk_settings_developer_extras_enabled_set(settings, EINA_TRUE);
    10671072    ewk_settings_preferred_minimum_contents_width_set(settings, 0);
     
    11401145        ECORE_GETOPT_VALUE_BOOL(encoding_detector_enabled),
    11411146        ECORE_GETOPT_VALUE_BOOL(frame_flattening_enabled),
     1147        ECORE_GETOPT_VALUE_BOOL(local_storage_enabled),
    11421148        ECORE_GETOPT_VALUE_BOOL(quitOption),
    11431149        ECORE_GETOPT_VALUE_BOOL(quitOption),
Note: See TracChangeset for help on using the changeset viewer.