Changeset 106445 in webkit
- Timestamp:
- Feb 1, 2012 1:29:03 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106444 r106445 1 2012-02-01 Philippe Normand <pnormand@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Improve FrameLoader signals. Resource loading 6 https://bugs.webkit.org/show_bug.cgi?id=49543 7 8 Unskip tests now passing. 9 10 * platform/gtk/Skipped: 11 * platform/gtk/fast/loader/file-protocol-fragment-expected.txt: Added. 12 * platform/gtk/http/tests/misc/willCacheResponse-delegate-callback-expected.txt: 13 1 14 2012-02-01 Balazs Ankes <Ankes.Balazs@stud.u-szeged.hu> 2 15 -
trunk/LayoutTests/platform/gtk/Skipped
r106345 r106445 458 458 459 459 # Missing delegates: 460 # Need proper frame loader callbacks reporting 461 # See https://bugs.webkit.org/show_bug.cgi?id=32170 462 fast/loader/file-protocol-fragment.html 463 # Tests failing because of missing resource load delegate callbacks. 464 fast/loader/main-document-url-for-non-http-loads.html 465 http/tests/misc/link-rel-icon-beforeload.html 460 466 461 # Tests failing because of missing policy delegate callbacks. 467 462 fast/loader/onload-policy-ignore-for-frame.html … … 695 690 fast/images/support-broken-image-delegate.html 696 691 697 # Fail due to an extra "CONSOLE MESSAGE: line 1: SyntaxError: Parse error"698 fast/loader/onload-willSendRequest-null-for-script.html699 fast/loader/willSendRequest-null-for-preload.html700 701 692 # Requires willSendRequestReturnsNullOnRedirect + willSendRequest + didFinishLoading 702 693 http/tests/misc/will-send-request-returns-null-on-redirect.html 703 http/tests/misc/favicon-loads-with-icon-loading-override.html704 694 # Requires willPerformClientRedirectToURL 705 695 # https://bugs.webkit.org/show_bug.cgi?id=58526 … … 808 798 # https://bugs.webkit.org/show_bug.cgi?id=54189 809 799 fast/replaced/border-radius-clip.html 810 811 # New test needs enhanced frameloader delegate logging in DRT812 # Discussed in https://bugs.webkit.org/show_bug.cgi?id=38928813 fast/loader/recursive-before-unload-crash.html814 fast/loader/null-request-after-willSendRequest.html815 800 816 801 # Need to dump context menu items on eventSender.contextClick(true). … … 1301 1286 fast/events/dropzone-002.html 1302 1287 fast/events/dropzone-005.html 1303 1304 # [GTK] DumpRenderTree doesn't block external requests1305 # https://bugs.webkit.org/show_bug.cgi?id=625851306 fast/workers/worker-crash-with-invalid-location.html1307 1288 1308 1289 # https://bugs.webkit.org/show_bug.cgi?id=64085 -
trunk/LayoutTests/platform/gtk/http/tests/misc/willCacheResponse-delegate-callback-expected.txt
r78279 r106445 1 http://127.0.0.1:8000/misc/resources/willCacheResponse-success.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/misc/resources/willCacheResponse-success.html, main document URL http://127.0.0.1:8000/misc/willCacheResponse-delegate-callback.html, http method GET> redirectResponse (null) 2 http://127.0.0.1:8000/misc/resources/willCacheResponse-success.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/misc/resources/willCacheResponse-success.html, http status code 200> 1 3 This tests for the willCacheResponse resource delegate callback as added for radar 5008925. 2 4 The test is only meaningful if you are running it under DumpRenderTree -
trunk/Source/WebKit/gtk/ChangeLog
r105607 r106445 1 2012-02-01 Philippe Normand <pnormand@igalia.com> and Sergio Villar Senin <svillar@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Improve FrameLoader signals. Resource loading 6 https://bugs.webkit.org/show_bug.cgi?id=49543 7 8 New signals: 9 WebKitWebFrame::resource-request-starting 10 WebKitWebFrame::resource-response-received 11 WebKitWebFrame::resource-load-finished 12 WebKitWebFrame::resource-content-length-received 13 WebKitWebFrame::resource-load-failed 14 WebKitWebResource::response-received 15 WebKitWebResource::load-failed 16 WebKitWebResource::load-finished 17 WebKitWebResource::content-length-received 18 WebKitWebView::resource-response-received 19 WebKitWebView::resource-load-finished 20 WebKitWebView::resource-content-length-received 21 WebKitWebView::resource-load-failed 22 23 * WebCoreSupport/FrameLoaderClientGtk.cpp: 24 (WebKit::FrameLoaderClient::dispatchWillSendRequest): 25 (WebKit::FrameLoaderClient::dispatchDidReceiveResponse): 26 (WebKit::FrameLoaderClient::dispatchDidReceiveContentLength): 27 (WebKit::FrameLoaderClient::dispatchDidFinishLoading): 28 (WebKit::FrameLoaderClient::dispatchDidFailLoading): 29 * webkit/webkitwebframe.cpp: 30 (webkit_web_frame_class_init): 31 * webkit/webkitwebresource.cpp: 32 (webkit_web_resource_class_init): 33 * webkit/webkitwebview.cpp: 34 (webkit_web_view_class_init): 35 * webkitmarshal.list: 36 1 37 2012-01-23 Mario Sanchez Prada <msanchez@igalia.com> 2 38 -
trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
r102062 r106445 234 234 webResource->priv->uri = g_strdup(request.url().string().utf8().data()); 235 235 } 236 236 237 237 g_signal_emit_by_name(webView, "resource-request-starting", m_frame, webResource, networkRequest.get(), networkResponse.get()); 238 g_signal_emit_by_name(m_frame, "resource-request-starting", webResource, networkRequest.get(), networkResponse.get()); 238 239 239 240 // Feed any changes back into the ResourceRequest object. … … 299 300 } 300 301 301 void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader* loader, unsigned long , const ResourceResponse& response)302 void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response) 302 303 { 303 304 // Update our knowledge of request soup flags - some are only set … … 306 307 307 308 m_response = response; 309 310 WebKitWebView* webView = getViewFromFrame(m_frame); 311 GOwnPtr<gchar> identifierString(toString(identifier)); 312 WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); 313 GRefPtr<WebKitNetworkResponse> networkResponse(adoptGRef(kitNew(response))); 314 315 g_signal_emit_by_name(webResource, "response-received", networkResponse.get()); 316 g_signal_emit_by_name(m_frame, "resource-response-received", webResource, networkResponse.get()); 317 g_signal_emit_by_name(webView, "resource-response-received", m_frame, webResource, networkResponse.get()); 308 318 } 309 319 … … 993 1003 void FrameLoaderClient::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) 994 1004 { 995 notImplemented(); 1005 WebKitWebView* webView = getViewFromFrame(m_frame); 1006 GOwnPtr<gchar> identifierString(toString(identifier)); 1007 WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); 1008 1009 g_signal_emit_by_name(webResource, "content-length-received", dataLength); 1010 g_signal_emit_by_name(m_frame, "resource-content-length-received", webResource, dataLength); 1011 g_signal_emit_by_name(webView, "resource-content-length-received", m_frame, webResource, dataLength); 996 1012 } 997 1013 … … 1022 1038 webkit_web_resource_init_with_core_resource(webResource, coreResource.get()); 1023 1039 1024 // FIXME: This function should notify the application that the resource 1025 // finished loading, maybe using a load-status property in the 1026 // WebKitWebResource object, similar to what we do for WebKitWebFrame' 1027 // signal. 1028 notImplemented(); 1040 g_signal_emit_by_name(webResource, "load-finished"); 1041 g_signal_emit_by_name(m_frame, "resource-load-finished", webResource); 1042 g_signal_emit_by_name(webView, "resource-load-finished", m_frame, webResource); 1029 1043 } 1030 1044 … … 1033 1047 static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier); 1034 1048 1035 // FIXME: This function should notify the application that the resource failed 1036 // loading, maybe a 'load-error' signal in the WebKitWebResource object. 1037 notImplemented(); 1049 WebKitWebView* webView = getViewFromFrame(m_frame); 1050 GOwnPtr<gchar> identifierString(toString(identifier)); 1051 WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); 1052 GOwnPtr<GError> webError(g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), 1053 error.errorCode(), 1054 error.localizedDescription().utf8().data())); 1055 1056 g_signal_emit_by_name(webResource, "load-failed", webError.get()); 1057 g_signal_emit_by_name(m_frame, "resource-load-failed", webResource, webError.get()); 1058 g_signal_emit_by_name(webView, "resource-load-failed", m_frame, webResource, webError.get()); 1038 1059 } 1039 1060 -
trunk/Source/WebKit/gtk/webkit/webkitwebframe.cpp
r105604 r106445 61 61 #include "webkitglobalsprivate.h" 62 62 #include "webkitmarshal.h" 63 #include "webkitnetworkresponse.h" 63 64 #include "webkitnetworkrequestprivate.h" 64 65 #include "webkitnetworkresponseprivate.h" 65 66 #include "webkitsecurityoriginprivate.h" 66 67 #include "webkitwebframeprivate.h" 68 #include "webkitwebresource.h" 67 69 #include "webkitwebview.h" 68 70 #include "webkitwebviewprivate.h" … … 105 107 HOVERING_OVER_LINK, 106 108 SCROLLBARS_POLICY_CHANGED, 109 // Resource loading signals 110 RESOURCE_REQUEST_STARTING, 111 RESOURCE_RESPONSE_RECEIVED, 112 RESOURCE_LOAD_FINISHED, 113 RESOURCE_CONTENT_LENGTH_RECEIVED, 114 RESOURCE_LOAD_FAILED, 115 107 116 LAST_SIGNAL 108 117 }; … … 302 311 G_TYPE_BOOLEAN, 0); 303 312 313 314 /** 315 * WebKitWebFrame::resource-request-starting: 316 * @web_frame: the #WebKitWebFrame whose load dispatched this request 317 * @web_resource: an empty #WebKitWebResource object 318 * @request: the #WebKitNetworkRequest that will be dispatched 319 * @response: the #WebKitNetworkResponse representing the redirect 320 * response, if any 321 * 322 * Emitted when a request is about to be sent. You can modify the 323 * request while handling this signal. You can set the URI in the 324 * #WebKitNetworkRequest object itself, and add/remove/replace 325 * headers using the #SoupMessage object it carries, if it is 326 * present. See webkit_network_request_get_message(). Setting the 327 * request URI to "about:blank" will effectively cause the request 328 * to load nothing, and can be used to disable the loading of 329 * specific resources. 330 * 331 * Notice that information about an eventual redirect is available 332 * in @response's #SoupMessage, not in the #SoupMessage carried by 333 * the @request. If @response is %NULL, then this is not a 334 * redirected request. 335 * 336 * The #WebKitWebResource object will be the same throughout all 337 * the lifetime of the resource, but the contents may change 338 * between signal emissions. 339 * 340 * Since: 1.7.5 341 */ 342 webkit_web_frame_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting", 343 G_TYPE_FROM_CLASS(frameClass), 344 G_SIGNAL_RUN_LAST, 345 0, 346 0, 0, 347 webkit_marshal_VOID__OBJECT_OBJECT_OBJECT, 348 G_TYPE_NONE, 3, 349 WEBKIT_TYPE_WEB_RESOURCE, 350 WEBKIT_TYPE_NETWORK_REQUEST, 351 WEBKIT_TYPE_NETWORK_RESPONSE); 352 353 /* 354 * WebKitWebFrame::resource-response-received 355 * @webFrame: the #WebKitWebFrame the response was received for 356 * @webResource: the #WebKitWebResource being loaded 357 * @response: the #WebKitNetworkResponse that was received. 358 * 359 * Emitted when the first byte of data arrives 360 * 361 * Since: 1.7.5 362 */ 363 webkit_web_frame_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received", 364 G_TYPE_FROM_CLASS(frameClass), 365 G_SIGNAL_RUN_LAST, 366 0, 367 0, 0, 368 webkit_marshal_VOID__OBJECT_OBJECT, 369 G_TYPE_NONE, 2, 370 WEBKIT_TYPE_WEB_RESOURCE, 371 WEBKIT_TYPE_NETWORK_RESPONSE); 372 373 /* 374 * WebKitWebFrame::resource-load-finished 375 * @webFrame: the #WebKitWebFrame the response was received for 376 * @webResource: the #WebKitWebResource being loaded 377 * 378 * Emitted when all the data for the resource was loaded. 379 * 380 * Since: 1.7.5 381 */ 382 webkit_web_frame_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished", 383 G_TYPE_FROM_CLASS(frameClass), 384 G_SIGNAL_RUN_LAST, 385 0, 386 0, 0, 387 g_cclosure_marshal_VOID__OBJECT, 388 G_TYPE_NONE, 1, 389 WEBKIT_TYPE_WEB_RESOURCE); 390 391 /* 392 * WebKitWebFrame::resource-content-length-received 393 * @webFrame: the #WebKitWebFrame the response was received for 394 * @webResource: the #WebKitWebResource that was loaded 395 * @lengthReceived: the resource data length in bytes 396 * 397 * Emitted when all the data for the resource was loaded. 398 * 399 * Since: 1.7.5 400 */ 401 webkit_web_frame_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received", 402 G_TYPE_FROM_CLASS(frameClass), 403 G_SIGNAL_RUN_LAST, 404 0, 405 0, 0, 406 webkit_marshal_VOID__OBJECT_INT, 407 G_TYPE_NONE, 2, 408 WEBKIT_TYPE_WEB_RESOURCE, 409 G_TYPE_INT); 410 411 /* 412 * WebKitWebFrame::resource-load-failed 413 * @webFrame: the #WebKitWebFrame the response was received for 414 * @webResource: the #WebKitWebResource that was loaded 415 * @webError: the #GError that was triggered 416 * 417 * Invoked when a resource failed to load. 418 * 419 * Since: 1.7.5 420 */ 421 webkit_web_frame_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed", 422 G_TYPE_FROM_CLASS(frameClass), 423 G_SIGNAL_RUN_LAST, 424 0, 425 0, 0, 426 webkit_marshal_VOID__OBJECT_POINTER, 427 G_TYPE_NONE, 2, 428 WEBKIT_TYPE_WEB_RESOURCE, 429 G_TYPE_POINTER); 430 304 431 /* 305 432 * implementations of virtual methods -
trunk/Source/WebKit/gtk/webkit/webkitwebresource.cpp
r99239 r106445 28 28 #include "webkitglobalsprivate.h" 29 29 #include "webkitmarshal.h" 30 #include "webkitnetworkresponse.h" 30 31 #include "webkitwebresourceprivate.h" 31 32 #include <glib.h> … … 46 47 47 48 enum { 49 // Resource loading 50 RESPONSE_RECEIVED, 51 LOAD_FINISHED, 52 CONTENT_LENGTH_RECEIVED, 53 LOAD_FAILED, 54 55 LAST_SIGNAL 56 }; 57 58 enum { 48 59 PROP_0, 49 50 60 PROP_URI, 51 61 PROP_MIME_TYPE, … … 54 64 }; 55 65 66 static guint webkit_web_resource_signals[LAST_SIGNAL] = { 0, }; 67 56 68 G_DEFINE_TYPE(WebKitWebResource, webkit_web_resource, G_TYPE_OBJECT); 57 69 … … 102 114 } 103 115 104 static void webkit_web_resource_class_init(WebKitWebResourceClass* klass)105 { 106 GObjectClass* gobject_class = G_OBJECT_CLASS( klass);116 static void webkit_web_resource_class_init(WebKitWebResourceClass* webResourceClass) 117 { 118 GObjectClass* gobject_class = G_OBJECT_CLASS(webResourceClass); 107 119 108 120 gobject_class->dispose = webkit_web_resource_dispose; … … 110 122 gobject_class->get_property = webkit_web_resource_get_property; 111 123 gobject_class->set_property = webkit_web_resource_set_property; 124 125 /* 126 * WebKitWebResource::response-received 127 * @webResource: the #WebKitWebResource being loaded 128 * @response: the #WebKitNetworkResponse that was received 129 * 130 * Emitted when the first byte of data arrives 131 * 132 * Since: 1.7.5 133 */ 134 webkit_web_resource_signals[RESPONSE_RECEIVED] = g_signal_new("response-received", 135 G_TYPE_FROM_CLASS(webResourceClass), 136 G_SIGNAL_RUN_LAST, 137 0, 138 0, 0, 139 g_cclosure_marshal_VOID__OBJECT, 140 G_TYPE_NONE, 1, 141 WEBKIT_TYPE_NETWORK_RESPONSE); 142 143 /* 144 * WebKitWebResource::load-failed 145 * @webResource: the #WebKitWebResource that was loaded 146 * @webError: the #GError that was triggered 147 * 148 * Invoked when a resource failed to load 149 * 150 * Since: 1.7.5 151 */ 152 webkit_web_resource_signals[LOAD_FAILED] = g_signal_new("load-failed", 153 G_TYPE_FROM_CLASS(webResourceClass), 154 G_SIGNAL_RUN_LAST, 155 0, 156 0, 0, 157 g_cclosure_marshal_VOID__OBJECT, 158 G_TYPE_NONE, 1, 159 G_TYPE_POINTER); 160 161 /* 162 * WebKitWebResource::load-finished 163 * @webResource: the #WebKitWebResource being loaded 164 * 165 * Emitted when all the data for the resource was loaded 166 * 167 * Since: 1.7.5 168 */ 169 webkit_web_resource_signals[LOAD_FINISHED] = g_signal_new("load-finished", 170 G_TYPE_FROM_CLASS(webResourceClass), 171 G_SIGNAL_RUN_LAST, 172 0, 173 0, 0, 174 g_cclosure_marshal_VOID__VOID, 175 G_TYPE_NONE, 0); 176 177 /* 178 * WebKitWebResource::content-length-received 179 * @webResource: the #WebKitWebResource that was loaded 180 * @lengthReceived: the resource data length in bytes 181 * 182 * Emitted when all the data for the resource was loaded 183 * 184 * Since: 1.7.5 185 */ 186 webkit_web_resource_signals[CONTENT_LENGTH_RECEIVED] = g_signal_new("content-length-received", 187 G_TYPE_FROM_CLASS(webResourceClass), 188 G_SIGNAL_RUN_LAST, 189 0, 190 0, 0, 191 g_cclosure_marshal_VOID__INT, 192 G_TYPE_NONE, 1, 193 G_TYPE_INT); 112 194 113 195 /** -
trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp
r105289 r106445 209 209 VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED, 210 210 VIEWPORT_ATTRIBUTES_CHANGED, 211 RESOURCE_RESPONSE_RECEIVED, 212 RESOURCE_LOAD_FINISHED, 213 RESOURCE_CONTENT_LENGTH_RECEIVED, 214 RESOURCE_LOAD_FAILED, 211 215 212 216 LAST_SIGNAL … … 2607 2611 G_TYPE_NONE, 1, 2608 2612 WEBKIT_TYPE_VIEWPORT_ATTRIBUTES); 2613 2614 /* 2615 * WebKitWebView::resource-response-received 2616 * @webView: the object which received the signal 2617 * @webFrame: the #WebKitWebFrame the response was received for 2618 * @webResource: the #WebKitWebResource being loaded 2619 * @response: the #WebKitNetworkResponse that was received 2620 * 2621 * Emitted when the first byte of data arrives 2622 * 2623 * Since: 1.7.5 2624 */ 2625 webkit_web_view_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received", 2626 G_TYPE_FROM_CLASS(webViewClass), 2627 G_SIGNAL_RUN_LAST, 2628 0, 2629 0, 0, 2630 webkit_marshal_VOID__OBJECT_OBJECT_OBJECT, 2631 G_TYPE_NONE, 3, 2632 WEBKIT_TYPE_WEB_FRAME, 2633 WEBKIT_TYPE_WEB_RESOURCE, 2634 WEBKIT_TYPE_NETWORK_RESPONSE); 2635 2636 /* 2637 * WebKitWebView::resource-load-finished 2638 * @webView: the object which received the signal 2639 * @webFrame: the #WebKitWebFrame the response was received for 2640 * @webResource: the #WebKitWebResource that was loaded 2641 * 2642 * Emitted when all the data for the resource was loaded 2643 * 2644 * Since: 1.7.5 2645 */ 2646 webkit_web_view_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished", 2647 G_TYPE_FROM_CLASS(webViewClass), 2648 G_SIGNAL_RUN_LAST, 2649 0, 2650 0, 0, 2651 webkit_marshal_VOID__OBJECT_OBJECT, 2652 G_TYPE_NONE, 2, 2653 WEBKIT_TYPE_WEB_FRAME, 2654 WEBKIT_TYPE_WEB_RESOURCE); 2655 2656 /* 2657 * WebKitWebView::resource-content-length-received 2658 * @webView: the object which received the signal 2659 * @webFrame: the #WebKitWebFrame the response was received for 2660 * @webResource: the #WebKitWebResource that was loaded 2661 * @lengthReceived: the resource data length in bytes 2662 * 2663 * Emitted when the HTTP Content-Length response header has been 2664 * received and parsed successfully. 2665 * 2666 * Since: 1.7.5 2667 */ 2668 webkit_web_view_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received", 2669 G_TYPE_FROM_CLASS(webViewClass), 2670 G_SIGNAL_RUN_LAST, 2671 0, 2672 0, 0, 2673 webkit_marshal_VOID__OBJECT_OBJECT_INT, 2674 G_TYPE_NONE, 3, 2675 WEBKIT_TYPE_WEB_FRAME, 2676 WEBKIT_TYPE_WEB_RESOURCE, 2677 G_TYPE_INT); 2678 2679 /* 2680 * WebKitWebView::resource-load-failed 2681 * @webView: the object which received the signal 2682 * @webFrame: the #WebKitWebFrame the response was received for 2683 * @webResource: the #WebKitWebResource that was loaded 2684 * @webError: the #GError that was triggered 2685 * 2686 * Invoked when a resource failed to load 2687 * 2688 * Since: 1.7.5 2689 */ 2690 webkit_web_view_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed", 2691 G_TYPE_FROM_CLASS(webViewClass), 2692 G_SIGNAL_RUN_LAST, 2693 0, 2694 0, 0, 2695 webkit_marshal_VOID__OBJECT_OBJECT_POINTER, 2696 G_TYPE_NONE, 3, 2697 WEBKIT_TYPE_WEB_FRAME, 2698 WEBKIT_TYPE_WEB_RESOURCE, 2699 G_TYPE_POINTER); 2609 2700 2610 2701 /* -
trunk/Source/WebKit/gtk/webkitmarshal.list
r72675 r106445 18 18 OBJECT:VOID 19 19 VOID:OBJECT,OBJECT 20 VOID:OBJECT,OBJECT,INT 21 VOID:OBJECT,OBJECT,OBJECT 22 VOID:OBJECT,OBJECT,POINTER 20 23 VOID:OBJECT,OBJECT,OBJECT,OBJECT 21 24 VOID:OBJECT,POINTER,POINTER 25 VOID:OBJECT,INT 26 VOID:OBJECT,POINTER 22 27 VOID:OBJECT,STRING 23 28 VOID:STRING 24 29 VOID:STRING,STRING 25 -
trunk/Tools/ChangeLog
r106442 r106445 1 2012-02-01 Philippe Normand <pnormand@igalia.com> and Sergio Villar Senin <svillar@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Improve FrameLoader signals. Resource loading 6 https://bugs.webkit.org/show_bug.cgi?id=49543 7 8 Support for the new loader signals in DRT. 9 10 * DumpRenderTree/gtk/DumpRenderTree.cpp: 11 (urlPath): 12 (willSendRequestCallback): 13 (urlSuitableForTestResult): 14 (descriptionSuitableForTestResult): 15 (didReceiveResponse): 16 (didFinishLoading): 17 (didFailLoadingWithError): 18 (createWebView): 19 1 20 2012-02-01 Ryosuke Niwa <rniwa@webkit.org> 2 21 -
trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
r106126 r106445 1064 1064 } 1065 1065 1066 static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource*, WebKitNetworkRequest* request, WebKitNetworkResponse*) 1067 { 1066 1067 static CString pathFromSoupURI(SoupURI* uri) 1068 { 1069 if (!uri) 1070 return CString(); 1071 1072 if (g_str_equal(uri->scheme, "http")) { 1073 GOwnPtr<char> uriString(soup_uri_to_string(uri, FALSE)); 1074 return CString(uriString.get()); 1075 } 1076 1077 GOwnPtr<gchar> pathDirname(g_path_get_basename(g_path_get_dirname(uri->path))); 1078 GOwnPtr<gchar> pathBasename(g_path_get_basename(uri->path)); 1079 GOwnPtr<gchar> urlPath(g_strdup_printf("%s/%s", pathDirname.get(), pathBasename.get())); 1080 return CString(urlPath.get()); 1081 } 1082 1083 static CString convertSoupMessageToURLPath(SoupMessage* soupMessage) 1084 { 1085 if (!soupMessage) 1086 return CString(); 1087 if (SoupURI* requestURI = soup_message_get_uri(soupMessage)) 1088 return pathFromSoupURI(requestURI); 1089 return CString(); 1090 } 1091 1092 static CString convertNetworkRequestToURLPath(WebKitNetworkRequest* request) 1093 { 1094 return convertSoupMessageToURLPath(webkit_network_request_get_message(request)); 1095 } 1096 1097 static CString convertWebResourceToURLPath(WebKitWebResource* webResource) 1098 { 1099 SoupURI* uri = soup_uri_new(webkit_web_resource_get_uri(webResource)); 1100 CString urlPath(pathFromSoupURI(uri)); 1101 soup_uri_free(uri); 1102 return urlPath; 1103 } 1104 1105 static CString urlSuitableForTestResult(const char* uriString) 1106 { 1107 if (!g_str_has_prefix(uriString, "file://")) 1108 return CString(uriString); 1109 1110 GOwnPtr<gchar> basename(g_path_get_basename(uriString)); 1111 return CString(basename.get()); 1112 } 1113 1114 static CString descriptionSuitableForTestResult(SoupURI* uri) 1115 { 1116 if (!uri) 1117 return CString(""); 1118 1119 GOwnPtr<char> uriString(soup_uri_to_string(uri, false)); 1120 return urlSuitableForTestResult(uriString.get()); 1121 } 1122 1123 static CString descriptionSuitableForTestResult(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource) 1124 { 1125 SoupURI* uri = soup_uri_new(webkit_web_resource_get_uri(webResource)); 1126 CString description; 1127 WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(webFrame); 1128 1129 if (webResource == webkit_web_data_source_get_main_resource(dataSource) 1130 && (!webkit_web_view_get_progress(webView) || g_str_equal(uri->scheme, "file"))) 1131 description = CString("<unknown>"); 1132 else 1133 description = convertWebResourceToURLPath(webResource); 1134 1135 if (uri) 1136 soup_uri_free(uri); 1137 1138 return description; 1139 } 1140 1141 static CString descriptionSuitableForTestResult(GError* error, WebKitWebResource* webResource) 1142 { 1143 const gchar* errorDomain = g_quark_to_string(error->domain); 1144 CString resourceURIString(urlSuitableForTestResult(webkit_web_resource_get_uri(webResource))); 1145 1146 if (g_str_equal(errorDomain, "webkit-network-error-quark")) 1147 errorDomain = "NSURLErrorDomain"; 1148 1149 // TODO: the other ports get the failingURL from the ResourceError 1150 GOwnPtr<char> errorString(g_strdup_printf("<NSError domain %s, code %d, failing URL \"%s\">", 1151 errorDomain, error->code, resourceURIString.data())); 1152 return CString(errorString.get()); 1153 } 1154 1155 static CString descriptionSuitableForTestResult(WebKitNetworkRequest* request) 1156 { 1157 SoupMessage* soupMessage = webkit_network_request_get_message(request); 1158 1159 if (!soupMessage) { 1160 g_printerr("GRR\n"); 1161 return CString(""); 1162 } 1163 1164 SoupURI* requestURI = soup_message_get_uri(soupMessage); 1165 SoupURI* mainDocumentURI = soup_message_get_first_party(soupMessage); 1166 CString requestURIString(descriptionSuitableForTestResult(requestURI)); 1167 CString mainDocumentURIString(descriptionSuitableForTestResult(mainDocumentURI)); 1168 CString path(convertNetworkRequestToURLPath(request)); 1169 GOwnPtr<char> description(g_strdup_printf("<NSURLRequest URL %s, main document URL %s, http method %s>", 1170 path.data(), mainDocumentURIString.data(), 1171 soupMessage ? soupMessage->method : "(none)")); 1172 return CString(description.get()); 1173 } 1174 1175 static CString descriptionSuitableForTestResult(WebKitNetworkResponse* response) 1176 { 1177 if (!response) 1178 return CString("(null)"); 1179 1180 int statusCode = 0; 1181 CString responseURIString(urlSuitableForTestResult(webkit_network_response_get_uri(response))); 1182 SoupMessage* soupMessage = webkit_network_response_get_message(response); 1183 CString path; 1184 1185 if (soupMessage) { 1186 statusCode = soupMessage->status_code; 1187 path = convertSoupMessageToURLPath(soupMessage); 1188 } else 1189 path = CString(""); 1190 1191 GOwnPtr<char> description(g_strdup_printf("<NSURLResponse %s, http status code %d>", path.data(), statusCode)); 1192 return CString(description.get()); 1193 } 1194 1195 static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* resource, WebKitNetworkRequest* request, WebKitNetworkResponse* response) 1196 { 1197 1198 1068 1199 if (!done && gLayoutTestController->willSendRequestReturnsNull()) { 1069 1200 // As requested by the LayoutTestController, don't perform the request. … … 1072 1203 } 1073 1204 1205 if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) 1206 printf("%s - willSendRequest %s redirectResponse %s\n", 1207 convertNetworkRequestToURLPath(request).data(), 1208 descriptionSuitableForTestResult(request).data(), 1209 descriptionSuitableForTestResult(response).data()); 1210 1074 1211 SoupMessage* soupMessage = webkit_network_request_get_message(request); 1075 1212 SoupURI* uri = soup_uri_new(webkit_network_request_get_uri(request)); … … 1079 1216 && g_ascii_strncasecmp(uri->host, "localhost", 9)) { 1080 1217 printf("Blocked access to external URL %s\n", soup_uri_to_string(uri, FALSE)); 1218 // Cancel load of blocked resource to avoid potential 1219 // network-related timeouts in tests. 1220 webkit_network_request_set_uri(request, "about:blank"); 1081 1221 soup_uri_free(uri); 1082 1222 return; 1083 1223 } 1224 1084 1225 if (uri) 1085 1226 soup_uri_free(uri); … … 1089 1230 for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) 1090 1231 soup_message_headers_remove(soupMessage->request_headers, header->c_str()); 1232 } 1233 } 1234 1235 1236 static void didReceiveResponse(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource* webResource, WebKitNetworkResponse* response) 1237 { 1238 if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { 1239 CString responseDescription(descriptionSuitableForTestResult(response)); 1240 CString path(convertWebResourceToURLPath(webResource)); 1241 printf("%s - didReceiveResponse %s\n", path.data(), responseDescription.data()); 1242 } 1243 1244 // TODO: add "has MIME type" whenever dumpResourceResponseMIMETypes() is supported. 1245 // See https://bugs.webkit.org/show_bug.cgi?id=58222. 1246 } 1247 1248 static void didFinishLoading(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource) 1249 { 1250 if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) 1251 printf("%s - didFinishLoading\n", descriptionSuitableForTestResult(webView, webFrame, webResource).data()); 1252 } 1253 1254 static void didFailLoadingWithError(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource, GError* webError) 1255 { 1256 if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { 1257 CString webErrorString(descriptionSuitableForTestResult(webError, webResource)); 1258 printf("%s - didFailLoadingWithError: %s\n", descriptionSuitableForTestResult(webView, webFrame, webResource).data(), 1259 webErrorString.data()); 1091 1260 } 1092 1261 } … … 1123 1292 "signal::frame-created", frameCreatedCallback, 0, 1124 1293 "signal::resource-request-starting", willSendRequestCallback, 0, 1125 1294 "signal::resource-response-received", didReceiveResponse, 0, 1295 "signal::resource-load-finished", didFinishLoading, 0, 1296 "signal::resource-load-failed", didFailLoadingWithError, 0, 1126 1297 NULL); 1127 1298 connectEditingCallbacks(view);
Note: See TracChangeset
for help on using the changeset viewer.