+2012-02-01 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Improve FrameLoader signals. Resource loading
+ https://bugs.webkit.org/show_bug.cgi?id=49543
+
+ Unskip tests now passing.
+
+ * platform/gtk/Skipped:
+ * platform/gtk/fast/loader/file-protocol-fragment-expected.txt: Added.
+ * platform/gtk/http/tests/misc/willCacheResponse-delegate-callback-expected.txt:
+
2012-02-01 Balazs Ankes <Ankes.Balazs@stud.u-szeged.hu>
[Qt] Unreviewed gardening after r106373.
fast/html/tab-order.html
# Missing delegates:
-# Need proper frame loader callbacks reporting
-# See https://bugs.webkit.org/show_bug.cgi?id=32170
-fast/loader/file-protocol-fragment.html
-# Tests failing because of missing resource load delegate callbacks.
-fast/loader/main-document-url-for-non-http-loads.html
-http/tests/misc/link-rel-icon-beforeload.html
+
# Tests failing because of missing policy delegate callbacks.
fast/loader/onload-policy-ignore-for-frame.html
fast/loader/policy-delegate-action-hit-test-zoomed.html
# https://bugs.webkit.org/show_bug.cgi?id=55682
fast/images/support-broken-image-delegate.html
-# Fail due to an extra "CONSOLE MESSAGE: line 1: SyntaxError: Parse error"
-fast/loader/onload-willSendRequest-null-for-script.html
-fast/loader/willSendRequest-null-for-preload.html
-
# Requires willSendRequestReturnsNullOnRedirect + willSendRequest + didFinishLoading
http/tests/misc/will-send-request-returns-null-on-redirect.html
-http/tests/misc/favicon-loads-with-icon-loading-override.html
# Requires willPerformClientRedirectToURL
# https://bugs.webkit.org/show_bug.cgi?id=58526
http/tests/loading/onload-vs-immediate-refresh.pl
# https://bugs.webkit.org/show_bug.cgi?id=54189
fast/replaced/border-radius-clip.html
-# New test needs enhanced frameloader delegate logging in DRT
-# Discussed in https://bugs.webkit.org/show_bug.cgi?id=38928
-fast/loader/recursive-before-unload-crash.html
-fast/loader/null-request-after-willSendRequest.html
-
# Need to dump context menu items on eventSender.contextClick(true).
# https://bugs.webkit.org/show_bug.cgi?id=39102
editing/spelling/context-menu-suggestions.html
fast/events/dropzone-002.html
fast/events/dropzone-005.html
-# [GTK] DumpRenderTree doesn't block external requests
-# https://bugs.webkit.org/show_bug.cgi?id=62585
-fast/workers/worker-crash-with-invalid-location.html
-
# https://bugs.webkit.org/show_bug.cgi?id=64085
http/tests/misc/iframe-reparenting-id-collision.html
--- /dev/null
+resources/stylesheet.css - willSendRequest <NSURLRequest URL resources/stylesheet.css, main document URL file-protocol-fragment.html, http method GET> redirectResponse (null)
+resources/stylesheet.css - willSendRequest <NSURLRequest URL resources/stylesheet.css, main document URL file-protocol-fragment.html, http method GET> redirectResponse (null)
+<unknown> - didFinishLoading
+resources/stylesheet.css - didReceiveResponse <NSURLResponse resources/stylesheet.css, http status code 0>
+resources/stylesheet.css - didReceiveResponse <NSURLResponse resources/stylesheet.css, http status code 0>
+resources/stylesheet.css - didFinishLoading
+resources/stylesheet.css - didFinishLoading
+This tests that file: URL are loaded separately even if they differ by the fragment only.
+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)
+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>
This tests for the willCacheResponse resource delegate callback as added for radar 5008925.
The test is only meaningful if you are running it under DumpRenderTree
+2012-02-01 Philippe Normand <pnormand@igalia.com> and Sergio Villar Senin <svillar@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Improve FrameLoader signals. Resource loading
+ https://bugs.webkit.org/show_bug.cgi?id=49543
+
+ New signals:
+ WebKitWebFrame::resource-request-starting
+ WebKitWebFrame::resource-response-received
+ WebKitWebFrame::resource-load-finished
+ WebKitWebFrame::resource-content-length-received
+ WebKitWebFrame::resource-load-failed
+ WebKitWebResource::response-received
+ WebKitWebResource::load-failed
+ WebKitWebResource::load-finished
+ WebKitWebResource::content-length-received
+ WebKitWebView::resource-response-received
+ WebKitWebView::resource-load-finished
+ WebKitWebView::resource-content-length-received
+ WebKitWebView::resource-load-failed
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::dispatchWillSendRequest):
+ (WebKit::FrameLoaderClient::dispatchDidReceiveResponse):
+ (WebKit::FrameLoaderClient::dispatchDidReceiveContentLength):
+ (WebKit::FrameLoaderClient::dispatchDidFinishLoading):
+ (WebKit::FrameLoaderClient::dispatchDidFailLoading):
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_class_init):
+ * webkit/webkitwebresource.cpp:
+ (webkit_web_resource_class_init):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_class_init):
+ * webkitmarshal.list:
+
2012-01-23 Mario Sanchez Prada <msanchez@igalia.com>
[GTK] Refactor GTK's accessibilitity code to be more modular
g_free(webResource->priv->uri);
webResource->priv->uri = g_strdup(request.url().string().utf8().data());
}
-
+
g_signal_emit_by_name(webView, "resource-request-starting", m_frame, webResource, networkRequest.get(), networkResponse.get());
+ g_signal_emit_by_name(m_frame, "resource-request-starting", webResource, networkRequest.get(), networkResponse.get());
// Feed any changes back into the ResourceRequest object.
SoupMessage* message = webkit_network_request_get_message(networkRequest.get());
delete this;
}
-void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader* loader, unsigned long, const ResourceResponse& response)
+void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response)
{
// Update our knowledge of request soup flags - some are only set
// after the request is done.
loader->request().setSoupMessageFlags(response.soupMessageFlags());
m_response = response;
+
+ WebKitWebView* webView = getViewFromFrame(m_frame);
+ GOwnPtr<gchar> identifierString(toString(identifier));
+ WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get());
+ GRefPtr<WebKitNetworkResponse> networkResponse(adoptGRef(kitNew(response)));
+
+ g_signal_emit_by_name(webResource, "response-received", networkResponse.get());
+ g_signal_emit_by_name(m_frame, "resource-response-received", webResource, networkResponse.get());
+ g_signal_emit_by_name(webView, "resource-response-received", m_frame, webResource, networkResponse.get());
}
void FrameLoaderClient::dispatchDecidePolicyForResponse(FramePolicyFunction policyFunction, const ResourceResponse& response, const ResourceRequest& resourceRequest)
void FrameLoaderClient::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength)
{
- notImplemented();
+ WebKitWebView* webView = getViewFromFrame(m_frame);
+ GOwnPtr<gchar> identifierString(toString(identifier));
+ WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get());
+
+ g_signal_emit_by_name(webResource, "content-length-received", dataLength);
+ g_signal_emit_by_name(m_frame, "resource-content-length-received", webResource, dataLength);
+ g_signal_emit_by_name(webView, "resource-content-length-received", m_frame, webResource, dataLength);
}
void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader, unsigned long identifier)
webkit_web_resource_init_with_core_resource(webResource, coreResource.get());
- // FIXME: This function should notify the application that the resource
- // finished loading, maybe using a load-status property in the
- // WebKitWebResource object, similar to what we do for WebKitWebFrame'
- // signal.
- notImplemented();
+ g_signal_emit_by_name(webResource, "load-finished");
+ g_signal_emit_by_name(m_frame, "resource-load-finished", webResource);
+ g_signal_emit_by_name(webView, "resource-load-finished", m_frame, webResource);
}
void FrameLoaderClient::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
{
static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier);
- // FIXME: This function should notify the application that the resource failed
- // loading, maybe a 'load-error' signal in the WebKitWebResource object.
- notImplemented();
+ WebKitWebView* webView = getViewFromFrame(m_frame);
+ GOwnPtr<gchar> identifierString(toString(identifier));
+ WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get());
+ GOwnPtr<GError> webError(g_error_new_literal(g_quark_from_string(error.domain().utf8().data()),
+ error.errorCode(),
+ error.localizedDescription().utf8().data()));
+
+ g_signal_emit_by_name(webResource, "load-failed", webError.get());
+ g_signal_emit_by_name(m_frame, "resource-load-failed", webResource, webError.get());
+ g_signal_emit_by_name(webView, "resource-load-failed", m_frame, webResource, webError.get());
}
bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length)
#include "webkitenumtypes.h"
#include "webkitglobalsprivate.h"
#include "webkitmarshal.h"
+#include "webkitnetworkresponse.h"
#include "webkitnetworkrequestprivate.h"
#include "webkitnetworkresponseprivate.h"
#include "webkitsecurityoriginprivate.h"
#include "webkitwebframeprivate.h"
+#include "webkitwebresource.h"
#include "webkitwebview.h"
#include "webkitwebviewprivate.h"
#include <JavaScriptCore/APICast.h>
TITLE_CHANGED,
HOVERING_OVER_LINK,
SCROLLBARS_POLICY_CHANGED,
+ // Resource loading signals
+ RESOURCE_REQUEST_STARTING,
+ RESOURCE_RESPONSE_RECEIVED,
+ RESOURCE_LOAD_FINISHED,
+ RESOURCE_CONTENT_LENGTH_RECEIVED,
+ RESOURCE_LOAD_FAILED,
+
LAST_SIGNAL
};
webkit_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
+
+ /**
+ * WebKitWebFrame::resource-request-starting:
+ * @web_frame: the #WebKitWebFrame whose load dispatched this request
+ * @web_resource: an empty #WebKitWebResource object
+ * @request: the #WebKitNetworkRequest that will be dispatched
+ * @response: the #WebKitNetworkResponse representing the redirect
+ * response, if any
+ *
+ * Emitted when a request is about to be sent. You can modify the
+ * request while handling this signal. You can set the URI in the
+ * #WebKitNetworkRequest object itself, and add/remove/replace
+ * headers using the #SoupMessage object it carries, if it is
+ * present. See webkit_network_request_get_message(). Setting the
+ * request URI to "about:blank" will effectively cause the request
+ * to load nothing, and can be used to disable the loading of
+ * specific resources.
+ *
+ * Notice that information about an eventual redirect is available
+ * in @response's #SoupMessage, not in the #SoupMessage carried by
+ * the @request. If @response is %NULL, then this is not a
+ * redirected request.
+ *
+ * The #WebKitWebResource object will be the same throughout all
+ * the lifetime of the resource, but the contents may change
+ * between signal emissions.
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_frame_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting",
+ G_TYPE_FROM_CLASS(frameClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_OBJECT_OBJECT,
+ G_TYPE_NONE, 3,
+ WEBKIT_TYPE_WEB_RESOURCE,
+ WEBKIT_TYPE_NETWORK_REQUEST,
+ WEBKIT_TYPE_NETWORK_RESPONSE);
+
+ /*
+ * WebKitWebFrame::resource-response-received
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource being loaded
+ * @response: the #WebKitNetworkResponse that was received.
+ *
+ * Emitted when the first byte of data arrives
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_frame_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received",
+ G_TYPE_FROM_CLASS(frameClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_OBJECT,
+ G_TYPE_NONE, 2,
+ WEBKIT_TYPE_WEB_RESOURCE,
+ WEBKIT_TYPE_NETWORK_RESPONSE);
+
+ /*
+ * WebKitWebFrame::resource-load-finished
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource being loaded
+ *
+ * Emitted when all the data for the resource was loaded.
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_frame_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished",
+ G_TYPE_FROM_CLASS(frameClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ WEBKIT_TYPE_WEB_RESOURCE);
+
+ /*
+ * WebKitWebFrame::resource-content-length-received
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource that was loaded
+ * @lengthReceived: the resource data length in bytes
+ *
+ * Emitted when all the data for the resource was loaded.
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_frame_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received",
+ G_TYPE_FROM_CLASS(frameClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_INT,
+ G_TYPE_NONE, 2,
+ WEBKIT_TYPE_WEB_RESOURCE,
+ G_TYPE_INT);
+
+ /*
+ * WebKitWebFrame::resource-load-failed
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource that was loaded
+ * @webError: the #GError that was triggered
+ *
+ * Invoked when a resource failed to load.
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_frame_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed",
+ G_TYPE_FROM_CLASS(frameClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_POINTER,
+ G_TYPE_NONE, 2,
+ WEBKIT_TYPE_WEB_RESOURCE,
+ G_TYPE_POINTER);
+
/*
* implementations of virtual methods
*/
#include "webkitenumtypes.h"
#include "webkitglobalsprivate.h"
#include "webkitmarshal.h"
+#include "webkitnetworkresponse.h"
#include "webkitwebresourceprivate.h"
#include <glib.h>
#include <glib/gi18n-lib.h>
using namespace WebCore;
enum {
- PROP_0,
+ // Resource loading
+ RESPONSE_RECEIVED,
+ LOAD_FINISHED,
+ CONTENT_LENGTH_RECEIVED,
+ LOAD_FAILED,
+
+ LAST_SIGNAL
+};
+enum {
+ PROP_0,
PROP_URI,
PROP_MIME_TYPE,
PROP_ENCODING,
PROP_FRAME_NAME
};
+static guint webkit_web_resource_signals[LAST_SIGNAL] = { 0, };
+
G_DEFINE_TYPE(WebKitWebResource, webkit_web_resource, G_TYPE_OBJECT);
static void webkit_web_resource_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);
G_OBJECT_CLASS(webkit_web_resource_parent_class)->finalize(object);
}
-static void webkit_web_resource_class_init(WebKitWebResourceClass* klass)
+static void webkit_web_resource_class_init(WebKitWebResourceClass* webResourceClass)
{
- GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
+ GObjectClass* gobject_class = G_OBJECT_CLASS(webResourceClass);
gobject_class->dispose = webkit_web_resource_dispose;
gobject_class->finalize = webkit_web_resource_finalize;
gobject_class->get_property = webkit_web_resource_get_property;
gobject_class->set_property = webkit_web_resource_set_property;
+ /*
+ * WebKitWebResource::response-received
+ * @webResource: the #WebKitWebResource being loaded
+ * @response: the #WebKitNetworkResponse that was received
+ *
+ * Emitted when the first byte of data arrives
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_resource_signals[RESPONSE_RECEIVED] = g_signal_new("response-received",
+ G_TYPE_FROM_CLASS(webResourceClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ WEBKIT_TYPE_NETWORK_RESPONSE);
+
+ /*
+ * WebKitWebResource::load-failed
+ * @webResource: the #WebKitWebResource that was loaded
+ * @webError: the #GError that was triggered
+ *
+ * Invoked when a resource failed to load
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_resource_signals[LOAD_FAILED] = g_signal_new("load-failed",
+ G_TYPE_FROM_CLASS(webResourceClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+
+ /*
+ * WebKitWebResource::load-finished
+ * @webResource: the #WebKitWebResource being loaded
+ *
+ * Emitted when all the data for the resource was loaded
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_resource_signals[LOAD_FINISHED] = g_signal_new("load-finished",
+ G_TYPE_FROM_CLASS(webResourceClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /*
+ * WebKitWebResource::content-length-received
+ * @webResource: the #WebKitWebResource that was loaded
+ * @lengthReceived: the resource data length in bytes
+ *
+ * Emitted when all the data for the resource was loaded
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_resource_signals[CONTENT_LENGTH_RECEIVED] = g_signal_new("content-length-received",
+ G_TYPE_FROM_CLASS(webResourceClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
+
/**
* WebKitWebResource:uri:
*
EDITING_ENDED,
VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED,
VIEWPORT_ATTRIBUTES_CHANGED,
+ RESOURCE_RESPONSE_RECEIVED,
+ RESOURCE_LOAD_FINISHED,
+ RESOURCE_CONTENT_LENGTH_RECEIVED,
+ RESOURCE_LOAD_FAILED,
LAST_SIGNAL
};
WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
/*
+ * WebKitWebView::resource-response-received
+ * @webView: the object which received the signal
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource being loaded
+ * @response: the #WebKitNetworkResponse that was received
+ *
+ * Emitted when the first byte of data arrives
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_view_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_OBJECT_OBJECT,
+ G_TYPE_NONE, 3,
+ WEBKIT_TYPE_WEB_FRAME,
+ WEBKIT_TYPE_WEB_RESOURCE,
+ WEBKIT_TYPE_NETWORK_RESPONSE);
+
+ /*
+ * WebKitWebView::resource-load-finished
+ * @webView: the object which received the signal
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource that was loaded
+ *
+ * Emitted when all the data for the resource was loaded
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_view_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_OBJECT,
+ G_TYPE_NONE, 2,
+ WEBKIT_TYPE_WEB_FRAME,
+ WEBKIT_TYPE_WEB_RESOURCE);
+
+ /*
+ * WebKitWebView::resource-content-length-received
+ * @webView: the object which received the signal
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource that was loaded
+ * @lengthReceived: the resource data length in bytes
+ *
+ * Emitted when the HTTP Content-Length response header has been
+ * received and parsed successfully.
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_view_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_OBJECT_INT,
+ G_TYPE_NONE, 3,
+ WEBKIT_TYPE_WEB_FRAME,
+ WEBKIT_TYPE_WEB_RESOURCE,
+ G_TYPE_INT);
+
+ /*
+ * WebKitWebView::resource-load-failed
+ * @webView: the object which received the signal
+ * @webFrame: the #WebKitWebFrame the response was received for
+ * @webResource: the #WebKitWebResource that was loaded
+ * @webError: the #GError that was triggered
+ *
+ * Invoked when a resource failed to load
+ *
+ * Since: 1.7.5
+ */
+ webkit_web_view_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 0, 0,
+ webkit_marshal_VOID__OBJECT_OBJECT_POINTER,
+ G_TYPE_NONE, 3,
+ WEBKIT_TYPE_WEB_FRAME,
+ WEBKIT_TYPE_WEB_RESOURCE,
+ G_TYPE_POINTER);
+
+ /*
* implementations of virtual methods
*/
webViewClass->create_web_view = webkit_web_view_real_create_web_view;
OBJECT:STRING,STRING,POINTER
OBJECT:VOID
VOID:OBJECT,OBJECT
+VOID:OBJECT,OBJECT,INT
+VOID:OBJECT,OBJECT,OBJECT
+VOID:OBJECT,OBJECT,POINTER
VOID:OBJECT,OBJECT,OBJECT,OBJECT
VOID:OBJECT,POINTER,POINTER
+VOID:OBJECT,INT
+VOID:OBJECT,POINTER
VOID:OBJECT,STRING
VOID:STRING
VOID:STRING,STRING
-
+2012-02-01 Philippe Normand <pnormand@igalia.com> and Sergio Villar Senin <svillar@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Improve FrameLoader signals. Resource loading
+ https://bugs.webkit.org/show_bug.cgi?id=49543
+
+ Support for the new loader signals in DRT.
+
+ * DumpRenderTree/gtk/DumpRenderTree.cpp:
+ (urlPath):
+ (willSendRequestCallback):
+ (urlSuitableForTestResult):
+ (descriptionSuitableForTestResult):
+ (didReceiveResponse):
+ (didFinishLoading):
+ (didFailLoadingWithError):
+ (createWebView):
+
2012-02-01 Ryosuke Niwa <rniwa@webkit.org>
run-perf-tests should restart DRT for each test
g_signal_connect(webFrame, "notify::load-status", G_CALLBACK(webFrameLoadStatusNotified), NULL);
}
-static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource*, WebKitNetworkRequest* request, WebKitNetworkResponse*)
+
+static CString pathFromSoupURI(SoupURI* uri)
+{
+ if (!uri)
+ return CString();
+
+ if (g_str_equal(uri->scheme, "http")) {
+ GOwnPtr<char> uriString(soup_uri_to_string(uri, FALSE));
+ return CString(uriString.get());
+ }
+
+ GOwnPtr<gchar> pathDirname(g_path_get_basename(g_path_get_dirname(uri->path)));
+ GOwnPtr<gchar> pathBasename(g_path_get_basename(uri->path));
+ GOwnPtr<gchar> urlPath(g_strdup_printf("%s/%s", pathDirname.get(), pathBasename.get()));
+ return CString(urlPath.get());
+}
+
+static CString convertSoupMessageToURLPath(SoupMessage* soupMessage)
+{
+ if (!soupMessage)
+ return CString();
+ if (SoupURI* requestURI = soup_message_get_uri(soupMessage))
+ return pathFromSoupURI(requestURI);
+ return CString();
+}
+
+static CString convertNetworkRequestToURLPath(WebKitNetworkRequest* request)
+{
+ return convertSoupMessageToURLPath(webkit_network_request_get_message(request));
+}
+
+static CString convertWebResourceToURLPath(WebKitWebResource* webResource)
+{
+ SoupURI* uri = soup_uri_new(webkit_web_resource_get_uri(webResource));
+ CString urlPath(pathFromSoupURI(uri));
+ soup_uri_free(uri);
+ return urlPath;
+}
+
+static CString urlSuitableForTestResult(const char* uriString)
+{
+ if (!g_str_has_prefix(uriString, "file://"))
+ return CString(uriString);
+
+ GOwnPtr<gchar> basename(g_path_get_basename(uriString));
+ return CString(basename.get());
+}
+
+static CString descriptionSuitableForTestResult(SoupURI* uri)
+{
+ if (!uri)
+ return CString("");
+
+ GOwnPtr<char> uriString(soup_uri_to_string(uri, false));
+ return urlSuitableForTestResult(uriString.get());
+}
+
+static CString descriptionSuitableForTestResult(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource)
+{
+ SoupURI* uri = soup_uri_new(webkit_web_resource_get_uri(webResource));
+ CString description;
+ WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(webFrame);
+
+ if (webResource == webkit_web_data_source_get_main_resource(dataSource)
+ && (!webkit_web_view_get_progress(webView) || g_str_equal(uri->scheme, "file")))
+ description = CString("<unknown>");
+ else
+ description = convertWebResourceToURLPath(webResource);
+
+ if (uri)
+ soup_uri_free(uri);
+
+ return description;
+}
+
+static CString descriptionSuitableForTestResult(GError* error, WebKitWebResource* webResource)
+{
+ const gchar* errorDomain = g_quark_to_string(error->domain);
+ CString resourceURIString(urlSuitableForTestResult(webkit_web_resource_get_uri(webResource)));
+
+ if (g_str_equal(errorDomain, "webkit-network-error-quark"))
+ errorDomain = "NSURLErrorDomain";
+
+ // TODO: the other ports get the failingURL from the ResourceError
+ GOwnPtr<char> errorString(g_strdup_printf("<NSError domain %s, code %d, failing URL \"%s\">",
+ errorDomain, error->code, resourceURIString.data()));
+ return CString(errorString.get());
+}
+
+static CString descriptionSuitableForTestResult(WebKitNetworkRequest* request)
+{
+ SoupMessage* soupMessage = webkit_network_request_get_message(request);
+
+ if (!soupMessage) {
+ g_printerr("GRR\n");
+ return CString("");
+ }
+
+ SoupURI* requestURI = soup_message_get_uri(soupMessage);
+ SoupURI* mainDocumentURI = soup_message_get_first_party(soupMessage);
+ CString requestURIString(descriptionSuitableForTestResult(requestURI));
+ CString mainDocumentURIString(descriptionSuitableForTestResult(mainDocumentURI));
+ CString path(convertNetworkRequestToURLPath(request));
+ GOwnPtr<char> description(g_strdup_printf("<NSURLRequest URL %s, main document URL %s, http method %s>",
+ path.data(), mainDocumentURIString.data(),
+ soupMessage ? soupMessage->method : "(none)"));
+ return CString(description.get());
+}
+
+static CString descriptionSuitableForTestResult(WebKitNetworkResponse* response)
{
+ if (!response)
+ return CString("(null)");
+
+ int statusCode = 0;
+ CString responseURIString(urlSuitableForTestResult(webkit_network_response_get_uri(response)));
+ SoupMessage* soupMessage = webkit_network_response_get_message(response);
+ CString path;
+
+ if (soupMessage) {
+ statusCode = soupMessage->status_code;
+ path = convertSoupMessageToURLPath(soupMessage);
+ } else
+ path = CString("");
+
+ GOwnPtr<char> description(g_strdup_printf("<NSURLResponse %s, http status code %d>", path.data(), statusCode));
+ return CString(description.get());
+}
+
+static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* resource, WebKitNetworkRequest* request, WebKitNetworkResponse* response)
+{
+
+
if (!done && gLayoutTestController->willSendRequestReturnsNull()) {
// As requested by the LayoutTestController, don't perform the request.
webkit_network_request_set_uri(request, "about:blank");
return;
}
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks())
+ printf("%s - willSendRequest %s redirectResponse %s\n",
+ convertNetworkRequestToURLPath(request).data(),
+ descriptionSuitableForTestResult(request).data(),
+ descriptionSuitableForTestResult(response).data());
+
SoupMessage* soupMessage = webkit_network_request_get_message(request);
SoupURI* uri = soup_uri_new(webkit_network_request_get_uri(request));
&& g_strcmp0(uri->host, "255.255.255.255")
&& g_ascii_strncasecmp(uri->host, "localhost", 9)) {
printf("Blocked access to external URL %s\n", soup_uri_to_string(uri, FALSE));
+ // Cancel load of blocked resource to avoid potential
+ // network-related timeouts in tests.
+ webkit_network_request_set_uri(request, "about:blank");
soup_uri_free(uri);
return;
}
+
if (uri)
soup_uri_free(uri);
}
}
+
+static void didReceiveResponse(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource* webResource, WebKitNetworkResponse* response)
+{
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
+ CString responseDescription(descriptionSuitableForTestResult(response));
+ CString path(convertWebResourceToURLPath(webResource));
+ printf("%s - didReceiveResponse %s\n", path.data(), responseDescription.data());
+ }
+
+ // TODO: add "has MIME type" whenever dumpResourceResponseMIMETypes() is supported.
+ // See https://bugs.webkit.org/show_bug.cgi?id=58222.
+}
+
+static void didFinishLoading(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource)
+{
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks())
+ printf("%s - didFinishLoading\n", descriptionSuitableForTestResult(webView, webFrame, webResource).data());
+}
+
+static void didFailLoadingWithError(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource, GError* webError)
+{
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
+ CString webErrorString(descriptionSuitableForTestResult(webError, webResource));
+ printf("%s - didFailLoadingWithError: %s\n", descriptionSuitableForTestResult(webView, webFrame, webResource).data(),
+ webErrorString.data());
+ }
+}
+
static WebKitWebView* createWebView()
{
// It is important to declare DRT is running early so when creating
"signal::drag-failed", dragFailedCallback, 0,
"signal::frame-created", frameCreatedCallback, 0,
"signal::resource-request-starting", willSendRequestCallback, 0,
-
+ "signal::resource-response-received", didReceiveResponse, 0,
+ "signal::resource-load-finished", didFinishLoading, 0,
+ "signal::resource-load-failed", didFailLoadingWithError, 0,
NULL);
connectEditingCallbacks(view);