[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
kov at webkit.org
kov at webkit.org
Wed Dec 22 18:07:37 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b0c9c1d0a51a2ac0143856659d2bccba4f45a220
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 7 21:00:31 2010 +0000
2010-12-07 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
Reviewed by Martin Robinson.
[GTK] clears the subresources prematurely
https://bugs.webkit.org/show_bug.cgi?id=50634
Make adding the main resource explicit, and only clear
subresources when the new load is committed, avoid clearing them
prematurely.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::assignIdentifierToInitialRequest):
(WebKit::FrameLoaderClient::provisionalLoadStarted):
(WebKit::FrameLoaderClient::prepareForDataSourceReplacement):
(WebKit::postCommitFrameViewSetup):
* tests/testwebdatasource.c:
(notify_load_status_lifetime_cb):
(test_webkit_web_data_source_lifetime):
(main):
* webkit/webkitprivate.h:
* webkit/webkitwebview.cpp:
(webkit_web_view_add_main_resource):
(webkit_web_view_add_resource):
(webkit_web_view_clear_resources):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index fe9fa5a..9e8acb5 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,5 +1,31 @@
2010-12-07 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
+ Reviewed by Martin Robinson.
+
+ [GTK] clears the subresources prematurely
+ https://bugs.webkit.org/show_bug.cgi?id=50634
+
+ Make adding the main resource explicit, and only clear
+ subresources when the new load is committed, avoid clearing them
+ prematurely.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::assignIdentifierToInitialRequest):
+ (WebKit::FrameLoaderClient::provisionalLoadStarted):
+ (WebKit::FrameLoaderClient::prepareForDataSourceReplacement):
+ (WebKit::postCommitFrameViewSetup):
+ * tests/testwebdatasource.c:
+ (notify_load_status_lifetime_cb):
+ (test_webkit_web_data_source_lifetime):
+ (main):
+ * webkit/webkitprivate.h:
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_add_main_resource):
+ (webkit_web_view_add_resource):
+ (webkit_web_view_clear_resources):
+
+2010-12-07 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
+
Reviewed by Xan Lopez.
[GTK] testwebdatasource - unreachable test is broken
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 3dbba12..1de37f4 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -333,11 +333,19 @@ void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader,
request.updateFromSoupMessage(message);
}
-void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const ResourceRequest& request)
+void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader* loader, const ResourceRequest& request)
{
GOwnPtr<gchar> identifierString(toString(identifier));
- webkit_web_view_add_resource(getViewFromFrame(m_frame), identifierString.get(),
- WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0)));
+
+ WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0));
+
+ if (loader == loader->frameLoader()->provisionalDocumentLoader()
+ && loader->frameLoader()->isLoadingMainFrame()) {
+ webkit_web_view_add_main_resource(getViewFromFrame(m_frame), identifierString.get(), webResource);
+ return;
+ }
+
+ webkit_web_view_add_resource(getViewFromFrame(m_frame), identifierString.get(), webResource);
}
void FrameLoaderClient::postProgressStartedNotification()
@@ -1029,17 +1037,17 @@ void FrameLoaderClient::finishedLoading(WebCore::DocumentLoader* documentLoader)
void FrameLoaderClient::provisionalLoadStarted()
{
- WebKitWebView* webView = getViewFromFrame(m_frame);
-
- if (m_frame == webkit_web_view_get_main_frame(webView))
- webkit_web_view_clear_resources(webView);
+ notImplemented();
}
void FrameLoaderClient::didFinishLoad() {
notImplemented();
}
-void FrameLoaderClient::prepareForDataSourceReplacement() { notImplemented(); }
+void FrameLoaderClient::prepareForDataSourceReplacement()
+{
+ notImplemented();
+}
void FrameLoaderClient::setTitle(const String& title, const KURL& url)
{
@@ -1279,6 +1287,8 @@ void FrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame)
static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, bool resetValues)
{
WebKitWebView* containingWindow = getViewFromFrame(frame);
+ webkit_web_view_clear_resources(containingWindow);
+
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow);
view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues);
diff --git a/WebKit/gtk/tests/testwebdatasource.c b/WebKit/gtk/tests/testwebdatasource.c
index 4798810..638ff10 100644
--- a/WebKit/gtk/tests/testwebdatasource.c
+++ b/WebKit/gtk/tests/testwebdatasource.c
@@ -139,6 +139,64 @@ static void test_webkit_web_data_source()
g_object_unref(view);
}
+static void notify_load_status_lifetime_cb(WebKitWebView* view, GParamSpec* pspec, GMainLoop* loop)
+{
+ WebKitLoadStatus status = webkit_web_view_get_load_status (view);
+ WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
+ WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame);
+
+ if (status == WEBKIT_LOAD_COMMITTED) {
+ g_assert(webkit_web_data_source_is_loading(dataSource));
+ return;
+ } else if (status != WEBKIT_LOAD_FINISHED)
+ return;
+
+ g_main_loop_quit(loop);
+}
+
+static void test_webkit_web_data_source_lifetime()
+{
+ WebKitWebView* view;
+ GMainLoop* loop;
+
+ view = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ g_object_ref_sink(view);
+ loop = g_main_loop_new(NULL, TRUE);
+ g_signal_connect(view, "notify::load-status", G_CALLBACK(notify_load_status_lifetime_cb), loop);
+ webkit_web_view_load_uri(view, "http://webkit.org");
+
+ waitTimer = g_timeout_add_seconds(defaultTimeout, (GSourceFunc)wait_timer_fired, loop);
+
+ g_main_loop_run(loop);
+
+ WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(webkit_web_view_get_main_frame(view));
+ GList* subResources = webkit_web_data_source_get_subresources(dataSource);
+ gint numberOfResources = g_list_length(subResources);
+ g_list_free(subResources);
+
+ g_assert_cmpint(webkit_web_view_get_load_status(view), ==, WEBKIT_LOAD_FINISHED);
+
+ webkit_web_view_load_uri(view, "http://gnome.org");
+
+ g_assert_cmpint(webkit_web_view_get_load_status(view), ==, WEBKIT_LOAD_PROVISIONAL);
+
+ webkit_web_view_stop_loading(view);
+
+ g_assert_cmpint(webkit_web_view_get_load_status(view), ==, WEBKIT_LOAD_FAILED);
+
+ subResources = webkit_web_data_source_get_subresources(dataSource);
+ g_assert_cmpint(numberOfResources, ==, g_list_length(subResources));
+ g_list_free(subResources);
+
+ if (waitTimer)
+ g_source_remove(waitTimer);
+
+ waitTimer = 0;
+
+ g_main_loop_unref(loop);
+ g_object_unref(view);
+}
+
static void test_webkit_web_data_source_unreachable_uri()
{
/* FIXME: this test fails currently. */
@@ -179,6 +237,9 @@ int main(int argc, char** argv)
test_webkit_web_data_source);
g_test_add_func("/webkit/webdatasource/unreachable_uri",
test_webkit_web_data_source_unreachable_uri);
+ g_test_add_func("/webkit/webdatasource/lifetime",
+ test_webkit_web_data_source_lifetime);
+
return g_test_run ();
}
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index 0b59746..0f8d700 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -281,6 +281,9 @@ extern "C" {
webkit_web_view_add_resource(WebKitWebView*, const char*, WebKitWebResource*);
void
+ webkit_web_view_add_main_resource(WebKitWebView*, const char*, WebKitWebResource*);
+
+ void
webkit_web_view_remove_resource(WebKitWebView*, const char*);
WebKitWebResource*
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 559906a..93a3188 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -4756,16 +4756,17 @@ gboolean webkit_web_view_get_view_source_mode (WebKitWebView* webView)
}
// Internal subresource management
-void webkit_web_view_add_resource(WebKitWebView* webView, const char* identifier, WebKitWebResource* webResource)
+void webkit_web_view_add_main_resource(WebKitWebView* webView, const char* identifier, WebKitWebResource* webResource)
{
WebKitWebViewPrivate* priv = webView->priv;
- if (!priv->mainResource) {
- priv->mainResource = adoptPlatformRef(webResource);
- priv->mainResourceIdentifier = identifier;
- return;
- }
+ priv->mainResource = adoptPlatformRef(webResource);
+ priv->mainResourceIdentifier = identifier;
+}
+void webkit_web_view_add_resource(WebKitWebView* webView, const char* identifier, WebKitWebResource* webResource)
+{
+ WebKitWebViewPrivate* priv = webView->priv;
g_hash_table_insert(priv->subResources.get(), g_strdup(identifier), webResource);
}
@@ -4806,8 +4807,6 @@ WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView* webView)
void webkit_web_view_clear_resources(WebKitWebView* webView)
{
WebKitWebViewPrivate* priv = webView->priv;
- priv->mainResourceIdentifier = "";
- priv->mainResource = 0;
if (priv->subResources)
g_hash_table_remove_all(priv->subResources.get());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list