Changeset 112221 in webkit


Ignore:
Timestamp:
Mar 27, 2012 12:59:59 AM (12 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Add resources API to WebKit2 GTK+
https://bugs.webkit.org/show_bug.cgi?id=79477

Reviewed by Gustavo Noronha Silva.

  • GNUmakefile.am: Add new files to compilation.
  • UIProcess/API/gtk/WebKitResourceLoadClient.cpp: Added.

(didInitiateLoadForResource): Call
webkitWebViewResourceLoadStarted() so that view will create the
resource and emit WebKitWebView::resource-load-started.
(didSendRequestForResource): Call webkitWebResourceSentRequest()
with the given request and response.
(didReceiveResponseForResource): Call
webkitWebResourceSetResponse() with the given response.
(didReceiveContentLengthForResource): Call
webkitWebResourceNotifyProgress().
(didFinishLoadForResource): Call webkitWebResourceFinished().
(didFailLoadForResource): Create a GError for the given WKError
and call webkitWebResourceFailed().
(attachResourceLoadClientToView): Add callbacks for the
WKPageResourceLoadClient.

  • UIProcess/API/gtk/WebKitResourceLoadClient.h: Added.
  • UIProcess/API/gtk/WebKitWebResource.cpp: Added.

(webkitWebResourceGetProperty):
(webkit_web_resource_init):
(webkit_web_resource_class_init):
(webkitWebResourceUpdateURI): Update the active URI every time a
new request is sent to the server.
(webkitWebResourceCreate): Create a WebResource for the given
frame.
(webkitWebResourceSentRequest): Update uri and emit
WebKitWebResource::sent-request.
(webkitWebResourceSetResponse): Set the response property.
(webkitWebResourceNotifyProgress): Emit
WebKitWebResource::received-data.
(webkitWebResourceFinished): Emit WebKitWebResource::finished.
(webkitWebResourceFailed): Emit WebKitWebResource::failed and then
WebKitWebResource::finished.
(webkit_web_resource_get_uri): Return the currentr active URI.
(webkit_web_resource_get_response): Return the response received
from the server.

  • UIProcess/API/gtk/WebKitWebResource.h: Added.
  • UIProcess/API/gtk/WebKitWebResourcePrivate.h: Added.
  • UIProcess/API/gtk/WebKitWebView.cpp:

(webkitWebViewConstructed): Attach the resource load client to the
view.
(webkit_web_view_class_init): Add
WebKitWebView::resource-load-started signal.
(webkitWebViewLoadChanged): Clear loading resources map when a new
load starts and loaded resources map when the new load has been
committed.
(webkitWebViewResourceLoadStarted): Create a resource for the
given identifier, add it to the loading resources map and emit
WebKitWebView::resource-load-started signal.
(webkitWebViewGetLoadingWebResource): Return the resource that is
being loaded corresponding to the given identifier.
(webkitWebViewRemoveLoadingWebResource): Remove the resouurce
corresponfing to the given identifier from the loading resources
map.
(webkitWebViewResourceLoadFinished): Move the resource from the
loading resources map to the loaded resources map.
(webkit_web_view_get_main_resource): Return the main resource.
(webkit_web_view_get_subresources): Return the list of
subresources.

  • UIProcess/API/gtk/WebKitWebView.h:
  • UIProcess/API/gtk/WebKitWebViewPrivate.h:
  • UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for

WebKitWebResource.

  • UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
  • UIProcess/API/gtk/docs/webkit2gtk.types: Add

webkit_web_resource_get_type.

  • UIProcess/API/gtk/tests/GNUmakefile.am: Add new test for resources.
  • UIProcess/API/gtk/tests/TestDownloads.cpp:

(testDownloadLocalFile): Use getWebKit1TestResoucesDir() from Test.
(testDownloadLocalFileError): Ditto.
(serverCallback): Ditto.

  • UIProcess/API/gtk/tests/TestMain.h:

(Test::getWebKit1TestResoucesDir): Moed from TestDownloads so that
it can be used by other tests.
(Test): Add information about leaked objects.

  • UIProcess/API/gtk/tests/TestResources.cpp: Added.

(testWebViewResources):
(testWebResourceLoading):
(testWebResourceResponse):
(testWebResourceActiveURI):
(addCacheHTTPHeadersToResponse):
(serverCallback):
(beforeAll):
(afterAll):

  • UIProcess/API/gtk/webkit2.h: Include WebKitWebResource.h
  • UIProcess/API/gtk/webkit2marshal.list:
Location:
trunk/Source/WebKit2
Files:
6 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r112198 r112221  
     12012-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Add resources API to WebKit2 GTK+
     4        https://bugs.webkit.org/show_bug.cgi?id=79477
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        * GNUmakefile.am: Add new files to compilation.
     9        * UIProcess/API/gtk/WebKitResourceLoadClient.cpp: Added.
     10        (didInitiateLoadForResource): Call
     11        webkitWebViewResourceLoadStarted() so that view will create the
     12        resource and emit WebKitWebView::resource-load-started.
     13        (didSendRequestForResource): Call webkitWebResourceSentRequest()
     14        with the given request and response.
     15        (didReceiveResponseForResource): Call
     16        webkitWebResourceSetResponse() with the given response.
     17        (didReceiveContentLengthForResource): Call
     18        webkitWebResourceNotifyProgress().
     19        (didFinishLoadForResource): Call webkitWebResourceFinished().
     20        (didFailLoadForResource): Create a GError for the given WKError
     21        and call webkitWebResourceFailed().
     22        (attachResourceLoadClientToView): Add callbacks for the
     23        WKPageResourceLoadClient.
     24        * UIProcess/API/gtk/WebKitResourceLoadClient.h: Added.
     25        * UIProcess/API/gtk/WebKitWebResource.cpp: Added.
     26        (webkitWebResourceGetProperty):
     27        (webkit_web_resource_init):
     28        (webkit_web_resource_class_init):
     29        (webkitWebResourceUpdateURI): Update the active URI every time a
     30        new request is sent to the server.
     31        (webkitWebResourceCreate): Create a WebResource for the given
     32        frame.
     33        (webkitWebResourceSentRequest): Update uri and emit
     34        WebKitWebResource::sent-request.
     35        (webkitWebResourceSetResponse): Set the response property.
     36        (webkitWebResourceNotifyProgress): Emit
     37        WebKitWebResource::received-data.
     38        (webkitWebResourceFinished): Emit WebKitWebResource::finished.
     39        (webkitWebResourceFailed): Emit WebKitWebResource::failed and then
     40        WebKitWebResource::finished.
     41        (webkit_web_resource_get_uri): Return the currentr active URI.
     42        (webkit_web_resource_get_response): Return the response received
     43        from the server.
     44        * UIProcess/API/gtk/WebKitWebResource.h: Added.
     45        * UIProcess/API/gtk/WebKitWebResourcePrivate.h: Added.
     46        * UIProcess/API/gtk/WebKitWebView.cpp:
     47        (webkitWebViewConstructed): Attach the resource load client to the
     48        view.
     49        (webkit_web_view_class_init): Add
     50        WebKitWebView::resource-load-started signal.
     51        (webkitWebViewLoadChanged): Clear loading resources map when a new
     52        load starts and loaded resources map when the new load has been
     53        committed.
     54        (webkitWebViewResourceLoadStarted): Create a resource for the
     55        given identifier, add it to the loading resources map and emit
     56        WebKitWebView::resource-load-started signal.
     57        (webkitWebViewGetLoadingWebResource): Return the resource that is
     58        being loaded corresponding to the given identifier.
     59        (webkitWebViewRemoveLoadingWebResource): Remove the resouurce
     60        corresponfing to the given identifier from the loading resources
     61        map.
     62        (webkitWebViewResourceLoadFinished): Move the resource from the
     63        loading resources map to the loaded resources map.
     64        (webkit_web_view_get_main_resource): Return the main resource.
     65        (webkit_web_view_get_subresources): Return the list of
     66        subresources.
     67        * UIProcess/API/gtk/WebKitWebView.h:
     68        * UIProcess/API/gtk/WebKitWebViewPrivate.h:
     69        * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for
     70        WebKitWebResource.
     71        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
     72        * UIProcess/API/gtk/docs/webkit2gtk.types: Add
     73        webkit_web_resource_get_type.
     74        * UIProcess/API/gtk/tests/GNUmakefile.am: Add new test for resources.
     75        * UIProcess/API/gtk/tests/TestDownloads.cpp:
     76        (testDownloadLocalFile): Use getWebKit1TestResoucesDir() from Test.
     77        (testDownloadLocalFileError): Ditto.
     78        (serverCallback): Ditto.
     79        * UIProcess/API/gtk/tests/TestMain.h:
     80        (Test::getWebKit1TestResoucesDir): Moed from TestDownloads so that
     81        it can be used by other tests.
     82        (Test): Add information about leaked objects.
     83        * UIProcess/API/gtk/tests/TestResources.cpp: Added.
     84        (testWebViewResources):
     85        (testWebResourceLoading):
     86        (testWebResourceResponse):
     87        (testWebResourceActiveURI):
     88        (addCacheHTTPHeadersToResponse):
     89        (serverCallback):
     90        (beforeAll):
     91        (afterAll):
     92        * UIProcess/API/gtk/webkit2.h: Include WebKitWebResource.h
     93        * UIProcess/API/gtk/webkit2marshal.list:
     94
    1952012-03-26  Pratik Solanki  <psolanki@apple.com>
    296
  • trunk/Source/WebKit2/GNUmakefile.am

    r111510 r112221  
    103103        $(WebKit2)/UIProcess/API/gtk/WebKitURIResponse.h \
    104104        $(WebKit2)/UIProcess/API/gtk/WebKitWebContext.h \
     105        $(WebKit2)/UIProcess/API/gtk/WebKitWebResource.h \
    105106        $(WebKit2)/UIProcess/API/gtk/WebKitWebView.h \
    106107        $(WebKit2)/UIProcess/API/gtk/WebKitWebViewBase.h \
     
    577578        Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h \
    578579        Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp \
     580        Source/WebKit2/UIProcess/API/gtk/WebKitResourceLoadClient.cpp \
     581        Source/WebKit2/UIProcess/API/gtk/WebKitResourceLoadClient.h \
    579582        Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp \
    580583        Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h \
     
    597600        Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp \
    598601        Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h \
     602        Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp \
     603        Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.h \
     604        Source/WebKit2/UIProcess/API/gtk/WebKitWebResourcePrivate.h \
    599605        Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h \
    600606        Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp \
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp

    r111510 r112221  
    3232#include "WebKitPrintOperationPrivate.h"
    3333#include "WebKitPrivate.h"
     34#include "WebKitResourceLoadClient.h"
    3435#include "WebKitScriptDialogPrivate.h"
    3536#include "WebKitSettingsPrivate.h"
    3637#include "WebKitUIClient.h"
    3738#include "WebKitWebContextPrivate.h"
     39#include "WebKitWebResourcePrivate.h"
    3840#include "WebKitWebViewBasePrivate.h"
    3941#include "WebKitWebViewPrivate.h"
     
    6769    PRINT_REQUESTED,
    6870
     71    RESOURCE_LOAD_STARTED,
     72
    6973    LAST_SIGNAL
    7074};
     
    8690    DidReplaceContent
    8791} ReplaceContentStatus;
     92
     93typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap;
     94typedef HashMap<String, GRefPtr<WebKitWebResource> > ResourcesMap;
    8895
    8996struct _WebKitWebViewPrivate {
     
    104111    GRefPtr<WebKitFindController> findController;
    105112    JSGlobalContextRef javascriptGlobalContext;
     113
     114    GRefPtr<WebKitWebResource> mainResource;
     115    LoadingResourcesMap loadingResourcesMap;
     116    ResourcesMap subresourcesMap;
    106117};
    107118
     
    206217    attachUIClientToView(webView);
    207218    attachPolicyClientToPage(webView);
     219    attachResourceLoadClientToView(webView);
    208220
    209221    WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase);
     
    673685                     G_TYPE_BOOLEAN, 1,
    674686                     WEBKIT_TYPE_PRINT_OPERATION);
     687
     688    /**
     689     * WebKitWebView::resource-load-started:
     690     * @web_view: the #WebKitWebView on which the signal is emitted
     691     * @resource: a #WebKitWebResource
     692     * @request: a #WebKitURIRequest
     693     *
     694     * Emitted when a new resource is going to be loaded. The @request parameter
     695     * contains the #WebKitURIRequest that will be sent to the server.
     696     * You can monitor the load operation by connecting to the different signals
     697     * of @resource.
     698     */
     699    signals[RESOURCE_LOAD_STARTED] =
     700        g_signal_new("resource-load-started",
     701                     G_TYPE_FROM_CLASS(webViewClass),
     702                     G_SIGNAL_RUN_LAST,
     703                     G_STRUCT_OFFSET(WebKitWebViewClass, resource_load_started),
     704                     0, 0,
     705                     webkit_marshal_VOID__OBJECT_OBJECT,
     706                     G_TYPE_NONE, 2,
     707                     WEBKIT_TYPE_WEB_RESOURCE,
     708                     WEBKIT_TYPE_URI_REQUEST);
    675709}
    676710
     
    699733        return;
    700734
     735    if (loadEvent == WEBKIT_LOAD_STARTED)
     736        webView->priv->loadingResourcesMap.clear();
     737    else if (loadEvent == WEBKIT_LOAD_COMMITTED)
     738        webView->priv->subresourcesMap.clear();
     739
    701740    if (loadEvent != WEBKIT_LOAD_FINISHED)
    702741        webkitWebViewUpdateURI(webView);
     
    827866        return;
    828867    g_signal_connect(printOperation.leakRef(), "finished", G_CALLBACK(g_object_unref), 0);
     868}
     869
     870void webkitWebViewResourceLoadStarted(WebKitWebView* webView, WKFrameRef wkFrame, uint64_t resourceIdentifier, WebKitURIRequest* request, bool isMainResource)
     871{
     872    // FIXME: ignore resources when replacing content.
     873    WebKitWebResource* resource = webkitWebResourceCreate(wkFrame, request);
     874    WebKitWebViewPrivate* priv = webView->priv;
     875    if (WKFrameIsMainFrame(wkFrame) && isMainResource)
     876        priv->mainResource = resource;
     877    priv->loadingResourcesMap.set(resourceIdentifier, adoptGRef(resource));
     878    g_signal_emit(webView, signals[RESOURCE_LOAD_STARTED], 0, resource, request);
     879}
     880
     881WebKitWebResource* webkitWebViewGetLoadingWebResource(WebKitWebView* webView, uint64_t resourceIdentifier)
     882{
     883    GRefPtr<WebKitWebResource> resource = webView->priv->loadingResourcesMap.get(resourceIdentifier);
     884    return resource.get();
     885}
     886
     887void webkitWebViewRemoveLoadingWebResource(WebKitWebView* webView, uint64_t resourceIdentifier)
     888{
     889    webView->priv->loadingResourcesMap.remove(resourceIdentifier);
     890}
     891
     892WebKitWebResource* webkitWebViewResourceLoadFinished(WebKitWebView* webView, uint64_t resourceIdentifier)
     893{
     894    WebKitWebResource* resource = webkitWebViewGetLoadingWebResource(webView, resourceIdentifier);
     895    WebKitWebViewPrivate* priv = webView->priv;
     896    if (resource != priv->mainResource)
     897        priv->subresourcesMap.set(String::fromUTF8(webkit_web_resource_get_uri(resource)), resource);
     898    webkitWebViewRemoveLoadingWebResource(webView, resourceIdentifier);
     899    return resource;
    829900}
    830901
     
    16101681    return scriptResult ? webkit_javascript_result_ref(scriptResult) : 0;
    16111682}
     1683
     1684/**
     1685 * webkit_web_view_get_main_resource:
     1686 * @web_view: a #WebKitWebView
     1687 *
     1688 * Return the main resource of @web_view.
     1689 * See also webkit_web_view_get_subresources():
     1690 *
     1691 * Returns: (transfer none): the main #WebKitWebResource of the view
     1692 *    or %NULL if nothing has been loaded.
     1693 */
     1694WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView* webView)
     1695{
     1696    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
     1697
     1698    return webView->priv->mainResource.get();
     1699}
     1700
     1701/**
     1702 * webkit_web_view_get_subresources:
     1703 * @web_view: a #WebKitWebView
     1704 *
     1705 * Return the list of subresources of @web_view.
     1706 * See also webkit_web_view_get_main_resource().
     1707 *
     1708 * Returns: (element-type WebKitWebResource) (transfer container): a list of #WebKitWebResource.
     1709 */
     1710GList* webkit_web_view_get_subresources(WebKitWebView* webView)
     1711{
     1712    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
     1713
     1714    GList* subresources = 0;
     1715    WebKitWebViewPrivate* priv = webView->priv;
     1716    ResourcesMap::const_iterator end = priv->subresourcesMap.end();
     1717    for (ResourcesMap::const_iterator it = priv->subresourcesMap.begin(); it != end; ++it)
     1718        subresources = g_list_prepend(subresources, it->second.get());
     1719
     1720    return g_list_reverse(subresources);
     1721}
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h

    r111510 r112221  
    3939#include <webkit2/WebKitURIRequest.h>
    4040#include <webkit2/WebKitWebContext.h>
     41#include <webkit2/WebKitWebResource.h>
    4142#include <webkit2/WebKitWebViewBase.h>
    4243#include <webkit2/WebKitWindowProperties.h>
     
    124125    WebKitWebViewBaseClass parent;
    125126
    126     void       (* load_changed)         (WebKitWebView             *web_view,
    127                                          WebKitLoadEvent            load_event);
    128     gboolean   (* load_failed)          (WebKitWebView             *web_view,
    129                                          WebKitLoadEvent            load_event,
    130                                          const gchar               *failing_uri,
    131                                          GError                    *error);
    132 
    133     GtkWidget *(* create)               (WebKitWebView             *web_view);
    134     void       (* ready_to_show)        (WebKitWebView             *web_view);
    135     void       (* close)                (WebKitWebView             *web_view);
    136 
    137     gboolean   (* script_dialog)        (WebKitWebView             *web_view,
    138                                          WebKitScriptDialog        *dialog);
    139 
    140     gboolean   (* decide_policy)        (WebKitWebView             *web_view,
    141                                          WebKitPolicyDecision      *decision,
    142                                          WebKitPolicyDecisionType   type);
    143     void       (* mouse_target_changed) (WebKitWebView             *web_view,
    144                                          WebKitHitTestResult       *hit_test_result,
    145                                          guint                      modifiers);
    146     gboolean   (* print_requested)      (WebKitWebView             *web_view,
    147                                          WebKitPrintOperation      *print_operation);
     127    void       (* load_changed)          (WebKitWebView             *web_view,
     128                                          WebKitLoadEvent            load_event);
     129    gboolean   (* load_failed)           (WebKitWebView             *web_view,
     130                                          WebKitLoadEvent            load_event,
     131                                          const gchar               *failing_uri,
     132                                          GError                    *error);
     133
     134    GtkWidget *(* create)                (WebKitWebView             *web_view);
     135    void       (* ready_to_show)         (WebKitWebView             *web_view);
     136    void       (* close)                 (WebKitWebView             *web_view);
     137
     138    gboolean   (* script_dialog)         (WebKitWebView             *web_view,
     139                                          WebKitScriptDialog        *dialog);
     140
     141    gboolean   (* decide_policy)         (WebKitWebView             *web_view,
     142                                          WebKitPolicyDecision      *decision,
     143                                          WebKitPolicyDecisionType   type);
     144    void       (* mouse_target_changed)  (WebKitWebView             *web_view,
     145                                          WebKitHitTestResult       *hit_test_result,
     146                                          guint                      modifiers);
     147    gboolean   (* print_requested)       (WebKitWebView             *web_view,
     148                                          WebKitPrintOperation      *print_operation);
     149    void       (* resource_load_started) (WebKitWebView             *web_view,
     150                                          WebKitWebResource         *resource,
     151                                          WebKitURIRequest          *request);
    148152
    149153    /* Padding for future expansion */
     
    282286                                                    GAsyncResult              *result,
    283287                                                    GError                   **error);
     288
     289WEBKIT_API WebKitWebResource *
     290webkit_web_view_get_main_resource                  (WebKitWebView             *web_view);
     291
     292WEBKIT_API GList *
     293webkit_web_view_get_subresources                   (WebKitWebView             *web_view);
    284294G_END_DECLS
    285295
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h

    r107947 r112221  
    4646void webkitWebViewMouseTargetChanged(WebKitWebView*, WKHitTestResultRef, unsigned modifiers);
    4747void webkitWebViewPrintFrame(WebKitWebView*, WKFrameRef);
     48void webkitWebViewResourceLoadStarted(WebKitWebView*, WKFrameRef, uint64_t resourceIdentifier, WebKitURIRequest*, bool isMainResource);
     49WebKitWebResource* webkitWebViewGetLoadingWebResource(WebKitWebView*, uint64_t resourceIdentifier);
     50void webkitWebViewRemoveLoadingWebResource(WebKitWebView*, uint64_t resourceIdentifier);
     51WebKitWebResource* webkitWebViewResourceLoadFinished(WebKitWebView*, uint64_t resourceIdentifier);
    4852
    4953#endif // WebKitWebViewPrivate_h
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml

    r109222 r112221  
    2727    <xi:include href="xml/WebKitHitTestResult.xml"/>
    2828    <xi:include href="xml/WebKitPrintOperation.xml"/>
     29    <xi:include href="xml/WebKitWebResource.xml"/>
    2930    <xi:include href="xml/WebKitError.xml"/>
    3031    <xi:include href="xml/WebKitFindController.xml"/>
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt

    r111510 r112221  
    107107webkit_script_dialog_prompt_get_default_text
    108108webkit_script_dialog_prompt_set_text
     109webkit_web_view_get_main_resource
     110webkit_web_view_get_subresources
    109111
    110112<SUBSECTION Standard>
     
    475477
    476478<SECTION>
     479<FILE>WebKitWebResource</FILE>
     480WebKitWebResource
     481webkit_web_resource_get_uri
     482webkit_web_resource_get_response
     483
     484<SUBSECTION Standard>
     485WebKitWebResourceClass
     486WEBKIT_TYPE_WEB_RESOURCE
     487WEBKIT_WEB_RESOURCE
     488WEBKIT_IS_WEB_RESOURCE
     489WEBKIT_WEB_RESOURCE_CLASS
     490WEBKIT_IS_WEB_RESOURCE_CLASS
     491WEBKIT_WEB_RESOURCE_GET_CLASS
     492
     493<SUBSECTION Private>
     494WebKitWebResourcePrivate
     495webkit_web_resource_get_type
     496</SECTION>
     497
     498<SECTION>
    477499<FILE>WebKitError</FILE>
    478500WEBKIT_NETWORK_ERROR
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types

    r111510 r112221  
    1313webkit_script_dialog_get_type
    1414webkit_javascript_result_get_type
     15webkit_web_resource_get_type
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am

    r109222 r112221  
    66        Programs/WebKit2APITests/TestLoaderClient \
    77        Programs/WebKit2APITests/TestPrinting \
     8        Programs/WebKit2APITests/TestResources \
    89        Programs/WebKit2APITests/TestWebKitFindController \
    910        Programs/WebKit2APITests/TestWebKitPolicyClient \
     
    136137Programs_WebKit2APITests_TestWebKitFindController_LDFLAGS = $(webkit2_tests_ldflags)
    137138
     139Programs_WebKit2APITests_TestResources_SOURCES = \
     140        Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp
     141Programs_WebKit2APITests_TestResources_CPPFLAGS = $(webkit2_tests_cppflags)
     142Programs_WebKit2APITests_TestResources_LDADD = $(webkit2_tests_ldadd)
     143Programs_WebKit2APITests_TestResources_LDFLAGS = $(webkit2_tests_ldflags)
     144
    138145endif # ENABLE_WEBKIT2
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp

    r105708 r112221  
    174174};
    175175
    176 static CString getWebKit1TestResoucesDir()
    177 {
    178     GOwnPtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Source", "WebKit", "gtk", "tests", "resources", NULL));
    179     return resourcesDir.get();
    180 }
    181 
    182176static void testDownloadLocalFile(DownloadTest* test, gconstpointer)
    183177{
    184     GOwnPtr<char> sourcePath(g_build_filename(getWebKit1TestResoucesDir().data(), "test.pdf", NULL));
     178    GOwnPtr<char> sourcePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), "test.pdf", NULL));
    185179    GRefPtr<GFile> source = adoptGRef(g_file_new_for_path(sourcePath.get()));
    186180    GRefPtr<GFileInfo> sourceInfo = adoptGRef(g_file_query_info(source.get(), G_FILE_ATTRIBUTE_STANDARD_SIZE, static_cast<GFileQueryInfoFlags>(0), 0, 0));
     
    259253
    260254    test->m_expectedError = WEBKIT_DOWNLOAD_ERROR_DESTINATION;
    261     GOwnPtr<char> path(g_build_filename(getWebKit1TestResoucesDir().data(), "test.pdf", NULL));
     255    GOwnPtr<char> path(g_build_filename(Test::getWebKit1TestResoucesDir().data(), "test.pdf", NULL));
    262256    GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(path.get()));
    263257    GOwnPtr<char> uri(g_file_get_uri(file.get()));
     
    302296    }
    303297
    304     GOwnPtr<char> filePath(g_build_filename(getWebKit1TestResoucesDir().data(), path, NULL));
     298    GOwnPtr<char> filePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), path, NULL));
    305299    char* contents;
    306300    gsize contentsLength;
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h

    r111696 r112221  
    2424#include <wtf/HashSet.h>
    2525#include <wtf/gobject/GOwnPtr.h>
     26#include <wtf/text/CString.h>
    2627
    2728#define MAKE_GLIB_TEST_FIXTURE(ClassName) \
     
    4647    ~Test()
    4748    {
     49        if (m_watchedObjects.isEmpty())
     50            return;
     51
     52        g_print("Leaked objects:");
     53        HashSet<GObject*>::const_iterator end = m_watchedObjects.end();
     54        for (HashSet<GObject*>::const_iterator it = m_watchedObjects.begin(); it != end; ++it)
     55            g_print(" %s(%p)", g_type_name_from_instance(reinterpret_cast<GTypeInstance*>(*it)), *it);
     56        g_print("\n");
     57
    4858        g_assert(m_watchedObjects.isEmpty());
    4959    }
     
    6070    }
    6171
     72    static CString getWebKit1TestResoucesDir()
     73    {
     74        GOwnPtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Source", "WebKit", "gtk", "tests", "resources", NULL));
     75        return resourcesDir.get();
     76    }
     77
    6278    HashSet<GObject*> m_watchedObjects;
    6379};
  • trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h

    r111510 r112221  
    4040#include <webkit2/WebKitURIResponse.h>
    4141#include <webkit2/WebKitWebContext.h>
     42#include <webkit2/WebKitWebResource.h>
    4243#include <webkit2/WebKitWebViewBase.h>
    4344#include <webkit2/WebKitWebView.h>
  • trunk/Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list

    r109880 r112221  
    66OBJECT:VOID
    77VOID:OBJECT,UINT
     8VOID:OBJECT,OBJECT
    89VOID:OBJECT,POINTER
    910VOID:UINT64
Note: See TracChangeset for help on using the changeset viewer.