Changeset 184851 in webkit


Ignore:
Timestamp:
May 25, 2015 8:15:38 AM (9 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Add construct property to WebKitWebContext to set the IndexedDB database directory
https://bugs.webkit.org/show_bug.cgi?id=140882

Reviewed by Gustavo Noronha Silva.

Source/WebKit2:

Add WebKitWebContext:indexed-db-database-directory construct only property.

  • UIProcess/API/gtk/WebKitWebContext.cpp:

(webkitWebContextGetProperty):
(webkitWebContextSetProperty):
(webkitWebContextConstructed):
(webkit_web_context_class_init):

Tools:

Make sure unit tests write IndexedDB databases to the temporary
directory, and add a test case to check that the directory is
correctly created at the expected path.

  • TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:

(testWebContextConfiguration):
(serverCallback):

  • TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:

(Test::Test):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r184846 r184851  
     12015-05-25  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Add construct property to WebKitWebContext to set the IndexedDB database directory
     4        https://bugs.webkit.org/show_bug.cgi?id=140882
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Add WebKitWebContext:indexed-db-database-directory construct only property.
     9
     10        * UIProcess/API/gtk/WebKitWebContext.cpp:
     11        (webkitWebContextGetProperty):
     12        (webkitWebContextSetProperty):
     13        (webkitWebContextConstructed):
     14        (webkit_web_context_class_init):
     15
    1162015-05-24  Sam Weinig  <sam@webkit.org>
    217
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp

    r184334 r184851  
    103103    PROP_0,
    104104
    105     PROP_LOCAL_STORAGE_DIRECTORY
     105    PROP_LOCAL_STORAGE_DIRECTORY,
     106    PROP_INDEXED_DB_DIRECTORY
    106107};
    107108
     
    183184
    184185    CString localStorageDirectory;
     186    CString indexedDBDirectory;
    185187};
    186188
     
    236238        g_value_set_string(value, context->priv->localStorageDirectory.data());
    237239        break;
     240    case PROP_INDEXED_DB_DIRECTORY:
     241        g_value_set_string(value, context->priv->indexedDBDirectory.data());
     242        break;
    238243    default:
    239244        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
     
    249254        context->priv->localStorageDirectory = g_value_get_string(value);
    250255        break;
     256    case PROP_INDEXED_DB_DIRECTORY:
     257        context->priv->indexedDBDirectory = g_value_get_string(value);
     258        break;
    251259    default:
    252260        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
     
    267275    if (!priv->localStorageDirectory.isNull())
    268276        configuration->setLocalStorageDirectory(WebCore::filenameToString(priv->localStorageDirectory.data()));
     277    if (!priv->indexedDBDirectory.isNull())
     278        configuration->setIndexedDBDatabaseDirectory(WebCore::filenameToString(priv->indexedDBDirectory.data()));
    269279
    270280    priv->context = WebProcessPool::create(configuration.get());
     
    329339            _("Local Storage Directory"),
    330340            _("The directory where local storage data will be saved"),
     341            nullptr,
     342            static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
     343
     344    /**
     345     * WebKitWebContext:indexed-db-directory:
     346     *
     347     * The directory where IndexedDB databases will be saved.
     348     *
     349     * Since: 2.10
     350     */
     351    g_object_class_install_property(
     352        gObjectClass,
     353        PROP_INDEXED_DB_DIRECTORY,
     354        g_param_spec_string(
     355            "indexed-db-directory",
     356            _("IndexedDB Directory"),
     357            _("The directory where IndexedDB databases will be saved"),
    331358            nullptr,
    332359            static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
  • trunk/Tools/ChangeLog

    r184850 r184851  
     12015-05-25  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Add construct property to WebKitWebContext to set the IndexedDB database directory
     4        https://bugs.webkit.org/show_bug.cgi?id=140882
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Make sure unit tests write IndexedDB databases to the temporary
     9        directory, and add a test case to check that the directory is
     10        correctly created at the expected path.
     11
     12        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
     13        (testWebContextConfiguration):
     14        (serverCallback):
     15        * TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:
     16        (Test::Test):
     17
    1182015-05-25  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp

    r183992 r184851  
    4242    GUniquePtr<char> localStorageDirectory(g_build_filename(Test::dataDirectory(), "local-storage", nullptr));
    4343    g_assert(g_file_test(localStorageDirectory.get(), G_FILE_TEST_IS_DIR));
     44
     45    test->loadURI(kServer->getURIForPath("/empty").data());
     46    test->waitUntilLoadFinished();
     47    test->runJavaScriptAndWaitUntilFinished("window.indexedDB.open('TestDatabase');", nullptr);
     48    GUniquePtr<char> indexedDBDirectory(g_build_filename(Test::dataDirectory(), "indexeddb", nullptr));
     49    g_assert(g_file_test(indexedDBDirectory.get(), G_FILE_TEST_IS_DIR));
    4450}
    4551
     
    331337        soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, acceptLanguage, strlen(acceptLanguage));
    332338        soup_message_body_complete(message->response_body);
     339    } else if (g_str_equal(path, "/empty")) {
     340        const char* emptyHTML = "<html><body></body></html>";
     341        soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, emptyHTML, strlen(emptyHTML));
     342        soup_message_body_complete(message->response_body);
     343        soup_message_set_status(message, SOUP_STATUS_OK);
    333344    } else
    334345        soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
  • trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h

    r177496 r184851  
    6969    {
    7070        GUniquePtr<char> localStorageDirectory(g_build_filename(dataDirectory(), "local-storage", nullptr));
    71         m_webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "local-storage-directory", localStorageDirectory.get(), nullptr)));
     71        GUniquePtr<char> indexedDBDirectory(g_build_filename(dataDirectory(), "indexeddb", nullptr));
     72        m_webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT,
     73            "local-storage-directory", localStorageDirectory.get(),
     74            "indexed-db-directory", indexedDBDirectory.get(),
     75            nullptr)));
    7276
    7377        g_signal_connect(m_webContext.get(), "initialize-web-extensions", G_CALLBACK(initializeWebExtensionsCallback), this);
Note: See TracChangeset for help on using the changeset viewer.