<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174565] releases/WebKitGTK/webkit-2.6</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174565">174565</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-10 01:03:29 -0700 (Fri, 10 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/174497">r174497</a> - Race condition with WebKitWebView:is-loading after starting page load
https://bugs.webkit.org/show_bug.cgi?id=136692
Reviewed by Gustavo Noronha Silva.
Source/WebKit2:
Use PageLoadState::Observer to update both is-loading and uri
properties, instead of manually update them. This ensures that our
web view is always in sync with the WebPageProxy so that
webkit_web_view_is_loading() returns true right after requesting
any load. We still need to manually set the is-loading property
only in the case where we delay the emission of the load-changed
signals when waiting for the main resource. The bahaviour is a bit
different but still consistent with what our API documentation says.
* UIProcess/API/gtk/WebKitLoaderClient.cpp:
(attachLoaderClientToView): Remove
didSameDocumentNavigationForFrame implementation, since we are
already notified about the URL change by the PageLoadState::Observer.
(didSameDocumentNavigationForFrame): Deleted.
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewSetIsLoading): No longer update the URI when
changing the is-loading property.
(webkitWebViewConstructed): Crate a PageLoadStateObserver and add
it to the PageLoadState.
(webkitWebViewDispose): Remove the PageLoadStateObserver from the PageLoadState.
(webkitWebViewEmitLoadChanged): Add isDelayedEvent parameter to
update the is-loading property accordingly when emitting the
delayed events.
(webkitWebViewEmitDelayedLoadEvents): Pass true as isDelayedEvent
parameter of webkitWebViewEmitLoadChanged().
(webkitWebViewLoadChanged): Pass false as isDelayedEvent parameter
of webkitWebViewEmitLoadChanged().
(webkitWebViewLoadFailed):
(webkitWebViewLoadFailedWithTLSErrors):
(webkitWebViewUpdateURI): Deleted.
* UIProcess/API/gtk/WebKitWebViewPrivate.h:
Tools:
* TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp:
(loadChangedCallback): Only check is-loading is false when load
has finished if the load didn't fail due to a cancellation.
(loadFailedCallback): Only check is-loading is false if the load
didn't fail due to a cancellation.
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
(WebViewTest::loadURI): Check is-loading is true and active URI is
the requested one rigth after requesting the load.
(WebViewTest::loadHtml): Ditto.
(WebViewTest::loadPlainText): Ditto.
(WebViewTest::loadBytes): Ditto.
(WebViewTest::loadRequest): Ditto.
(WebViewTest::loadAlternateHTML): Ditto.
(WebViewTest::goBack): Ditto.
(WebViewTest::goForward): Ditto.
(WebViewTest::goToBackForwardListItem): Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitLoaderClientcpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26ToolsChangeLog">releases/WebKitGTK/webkit-2.6/Tools/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26ToolsTestWebKitAPIgtkWebKit2GtkLoadTrackingTestcpp">releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26ToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp">releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit26SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog (174564 => 174565)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog        2014-10-10 08:01:33 UTC (rev 174564)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog        2014-10-10 08:03:29 UTC (rev 174565)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-10-08 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Race condition with WebKitWebView:is-loading after starting page load
+ https://bugs.webkit.org/show_bug.cgi?id=136692
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Use PageLoadState::Observer to update both is-loading and uri
+ properties, instead of manually update them. This ensures that our
+ web view is always in sync with the WebPageProxy so that
+ webkit_web_view_is_loading() returns true right after requesting
+ any load. We still need to manually set the is-loading property
+ only in the case where we delay the emission of the load-changed
+ signals when waiting for the main resource. The bahaviour is a bit
+ different but still consistent with what our API documentation says.
+
+ * UIProcess/API/gtk/WebKitLoaderClient.cpp:
+ (attachLoaderClientToView): Remove
+ didSameDocumentNavigationForFrame implementation, since we are
+ already notified about the URL change by the PageLoadState::Observer.
+ (didSameDocumentNavigationForFrame): Deleted.
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewSetIsLoading): No longer update the URI when
+ changing the is-loading property.
+ (webkitWebViewConstructed): Crate a PageLoadStateObserver and add
+ it to the PageLoadState.
+ (webkitWebViewDispose): Remove the PageLoadStateObserver from the PageLoadState.
+ (webkitWebViewEmitLoadChanged): Add isDelayedEvent parameter to
+ update the is-loading property accordingly when emitting the
+ delayed events.
+ (webkitWebViewEmitDelayedLoadEvents): Pass true as isDelayedEvent
+ parameter of webkitWebViewEmitLoadChanged().
+ (webkitWebViewLoadChanged): Pass false as isDelayedEvent parameter
+ of webkitWebViewEmitLoadChanged().
+ (webkitWebViewLoadFailed):
+ (webkitWebViewLoadFailedWithTLSErrors):
+ (webkitWebViewUpdateURI): Deleted.
+ * UIProcess/API/gtk/WebKitWebViewPrivate.h:
+
</ins><span class="cx"> 2014-10-09 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [X11] Plugin process crashes in NetscapePlugin::platformPostInitialize()
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp (174564 => 174565)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp        2014-10-10 08:01:33 UTC (rev 174564)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp        2014-10-10 08:03:29 UTC (rev 174565)
</span><span class="lines">@@ -91,14 +91,6 @@
</span><span class="cx"> resourceError.failingURL().utf8().data(), webError.get());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo)
-{
- if (!WKFrameIsMainFrame(frame))
- return;
-
- webkitWebViewUpdateURI(WEBKIT_WEB_VIEW(clientInfo));
-}
-
</del><span class="cx"> static void didReceiveTitleForFrame(WKPageRef, WKStringRef titleRef, WKFrameRef frameRef, WKTypeRef, const void* clientInfo)
</span><span class="cx"> {
</span><span class="cx"> if (!WKFrameIsMainFrame(frameRef))
</span><span class="lines">@@ -151,7 +143,7 @@
</span><span class="cx"> 0, // didFinishDocumentLoadForFrame
</span><span class="cx"> didFinishLoadForFrame,
</span><span class="cx"> didFailLoadWithErrorForFrame,
</span><del>- didSameDocumentNavigationForFrame,
</del><ins>+ 0, // didSameDocumentNavigationForFrame
</ins><span class="cx"> didReceiveTitleForFrame,
</span><span class="cx"> 0, // didFirstLayoutForFrame
</span><span class="cx"> 0, // didFirstVisuallyNonEmptyLayoutForFrame
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (174564 => 174565)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-10-10 08:01:33 UTC (rev 174564)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-10-10 08:03:29 UTC (rev 174565)
</span><span class="lines">@@ -143,6 +143,7 @@
</span><span class="cx">
</span><span class="cx"> typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap;
</span><span class="cx"> typedef HashMap<uint64_t, GRefPtr<GTask> > SnapshotResultsMap;
</span><ins>+class PageLoadStateObserver;
</ins><span class="cx">
</span><span class="cx"> struct _WebKitWebViewPrivate {
</span><span class="cx"> ~_WebKitWebViewPrivate()
</span><span class="lines">@@ -163,6 +164,7 @@
</span><span class="cx"> CString activeURI;
</span><span class="cx"> bool isLoading;
</span><span class="cx">
</span><ins>+ std::unique_ptr<PageLoadStateObserver> loadObserver;
</ins><span class="cx"> bool waitingForMainResource;
</span><span class="cx"> unsigned long mainResourceResponseHandlerID;
</span><span class="cx"> WebKitLoadEvent lastDelayedEvent;
</span><span class="lines">@@ -203,6 +205,66 @@
</span><span class="cx"> return webkitWebViewBaseGetPage(reinterpret_cast<WebKitWebViewBase*>(webView));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void webkitWebViewSetIsLoading(WebKitWebView* webView, bool isLoading)
+{
+ if (webView->priv->isLoading == isLoading)
+ return;
+
+ webView->priv->isLoading = isLoading;
+ g_object_notify(G_OBJECT(webView), "is-loading");
+}
+
+class PageLoadStateObserver final : public PageLoadState::Observer {
+public:
+ PageLoadStateObserver(WebKitWebView* webView)
+ : m_webView(webView)
+ {
+ }
+
+private:
+ virtual void willChangeIsLoading() override
+ {
+ g_object_freeze_notify(G_OBJECT(m_webView));
+ }
+ virtual void didChangeIsLoading() override
+ {
+ if (m_webView->priv->waitingForMainResource) {
+ // The actual load has finished but we haven't emitted the delayed load events yet, so we are still loading.
+ g_object_thaw_notify(G_OBJECT(m_webView));
+ return;
+ }
+ webkitWebViewSetIsLoading(m_webView, getPage(m_webView)->pageLoadState().isLoading());
+ g_object_thaw_notify(G_OBJECT(m_webView));
+ }
+
+ virtual void willChangeTitle() override { }
+ virtual void didChangeTitle() override { }
+
+ virtual void willChangeActiveURL() override
+ {
+ g_object_freeze_notify(G_OBJECT(m_webView));
+ }
+ virtual void didChangeActiveURL() override
+ {
+ m_webView->priv->activeURI = getPage(m_webView)->pageLoadState().activeURL().utf8();
+ g_object_notify(G_OBJECT(m_webView), "uri");
+ g_object_thaw_notify(G_OBJECT(m_webView));
+ }
+
+ virtual void willChangeHasOnlySecureContent() override { }
+ virtual void didChangeHasOnlySecureContent() override { }
+ virtual void willChangeEstimatedProgress() override { }
+ virtual void didChangeEstimatedProgress() override { }
+ virtual void willChangeCanGoBack() override { }
+ virtual void didChangeCanGoBack() override { }
+ virtual void willChangeCanGoForward() override { }
+ virtual void didChangeCanGoForward() override { }
+ virtual void willChangeNetworkRequestsInProgress() override { }
+ virtual void didChangeNetworkRequestsInProgress() override { }
+
+ WebKitWebView* m_webView;
+};
+
</ins><span class="cx"> static gboolean webkitWebViewLoadFail(WebKitWebView* webView, WebKitLoadEvent, const char* failingURI, GError* error)
</span><span class="cx"> {
</span><span class="cx"> if (g_error_matches(error, WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)
</span><span class="lines">@@ -493,6 +555,10 @@
</span><span class="cx"> if (!priv->settings)
</span><span class="cx"> priv->settings = adoptGRef(webkit_settings_new());
</span><span class="cx"> webkitWebContextCreatePageForWebView(priv->context, webView, priv->userContentManager.get(), priv->relatedView);
</span><ins>+
+ priv->loadObserver = std::make_unique<PageLoadStateObserver>(webView);
+ getPage(webView)->pageLoadState().addObserver(*priv->loadObserver);
+
</ins><span class="cx"> // The related view is only valid during the construction.
</span><span class="cx"> priv->relatedView = nullptr;
</span><span class="cx">
</span><span class="lines">@@ -591,6 +657,11 @@
</span><span class="cx"> webkitWebViewDisconnectSettingsSignalHandlers(webView);
</span><span class="cx"> webkitWebViewDisconnectFaviconDatabaseSignalHandlers(webView);
</span><span class="cx">
</span><ins>+ if (webView->priv->loadObserver) {
+ getPage(webView)->pageLoadState().removeObserver(*webView->priv->loadObserver);
+ webView->priv->loadObserver.reset();
+ }
+
</ins><span class="cx"> webkitWebContextWebViewDestroyed(webView->priv->context, webView);
</span><span class="cx">
</span><span class="cx"> G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object);
</span><span class="lines">@@ -1484,21 +1555,6 @@
</span><span class="cx"> WEBKIT_TYPE_AUTHENTICATION_REQUEST);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void webkitWebViewSetIsLoading(WebKitWebView* webView, bool isLoading)
-{
- if (webView->priv->isLoading == isLoading)
- return;
-
- webView->priv->isLoading = isLoading;
- g_object_freeze_notify(G_OBJECT(webView));
- g_object_notify(G_OBJECT(webView), "is-loading");
-
- // Update the URI if a new load has started.
- if (webView->priv->isLoading)
- webkitWebViewUpdateURI(webView);
- g_object_thaw_notify(G_OBJECT(webView));
-}
-
</del><span class="cx"> static void webkitWebViewCancelAuthenticationRequest(WebKitWebView* webView)
</span><span class="cx"> {
</span><span class="cx"> if (!webView->priv->authenticationRequest)
</span><span class="lines">@@ -1508,19 +1564,30 @@
</span><span class="cx"> webView->priv->authenticationRequest.clear();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
</del><ins>+static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, bool isDelayedEvent)
</ins><span class="cx"> {
</span><span class="cx"> if (loadEvent == WEBKIT_LOAD_STARTED) {
</span><del>- webkitWebViewSetIsLoading(webView, true);
</del><span class="cx"> webkitWebViewWatchForChangesInFavicon(webView);
</span><span class="cx"> webkitWebViewCancelAuthenticationRequest(webView);
</span><span class="cx"> } else if (loadEvent == WEBKIT_LOAD_FINISHED) {
</span><del>- webkitWebViewSetIsLoading(webView, false);
</del><ins>+ if (isDelayedEvent) {
+ // In case of the delayed event, we need to manually set is-loading to false.
+ webkitWebViewSetIsLoading(webView, false);
+ }
</ins><span class="cx"> webkitWebViewCancelAuthenticationRequest(webView);
</span><span class="cx"> webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView);
</span><del>- } else
- webkitWebViewUpdateURI(webView);
</del><ins>+ }
+
</ins><span class="cx"> g_signal_emit(webView, signals[LOAD_CHANGED], 0, loadEvent);
</span><ins>+
+ if (isDelayedEvent) {
+ if (loadEvent == WEBKIT_LOAD_COMMITTED)
+ webView->priv->waitingForMainResource = false;
+ else if (loadEvent == WEBKIT_LOAD_FINISHED) {
+ // Manually set is-loading again in case a new load was started.
+ webkitWebViewSetIsLoading(webView, getPage(webView)->pageLoadState().isLoading());
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void webkitWebViewEmitDelayedLoadEvents(WebKitWebView* webView)
</span><span class="lines">@@ -1531,9 +1598,8 @@
</span><span class="cx"> ASSERT(priv->lastDelayedEvent == WEBKIT_LOAD_COMMITTED || priv->lastDelayedEvent == WEBKIT_LOAD_FINISHED);
</span><span class="cx">
</span><span class="cx"> if (priv->lastDelayedEvent == WEBKIT_LOAD_FINISHED)
</span><del>- webkitWebViewEmitLoadChanged(webView, WEBKIT_LOAD_COMMITTED);
- webkitWebViewEmitLoadChanged(webView, priv->lastDelayedEvent);
- priv->waitingForMainResource = false;
</del><ins>+ webkitWebViewEmitLoadChanged(webView, WEBKIT_LOAD_COMMITTED, true);
+ webkitWebViewEmitLoadChanged(webView, priv->lastDelayedEvent, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
</span><span class="lines">@@ -1564,12 +1630,11 @@
</span><span class="cx"> if (priv->waitingForMainResource)
</span><span class="cx"> priv->lastDelayedEvent = loadEvent;
</span><span class="cx"> else
</span><del>- webkitWebViewEmitLoadChanged(webView, loadEvent);
</del><ins>+ webkitWebViewEmitLoadChanged(webView, loadEvent, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void webkitWebViewLoadFailed(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError *error)
</span><span class="cx"> {
</span><del>- webkitWebViewSetIsLoading(webView, false);
</del><span class="cx"> webkitWebViewCancelAuthenticationRequest(webView);
</span><span class="cx">
</span><span class="cx"> gboolean returnValue;
</span><span class="lines">@@ -1579,7 +1644,6 @@
</span><span class="cx">
</span><span class="cx"> void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView* webView, const char* failingURI, GError* error, GTlsCertificateFlags tlsErrors, GTlsCertificate* certificate)
</span><span class="cx"> {
</span><del>- webkitWebViewSetIsLoading(webView, false);
</del><span class="cx"> webkitWebViewCancelAuthenticationRequest(webView);
</span><span class="cx">
</span><span class="cx"> WebKitTLSErrorsPolicy tlsErrorsPolicy = webkit_web_context_get_tls_errors_policy(webView->priv->context);
</span><span class="lines">@@ -1612,16 +1676,6 @@
</span><span class="cx"> g_object_notify(G_OBJECT(webView), "estimated-load-progress");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void webkitWebViewUpdateURI(WebKitWebView* webView)
-{
- CString activeURI = getPage(webView)->pageLoadState().activeURL().utf8();
- if (webView->priv->activeURI == activeURI)
- return;
-
- webView->priv->activeURI = activeURI;
- g_object_notify(G_OBJECT(webView), "uri");
-}
-
</del><span class="cx"> WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView* webView, const WindowFeatures& windowFeatures, WebKitNavigationAction* navigationAction)
</span><span class="cx"> {
</span><span class="cx"> WebKitWebView* newWebView;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h (174564 => 174565)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-10-10 08:01:33 UTC (rev 174564)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-10-10 08:03:29 UTC (rev 174565)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView*, const char* failingURI, GError*, GTlsCertificateFlags, GTlsCertificate*);
</span><span class="cx"> void webkitWebViewSetEstimatedLoadProgress(WebKitWebView*, double estimatedLoadProgress);
</span><span class="cx"> void webkitWebViewSetTitle(WebKitWebView*, const CString&);
</span><del>-void webkitWebViewUpdateURI(WebKitWebView*);
</del><span class="cx"> WebKit::WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView*, const WebCore::WindowFeatures&, WebKitNavigationAction*);
</span><span class="cx"> void webkitWebViewReadyToShowPage(WebKitWebView*);
</span><span class="cx"> void webkitWebViewRunAsModal(WebKitWebView*);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26ToolsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Tools/ChangeLog (174564 => 174565)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Tools/ChangeLog        2014-10-10 08:01:33 UTC (rev 174564)
+++ releases/WebKitGTK/webkit-2.6/Tools/ChangeLog        2014-10-10 08:03:29 UTC (rev 174565)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-10-08 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Race condition with WebKitWebView:is-loading after starting page load
+ https://bugs.webkit.org/show_bug.cgi?id=136692
+
+ Reviewed by Gustavo Noronha Silva.
+
+ * TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp:
+ (loadChangedCallback): Only check is-loading is false when load
+ has finished if the load didn't fail due to a cancellation.
+ (loadFailedCallback): Only check is-loading is false if the load
+ didn't fail due to a cancellation.
+ * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
+ (WebViewTest::loadURI): Check is-loading is true and active URI is
+ the requested one rigth after requesting the load.
+ (WebViewTest::loadHtml): Ditto.
+ (WebViewTest::loadPlainText): Ditto.
+ (WebViewTest::loadBytes): Ditto.
+ (WebViewTest::loadRequest): Ditto.
+ (WebViewTest::loadAlternateHTML): Ditto.
+ (WebViewTest::goBack): Ditto.
+ (WebViewTest::goForward): Ditto.
+ (WebViewTest::goToBackForwardListItem): Ditto.
+
</ins><span class="cx"> 2014-09-23 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> [Tools] git-commit uses wrong ChangeLog when run from a subdirectory
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26ToolsTestWebKitAPIgtkWebKit2GtkLoadTrackingTestcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp (174564 => 174565)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp        2014-10-10 08:01:33 UTC (rev 174564)
+++ releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp        2014-10-10 08:03:29 UTC (rev 174565)
</span><span class="lines">@@ -50,9 +50,15 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case WEBKIT_LOAD_FINISHED:
</span><del>- g_assert(!webkit_web_view_is_loading(webView));
- if (!test->m_loadFailed)
</del><ins>+ if (!test->m_loadFailed) {
+ g_assert(!webkit_web_view_is_loading(webView));
</ins><span class="cx"> g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
</span><ins>+ } else if (!g_error_matches(test->m_error.get(), WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)) {
+ // When a new load is started before the previous one has finished, we receive the load-finished signal
+ // of the ongoing load while we already have a provisional URL for the new load. This is the only case
+ // where isloading is true when the load has finished.
+ g_assert(!webkit_web_view_is_loading(webView));
+ }
</ins><span class="cx"> test->loadFinished();
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="lines">@@ -63,19 +69,24 @@
</span><span class="cx"> static void loadFailedCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError* error, LoadTrackingTest* test)
</span><span class="cx"> {
</span><span class="cx"> test->m_loadFailed = true;
</span><ins>+
+ g_assert(error);
</ins><span class="cx"> test->m_error.reset(g_error_copy(error));
</span><span class="cx">
</span><ins>+ if (!g_error_matches(error, WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)) {
+ // When a new load is started before the previous one has finished, we receive the load-failed signal
+ // of the ongoing load while we already have a provisional URL for the new load. This is the only case
+ // where is-loading is true when the load has failed.
+ g_assert(!webkit_web_view_is_loading(webView));
+ }
+
</ins><span class="cx"> switch (loadEvent) {
</span><span class="cx"> case WEBKIT_LOAD_STARTED:
</span><del>- g_assert(!webkit_web_view_is_loading(webView));
</del><span class="cx"> g_assert_cmpstr(test->m_activeURI.data(), ==, failingURI);
</span><del>- g_assert(error);
</del><span class="cx"> test->provisionalLoadFailed(failingURI, error);
</span><span class="cx"> break;
</span><span class="cx"> case WEBKIT_LOAD_COMMITTED:
</span><del>- g_assert(!webkit_web_view_is_loading(webView));
</del><span class="cx"> g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
</span><del>- g_assert(error);
</del><span class="cx"> test->loadFailed(failingURI, error);
</span><span class="cx"> break;
</span><span class="cx"> default:
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26ToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp (174564 => 174565)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2014-10-10 08:01:33 UTC (rev 174564)
+++ releases/WebKitGTK/webkit-2.6/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2014-10-10 08:03:29 UTC (rev 174565)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx"> {
</span><span class="cx"> m_activeURI = uri;
</span><span class="cx"> webkit_web_view_load_uri(m_webView, uri);
</span><ins>+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::loadHtml(const char* html, const char* baseURI)
</span><span class="lines">@@ -63,12 +65,20 @@
</span><span class="cx"> else
</span><span class="cx"> m_activeURI = baseURI;
</span><span class="cx"> webkit_web_view_load_html(m_webView, html, baseURI);
</span><ins>+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::loadPlainText(const char* plainText)
</span><span class="cx"> {
</span><span class="cx"> m_activeURI = "about:blank";
</span><span class="cx"> webkit_web_view_load_plain_text(m_webView, plainText);
</span><ins>+#if 0
+ // FIXME: Pending API request URL no set when loading plain text.
+ // See https://bugs.webkit.org/show_bug.cgi?id=136916.
+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::loadBytes(GBytes* bytes, const char* mimeType, const char* encoding, const char* baseURI)
</span><span class="lines">@@ -78,23 +88,38 @@
</span><span class="cx"> else
</span><span class="cx"> m_activeURI = baseURI;
</span><span class="cx"> webkit_web_view_load_bytes(m_webView, bytes, mimeType, encoding, baseURI);
</span><ins>+#if 0
+ // FIXME: Pending API request URL no set when loading data.
+ // See https://bugs.webkit.org/show_bug.cgi?id=136916.
+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::loadRequest(WebKitURIRequest* request)
</span><span class="cx"> {
</span><span class="cx"> m_activeURI = webkit_uri_request_get_uri(request);
</span><span class="cx"> webkit_web_view_load_request(m_webView, request);
</span><ins>+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::loadAlternateHTML(const char* html, const char* contentURI, const char* baseURI)
</span><span class="cx"> {
</span><span class="cx"> m_activeURI = contentURI;
</span><span class="cx"> webkit_web_view_load_alternate_html(m_webView, html, contentURI, baseURI);
</span><ins>+#if 0
+ // FIXME: Pending API request URL no set when loading Alternate HTML.
+ // See https://bugs.webkit.org/show_bug.cgi?id=136916.
+ g_assert(webkit_web_view_is_loading(m_webView));
+#endif
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::goBack()
</span><span class="cx"> {
</span><del>- if (webkit_web_view_can_go_back(m_webView)) {
</del><ins>+ bool canGoBack = webkit_web_view_can_go_back(m_webView);
+ if (canGoBack) {
</ins><span class="cx"> WebKitBackForwardList* list = webkit_web_view_get_back_forward_list(m_webView);
</span><span class="cx"> WebKitBackForwardListItem* item = webkit_back_forward_list_get_nth_item(list, -1);
</span><span class="cx"> m_activeURI = webkit_back_forward_list_item_get_original_uri(item);
</span><span class="lines">@@ -102,11 +127,16 @@
</span><span class="cx">
</span><span class="cx"> // Call go_back even when can_go_back returns FALSE to check nothing happens.
</span><span class="cx"> webkit_web_view_go_back(m_webView);
</span><ins>+ if (canGoBack) {
+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::goForward()
</span><span class="cx"> {
</span><del>- if (webkit_web_view_can_go_forward(m_webView)) {
</del><ins>+ bool canGoForward = webkit_web_view_can_go_forward(m_webView);
+ if (canGoForward) {
</ins><span class="cx"> WebKitBackForwardList* list = webkit_web_view_get_back_forward_list(m_webView);
</span><span class="cx"> WebKitBackForwardListItem* item = webkit_back_forward_list_get_nth_item(list, 1);
</span><span class="cx"> m_activeURI = webkit_back_forward_list_item_get_original_uri(item);
</span><span class="lines">@@ -114,12 +144,18 @@
</span><span class="cx">
</span><span class="cx"> // Call go_forward even when can_go_forward returns FALSE to check nothing happens.
</span><span class="cx"> webkit_web_view_go_forward(m_webView);
</span><ins>+ if (canGoForward) {
+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::goToBackForwardListItem(WebKitBackForwardListItem* item)
</span><span class="cx"> {
</span><span class="cx"> m_activeURI = webkit_back_forward_list_item_get_original_uri(item);
</span><span class="cx"> webkit_web_view_go_to_back_forward_list_item(m_webView, item);
</span><ins>+ g_assert(webkit_web_view_is_loading(m_webView));
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewTest::quitMainLoop()
</span></span></pre>
</div>
</div>
</body>
</html>