• commit-queue@webkit.org's avatar
    [GTK] Allow passing extra data to web extensions · 4c113670
    commit-queue@webkit.org authored
    Patch by Adrian Perez de Castro <aperez@igalia.com> on 2014-01-21
    Reviewed by Carlos Garcia Campos.
    Allow passing additional information to the injected bundle. On top
    of the string containing the path to the web extensions directory,
    a GVariant can be set with additional data using
    Also, a new initialize-web-extensions signal is emitted before
    launching a new WebProcess to allow setting different user data
    for each process. The GVariant is serialized as a string, passed
    to the injected bundle, and the injected bundle deserializes back
    the data, which is passed to web extensions which define the
    webkit_web_extension_initialize_with_user_data() function (for
    backwards compatibility, webkit_web_extension_initialize() is
    used as a fallback.)
    * UIProcess/API/gtk/WebKitInjectedBundleClient.cpp:
    (getInjectedBundleInitializationUserData): Define new callback
    function which causes emission of the initialize-web-extensions
    signal, and serializes the data to be passed to the web process.
    (attachInjectedBundleClientToContext): Set the
    getInjectedBundleInitializationUserData() callback.
    * UIProcess/API/gtk/WebKitWebContext.cpp:
    (webkit_web_context_class_init): Define the
    initialize-web-extensions signal.
    Web extensions directory as now member of WebKitWebContextPrivate,
    to be able to retrieve it later.
    New API method to set the user data passed to the web extensions
    when initialized.
    (webkitWebContextInitializeWebExtensions): Private function used
    to trigger emission of the initialize-web-extensions signal.
    * UIProcess/API/gtk/WebKitWebContext.h:
    Added prototype for new API method
    * UIProcess/API/gtk/WebKitWebContextPrivate.h:
    Prototype of the new private function.
    * UIProcess/API/gtk/docs/webkit2gtk-sections.txt:
    Add new public API bits to the documentation.
    * WebProcess/gtk/WebGtkExtensionManager.cpp:
    Deserialize the data received from the UI process and pass it to
    webkit_web_extension_initialize_with_user_data() if available,
    keeping webkit_web_extension_initialize() as fallback.
    * TestWebKitAPI/Tests/WebKit2Gtk/TestWebExtensions.cpp:
    (initializeWebExtensions): Handles the initialize-web-extensions
    signal, and sets the web extensions directory and the initialization
    user data.
    (testWebExtensionInitializationUserData): New test case for checking
    the user data passed on initialization to web extensions.
    * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
    (methodCallCallback): Added implementation for the
    GetInitializationUserData D-Bus method, used by
    (webkit_web_extension_initialize_with_user_data): Define the
    initialization function with the additional user data parameter.
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162441 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ChangeLog 949 KB