Changeset 148679 in webkit
- Timestamp:
- Apr 18, 2013 9:12:12 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 21 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r148674 r148679 1 2013-04-18 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add WebKitWebPage::send-request signal to WebKit2 GTK+ API 4 https://bugs.webkit.org/show_bug.cgi?id=83681 5 6 Reviewed by Anders Carlsson. 7 8 Add WebKitWebPage::send-request signal emitted in willSendRequest 9 callback to allow web process extensions to modify requests before 10 they are sent or cancel the resource load. 11 This patch makes WebKitURIRequest and WebKitURIResponse objects 12 shareable between UI process and web extensions APIs. Since both 13 APIs force single header includes, the WebKitDefines.h header has 14 been split moving the forward declarations specific to the UI 15 process API to a new file WebKitForwardDeclarations.h. This way we 16 can also share the WebKitDefines.h header and remove the 17 WebKitWebExtensionDefines.h header used in the web extensions API. 18 19 * GNUmakefile.list.am: Add new files to compilation. 20 * UIProcess/API/gtk/WebKitContextMenu.h: Include WebKitForward.h. 21 * UIProcess/API/gtk/WebKitContextMenuItem.h: Ditto. 22 * UIProcess/API/gtk/WebKitDefines.h: Remove forward declarations. 23 * UIProcess/API/gtk/WebKitDownload.h: Include WebKitForward.h. 24 * UIProcess/API/gtk/WebKitFindController.h: Ditto. 25 * UIProcess/API/gtk/WebKitForwardDeclarations.h: Added. Contains 26 the forward declarations moved from WebKitDefines.h. 27 * UIProcess/API/gtk/WebKitPrintOperation.h: Include WebKitForward.h. 28 * UIProcess/API/gtk/WebKitURIRequest.cpp: 29 (webkitURIRequestSetProperty): Use webkit_uri_request_set_uri() to 30 set the new URI. 31 (webkit_uri_request_class_init): Make URI property construct 32 instead of construct-only, since it can be updated once 33 constructed. It should never be NULL, so set default value to 34 about:blank instad of NULL. 35 (webkit_uri_request_set_uri): New public method to set the URI of 36 the WebKitURIRequest. 37 * UIProcess/API/gtk/WebKitURIRequest.h: Allow to include this file 38 from webkit-web-extension.h. 39 * UIProcess/API/gtk/WebKitURIResponse.h: Ditto. 40 * UIProcess/API/gtk/WebKitURISchemeRequest.h: Include 41 WebKitForward.h. 42 * UIProcess/API/gtk/WebKitWebView.h: Ditto. 43 * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add 44 webkit_uri_request_set_uri. 45 * UIProcess/API/gtk/tests/TestResources.cpp: 46 (testWebResourceSendRequest): 47 (serverCallback): 48 (beforeAll): 49 * UIProcess/API/gtk/tests/WebExtensionTest.cpp: 50 (sendRequestCallback): 51 (pageCreatedCallback): 52 * UIProcess/API/gtk/webkit2marshal.list: 53 * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h: Include 54 WebKitDefines.h instead of WebKitWebExtensionDefines.h. 55 * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp: 56 (willSendRequestForFrame): Emit WebKitWebPage::send-request and 57 return early if the load is cancelled. 58 (webkit_web_page_class_init): Add WebKitWebPage::send-request 59 signal. 60 * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h: Include 61 WebKitDefines.h instead of WebKitWebExtensionDefines.h. 62 * WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h: 63 1 64 2013-04-18 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 65 -
trunk/Source/WebKit2/GNUmakefile.list.am
r148294 r148679 108 108 $(WebKit2)/UIProcess/API/gtk/WebKitFindController.h \ 109 109 $(WebKit2)/UIProcess/API/gtk/WebKitFormSubmissionRequest.h \ 110 $(WebKit2)/UIProcess/API/gtk/WebKitForwardDeclarations.h \ 110 111 $(WebKit2)/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.h \ 111 112 $(WebKit2)/UIProcess/API/gtk/WebKitHitTestResult.h \ … … 134 135 webkit2_web_extension_h_api += \ 135 136 $(WebKit2)/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h \ 136 $(WebKit2)/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionDefines.h \137 137 $(WebKit2)/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h \ 138 138 $(WebKit2)/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h … … 689 689 Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp \ 690 690 Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h \ 691 Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h \ 691 692 Source/WebKit2/UIProcess/API/gtk/WebKitFullscreenClient.cpp \ 692 693 Source/WebKit2/UIProcess/API/gtk/WebKitFullscreenClient.h \ … … 1039 1040 Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h \ 1040 1041 Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionPrivate.h \ 1041 Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionDefines.h \1042 1042 Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp \ 1043 1043 Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h \ -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h
r121093 r148679 28 28 #include <webkit2/WebKitContextMenuItem.h> 29 29 #include <webkit2/WebKitDefines.h> 30 #include <webkit2/WebKitForwardDeclarations.h> 30 31 31 32 G_BEGIN_DECLS -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h
r121093 r148679 29 29 #include <webkit2/WebKitContextMenu.h> 30 30 #include <webkit2/WebKitContextMenuActions.h> 31 #include <webkit2/WebKitForwardDeclarations.h> 31 32 32 33 G_BEGIN_DECLS -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h
r121093 r148679 24 24 */ 25 25 26 #if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) 26 #if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) 27 27 #error "Only <webkit2/webkit2.h> can be included directly." 28 28 #endif … … 32 32 33 33 #include <glib.h> 34 35 typedef struct _WebKitPrintOperation WebKitPrintOperation;36 typedef struct _WebKitFindController WebKitFindController;37 typedef struct _WebKitWebView WebKitWebView;38 typedef struct _WebKitContextMenu WebKitContextMenu;39 typedef struct _WebKitContextMenuItem WebKitContextMenuItem;40 34 41 35 #ifdef G_OS_WIN32 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h
r132323 r148679 27 27 #include <glib-object.h> 28 28 #include <webkit2/WebKitDefines.h> 29 #include <webkit2/WebKitForwardDeclarations.h> 29 30 #include <webkit2/WebKitURIRequest.h> 30 31 #include <webkit2/WebKitURIResponse.h> -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h
r109222 r148679 27 27 #include <glib-object.h> 28 28 #include <webkit2/WebKitDefines.h> 29 #include <webkit2/WebKitForwardDeclarations.h> 29 30 30 31 G_BEGIN_DECLS -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h
r148678 r148679 1 1 /* 2 * Copyright (C) 201 2Igalia S.L.2 * Copyright (C) 2013 Igalia S.L. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #if !defined(__WEBKIT _WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)27 #error "Only <webkit2/webkit -web-extension.h> can be included directly."26 #if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) 27 #error "Only <webkit2/webkit2.h> can be included directly." 28 28 #endif 29 29 30 #ifndef WebKit WebExtensionDefines_h31 #define WebKit WebExtensionDefines_h30 #ifndef WebKitForward_h 31 #define WebKitForward_h 32 32 33 #include <glib.h> 33 typedef struct _WebKitPrintOperation WebKitPrintOperation; 34 typedef struct _WebKitFindController WebKitFindController; 35 typedef struct _WebKitWebView WebKitWebView; 36 typedef struct _WebKitContextMenu WebKitContextMenu; 37 typedef struct _WebKitContextMenuItem WebKitContextMenuItem; 34 38 35 #ifdef G_OS_WIN32 36 # ifdef BUILDING_WEBKIT 37 # define WEBKIT_API __declspec(dllexport) 38 # else 39 # define WEBKIT_API __declspec(dllimport) 40 # endif 41 # define WEBKIT_OBSOLETE_API WEBKIT_API 42 #else 43 # define WEBKIT_API __attribute__((visibility("default"))) 44 # define WEBKIT_OBSOLETE_API WEBKIT_API __attribute__((deprecated)) 45 #endif 46 47 #endif // WebKitWebExtensionDefines_h 39 #endif // WebKitForward_h -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.h
r108069 r148679 27 27 #include <glib-object.h> 28 28 #include <webkit2/WebKitDefines.h> 29 #include <webkit2/WebKitForwardDeclarations.h> 29 30 #include <webkit2/WebKitWebView.h> 30 31 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp
r137469 r148679 71 71 switch (propId) { 72 72 case PROP_URI: 73 request->priv->resourceRequest.setURL(KURL(KURL(), g_value_get_string(value)));73 webkit_uri_request_set_uri(request, g_value_get_string(value)); 74 74 break; 75 75 default: … … 93 93 _("URI"), 94 94 _("The URI to which the request will be made."), 95 0,96 static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT _ONLY)));95 "about:blank", 96 static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT))); 97 97 } 98 98 … … 126 126 } 127 127 128 /** 129 * webkit_uri_request_set_uri: 130 * @request: a #WebKitURIRequest 131 * @uri: an URI 132 * 133 * Set the URI of @request 134 */ 135 void webkit_uri_request_set_uri(WebKitURIRequest* request, const char* uri) 136 { 137 g_return_if_fail(WEBKIT_IS_URI_REQUEST(request)); 138 g_return_if_fail(uri); 139 140 KURL url(KURL(), uri); 141 if (url == request->priv->resourceRequest.url()) 142 return; 143 144 request->priv->resourceRequest.setURL(url); 145 g_object_notify(G_OBJECT(request), "uri"); 146 } 147 128 148 WebKitURIRequest* webkitURIRequestCreateForResourceRequest(const WebCore::ResourceRequest& resourceRequest) 129 149 { -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.h
r101248 r148679 18 18 */ 19 19 20 #if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) 20 #if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) 21 21 #error "Only <webkit2/webkit2.h> can be included directly." 22 22 #endif … … 62 62 webkit_uri_request_get_uri (WebKitURIRequest *request); 63 63 64 WEBKIT_API void 65 webkit_uri_request_set_uri (WebKitURIRequest *request, 66 const gchar *uri); 67 64 68 G_END_DECLS 65 69 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
r143341 r148679 18 18 */ 19 19 20 #if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) 20 #if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) 21 21 #error "Only <webkit2/webkit2.h> can be included directly." 22 22 #endif -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.h
r130259 r148679 27 27 #include <glib-object.h> 28 28 #include <webkit2/WebKitDefines.h> 29 #include <webkit2/WebKitForwardDeclarations.h> 29 30 30 31 G_BEGIN_DECLS -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
r148665 r148679 35 35 #include <webkit2/WebKitFindController.h> 36 36 #include <webkit2/WebKitFormSubmissionRequest.h> 37 #include <webkit2/WebKitForwardDeclarations.h> 37 38 #include <webkit2/WebKitHitTestResult.h> 38 39 #include <webkit2/WebKitJavascriptResult.h> -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
r148666 r148679 335 335 webkit_uri_request_new 336 336 webkit_uri_request_get_uri 337 webkit_uri_request_set_uri 337 338 338 339 <SUBSECTION Standard> -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp
r144652 r148679 557 557 g_assert(resource); 558 558 g_assert_cmpstr(webkit_web_resource_get_uri(resource), ==, simpleStyleCSSURI.data()); 559 } 560 561 class SendRequestTest: public SingleResourceLoadTest { 562 public: 563 MAKE_GLIB_TEST_FIXTURE(SendRequestTest); 564 565 void resourceSentRequest(WebKitWebResource* resource, WebKitURIRequest* request, WebKitURIResponse* redirectResponse) 566 { 567 if (resource != m_resource) 568 return; 569 570 g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, m_expectedNewResourceURI.data()); 571 g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, webkit_web_resource_get_uri(resource)); 572 573 SingleResourceLoadTest::resourceSentRequest(resource, request, redirectResponse); 574 } 575 576 void resourceFailed(WebKitWebResource* resource, GError* error) 577 { 578 if (resource != m_resource) 579 return; 580 581 g_assert_cmpstr(webkit_web_resource_get_uri(resource), ==, m_expectedCancelledResourceURI.data()); 582 g_assert_error(error, WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED); 583 584 SingleResourceLoadTest::resourceFailed(resource, error); 585 } 586 587 void setExpectedNewResourceURI(const CString& uri) 588 { 589 m_expectedNewResourceURI = uri; 590 } 591 592 void setExpectedCancelledResourceURI(const CString& uri) 593 { 594 m_expectedCancelledResourceURI = uri; 595 } 596 597 CString m_expectedNewResourceURI; 598 CString m_expectedCancelledResourceURI; 599 }; 600 601 static void testWebResourceSendRequest(SendRequestTest* test, gconstpointer) 602 { 603 test->setExpectedNewResourceURI(kServer->getURIForPath("/javascript.js")); 604 test->loadURI(kServer->getURIForPath("relative-javascript.html").data()); 605 test->waitUntilResourceLoadFinished(); 606 g_assert(test->m_resource); 607 608 Vector<SingleResourceLoadTest::LoadEvents>& events = test->m_loadEvents; 609 g_assert_cmpint(events.size(), ==, 5); 610 g_assert_cmpint(events[0], ==, SingleResourceLoadTest::Started); 611 g_assert_cmpint(events[1], ==, SingleResourceLoadTest::SentRequest); 612 g_assert_cmpint(events[2], ==, SingleResourceLoadTest::ReceivedResponse); 613 g_assert_cmpint(events[3], ==, SingleResourceLoadTest::ReceivedData); 614 g_assert_cmpint(events[4], ==, SingleResourceLoadTest::Finished); 615 events.clear(); 616 617 // Cancel request. 618 test->setExpectedCancelledResourceURI(kServer->getURIForPath("/cancel-this.js")); 619 test->loadURI(kServer->getURIForPath("/resource-to-cancel.html").data()); 620 test->waitUntilResourceLoadFinished(); 621 g_assert(test->m_resource); 622 623 g_assert_cmpint(events.size(), ==, 3); 624 g_assert_cmpint(events[0], ==, SingleResourceLoadTest::Started); 625 g_assert_cmpint(events[1], ==, SingleResourceLoadTest::Failed); 626 g_assert_cmpint(events[2], ==, SingleResourceLoadTest::Finished); 627 events.clear(); 559 628 } 560 629 … … 612 681 soup_message_headers_append(message->response_headers, "Content-Type", "text/javascript"); 613 682 soup_message_headers_append(message->response_headers, "Content-Disposition", "filename=JavaScript.js"); 683 } else if (g_str_equal(path, "/relative-javascript.html")) { 684 static const char* javascriptRelativeHTML = "<html><head><script language='javascript' src='remove-this/javascript.js'></script></head><body></body></html>"; 685 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, javascriptRelativeHTML, strlen(javascriptRelativeHTML)); 686 } else if (g_str_equal(path, "/resource-to-cancel.html")) { 687 static const char* resourceToCancelHTML = "<html><head><script language='javascript' src='cancel-this.js'></script></head><body></body></html>"; 688 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, resourceToCancelHTML, strlen(resourceToCancelHTML)); 614 689 } else if (g_str_equal(path, "/blank.ico")) { 615 690 GOwnPtr<char> filePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), path, NULL)); … … 642 717 kServer->run(serverCallback); 643 718 719 webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(), WEBKIT_TEST_WEB_EXTENSIONS_DIR); 720 644 721 ResourcesTest::add("WebKitWebView", "resources", testWebViewResources); 645 722 SingleResourceLoadTest::add("WebKitWebResource", "loading", testWebResourceLoading); … … 650 727 ResourcesTest::add("WebKitWebResource", "get-data", testWebResourceGetData); 651 728 SingleResourceLoadTest::add("WebKitWebView", "history-cache", testWebViewResourcesHistoryCache); 729 SendRequestTest::add("WebKitWebPage", "send-request", testWebResourceSendRequest); 652 730 } 653 731 -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp
r148666 r148679 22 22 #include <gio/gio.h> 23 23 #include <stdlib.h> 24 #include <string.h> 24 25 25 26 #include <webkit2/webkit-web-extension.h> … … 67 68 } 68 69 70 static gboolean sendRequestCallback(WebKitWebPage*, WebKitURIRequest* request, WebKitURIResponse*, gpointer) 71 { 72 const char* requestURI = webkit_uri_request_get_uri(request); 73 g_assert(requestURI); 74 75 if (const char* suffix = g_strrstr(requestURI, "/remove-this/javascript.js")) { 76 GOwnPtr<char> prefix(g_strndup(requestURI, strlen(requestURI) - strlen(suffix))); 77 GOwnPtr<char> newURI(g_strdup_printf("%s/javascript.js", prefix.get())); 78 webkit_uri_request_set_uri(request, newURI.get()); 79 } else if (g_str_has_suffix(requestURI, "/cancel-this.js")) 80 return TRUE; 81 82 return FALSE; 83 } 84 69 85 static void pageCreatedCallback(WebKitWebExtension*, WebKitWebPage* webPage, gpointer userData) 70 86 { 71 87 g_signal_connect(webPage, "document-loaded", G_CALLBACK(documentLoadedCallback), userData); 72 88 g_signal_connect(webPage, "notify::uri", G_CALLBACK(uriChangedCallback), userData); 89 g_signal_connect(webPage, "send-request", G_CALLBACK(sendRequestCallback), 0); 73 90 } 74 91 -
trunk/Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list
r133867 r148679 4 4 BOOLEAN:OBJECT,BOXED,OBJECT 5 5 BOOLEAN:OBJECT,ENUM 6 BOOLEAN:OBJECT,OBJECT 6 7 BOOLEAN:STRING 7 8 BOOLEAN:VOID -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h
r139305 r148679 26 26 27 27 #include <glib-object.h> 28 #include <webkit2/WebKit WebExtensionDefines.h>28 #include <webkit2/WebKitDefines.h> 29 29 #include <webkit2/WebKitWebPage.h> 30 30 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp
r148666 r148679 29 29 #include "WebImage.h" 30 30 #include "WebKitDOMDocumentPrivate.h" 31 #include "WebKitMarshal.h" 31 32 #include "WebKitPrivate.h" 33 #include "WebKitURIRequestPrivate.h" 34 #include "WebKitURIResponsePrivate.h" 32 35 #include "WebKitWebPagePrivate.h" 33 36 #include "WebProcess.h" … … 44 47 enum { 45 48 DOCUMENT_LOADED, 49 SEND_REQUEST, 46 50 47 51 LAST_SIGNAL … … 124 128 } 125 129 126 static WKURLRequestRef willSendRequestForFrame(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void*) 127 { 128 ImmutableDictionary::MapType message; 129 message.set(String::fromUTF8("Page"), toImpl(page)); 130 message.set(String::fromUTF8("Identifier"), WebUInt64::create(identifier)); 131 message.set(String::fromUTF8("Request"), toImpl(request)); 132 if (!toImpl(redirectResponse)->resourceResponse().isNull()) 133 message.set(String::fromUTF8("RedirectResponse"), toImpl(redirectResponse)); 130 static WKURLRequestRef willSendRequestForFrame(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo) 131 { 132 GRefPtr<WebKitURIRequest> request = adoptGRef(webkitURIRequestCreateForResourceRequest(toImpl(wkRequest)->resourceRequest())); 133 GRefPtr<WebKitURIResponse> redirectResponse = wkRedirectResponse ? adoptGRef(webkitURIResponseCreateForResourceResponse(toImpl(wkRedirectResponse)->resourceResponse())) : 0; 134 135 gboolean returnValue; 136 g_signal_emit(WEBKIT_WEB_PAGE(clientInfo), signals[SEND_REQUEST], 0, request.get(), redirectResponse.get(), &returnValue); 137 if (returnValue) 138 return 0; 139 140 RefPtr<WebURLRequest> newRequest = WebURLRequest::create(webkitURIRequestGetResourceRequest(request.get())); 141 142 ImmutableDictionary::MapType message; 143 message.set(String::fromUTF8("Page"), toImpl(page)); 144 message.set(String::fromUTF8("Identifier"), WebUInt64::create(identifier)); 145 message.set(String::fromUTF8("Request"), newRequest.get()); 146 if (!toImpl(wkRedirectResponse)->resourceResponse().isNull()) 147 message.set(String::fromUTF8("RedirectResponse"), toImpl(wkRedirectResponse)); 134 148 WebProcess::shared().injectedBundle()->postMessage(String::fromUTF8("WebPage.DidSendRequestForResource"), ImmutableDictionary::adopt(message).get()); 135 149 136 WKRetain(request); 137 return request; 150 return toAPI(newRequest.release().leakRef()); 138 151 } 139 152 … … 224 237 g_cclosure_marshal_VOID__OBJECT, 225 238 G_TYPE_NONE, 0); 239 240 /** 241 * WebKitWebPage::send-request: 242 * @web_page: the #WebKitWebPage on which the signal is emitted 243 * @request: a #WebKitURIRequest 244 * @redirected_response: a #WebKitURIResponse, or %NULL 245 * 246 * This signal is emitted when @request is about to be sent to 247 * the server. This signal can be used to modify the #WebKitURIRequest 248 * that will be sent to the server. You can also cancel the resource load 249 * operation by connecting to this signal and returning %TRUE. 250 * 251 * In case of a server redirection this signal is 252 * emitted again with the @request argument containing the new 253 * request to be sent to the server due to the redirection and the 254 * @redirected_response parameter containing the response 255 * received by the server for the initial request. 256 * 257 * Returns: %TRUE to stop other handlers from being invoked for the event. 258 * %FALSE to continue emission of the event. 259 */ 260 signals[SEND_REQUEST] = g_signal_new( 261 "send-request", 262 G_TYPE_FROM_CLASS(klass), 263 G_SIGNAL_RUN_LAST, 264 0, 265 g_signal_accumulator_true_handled, 0, 266 webkit_marshal_BOOLEAN__OBJECT_OBJECT, 267 G_TYPE_BOOLEAN, 2, 268 WEBKIT_TYPE_URI_REQUEST, 269 WEBKIT_TYPE_URI_RESPONSE); 226 270 } 227 271 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h
r148666 r148679 26 26 27 27 #include <glib-object.h> 28 #include <webkit2/WebKit WebExtensionDefines.h>28 #include <webkit2/WebKitDefines.h> 29 29 #include <webkitdom/webkitdom.h> 30 30 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h
r139305 r148679 23 23 #define __WEBKIT_WEB_EXTENSION_H_INSIDE__ 24 24 25 #include <webkit2/WebKitURIRequest.h> 26 #include <webkit2/WebKitURIResponse.h> 25 27 #include <webkit2/WebKitWebExtension.h> 26 28 #include <webkit2/WebKitWebPage.h>
Note: See TracChangeset
for help on using the changeset viewer.