<!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>[181228] releases/WebKitGTK/webkit-2.8</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/181228">181228</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-08 01:12:54 -0800 (Sun, 08 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/180998">r180998</a> - [GTK] WebView should hold a reference on WebContext because non-default contexts are a reality
https://bugs.webkit.org/show_bug.cgi?id=142225

Patch by Debarshi Ray &lt;debarshir@gnome.org&gt; on 2015-03-04
Reviewed by Carlos Garcia Campos.

Source/WebKit2:

* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewRequestFavicon):
(webkitWebViewWatchForChangesInFavicon):
(webkitWebViewDisconnectFaviconDatabaseSignalHandlers):
(webkitWebViewConstructed):
(webkitWebViewGetProperty):
(webkitWebViewDispose):
(webkitWebViewLoadChanged):
(webkitWebViewLoadFailedWithTLSErrors):
(webkit_web_view_get_context):
(webkit_web_view_download_uri):

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
(testWebViewWebContextLifetime):
(beforeAll):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28ToolsChangeLog">releases/WebKitGTK/webkit-2.8/Tools/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28ToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewcpp">releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit28SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog (181227 => 181228)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog        2015-03-08 09:11:27 UTC (rev 181227)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog        2015-03-08 09:12:54 UTC (rev 181228)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-03-04  Debarshi Ray  &lt;debarshir@gnome.org&gt;
+
+        [GTK] WebView should hold a reference on WebContext because non-default contexts are a reality
+        https://bugs.webkit.org/show_bug.cgi?id=142225
+
+        Reviewed by Carlos Garcia Campos.
+
+        * UIProcess/API/gtk/WebKitWebView.cpp:
+        (webkitWebViewRequestFavicon):
+        (webkitWebViewWatchForChangesInFavicon):
+        (webkitWebViewDisconnectFaviconDatabaseSignalHandlers):
+        (webkitWebViewConstructed):
+        (webkitWebViewGetProperty):
+        (webkitWebViewDispose):
+        (webkitWebViewLoadChanged):
+        (webkitWebViewLoadFailedWithTLSErrors):
+        (webkit_web_view_get_context):
+        (webkit_web_view_download_uri):
+
</ins><span class="cx"> 2015-03-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.7.91 release.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (181227 => 181228)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2015-03-08 09:11:27 UTC (rev 181227)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2015-03-08 09:12:54 UTC (rev 181228)
</span><span class="lines">@@ -170,7 +170,6 @@
</span><span class="cx">             g_main_loop_quit(modalLoop.get());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    WebKitWebContext* context;
</del><span class="cx">     WebKitWebView* relatedView;
</span><span class="cx">     CString title;
</span><span class="cx">     CString customTextEncoding;
</span><span class="lines">@@ -185,6 +184,7 @@
</span><span class="cx">     GRefPtr&lt;WebKitBackForwardList&gt; backForwardList;
</span><span class="cx">     GRefPtr&lt;WebKitSettings&gt; settings;
</span><span class="cx">     GRefPtr&lt;WebKitUserContentManager&gt; userContentManager;
</span><ins>+    GRefPtr&lt;WebKitWebContext&gt; context;
</ins><span class="cx">     GRefPtr&lt;WebKitWindowProperties&gt; windowProperties;
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GMainLoop&gt; modalLoop;
</span><span class="lines">@@ -448,7 +448,7 @@
</span><span class="cx"> 
</span><span class="cx">     WebKitWebViewPrivate* priv = webView-&gt;priv;
</span><span class="cx">     priv-&gt;faviconCancellable = adoptGRef(g_cancellable_new());
</span><del>-    WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv-&gt;context);
</del><ins>+    WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv-&gt;context.get());
</ins><span class="cx">     webkit_favicon_database_get_favicon(database, priv-&gt;activeURI.data(), priv-&gt;faviconCancellable.get(), gotFaviconCallback, webView);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -510,7 +510,7 @@
</span><span class="cx">     if (priv-&gt;faviconChangedHandlerID)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv-&gt;context);
</del><ins>+    WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv-&gt;context.get());
</ins><span class="cx">     priv-&gt;faviconChangedHandlerID = g_signal_connect(database, &quot;favicon-changed&quot;, G_CALLBACK(faviconChangedCallback), webView);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -518,7 +518,7 @@
</span><span class="cx"> {
</span><span class="cx">     WebKitWebViewPrivate* priv = webView-&gt;priv;
</span><span class="cx">     if (priv-&gt;faviconChangedHandlerID)
</span><del>-        g_signal_handler_disconnect(webkit_web_context_get_favicon_database(priv-&gt;context), priv-&gt;faviconChangedHandlerID);
</del><ins>+        g_signal_handler_disconnect(webkit_web_context_get_favicon_database(priv-&gt;context.get()), priv-&gt;faviconChangedHandlerID);
</ins><span class="cx">     priv-&gt;faviconChangedHandlerID = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -639,7 +639,7 @@
</span><span class="cx">     if (!priv-&gt;settings)
</span><span class="cx">         priv-&gt;settings = adoptGRef(webkit_settings_new());
</span><span class="cx"> 
</span><del>-    webkitWebContextCreatePageForWebView(priv-&gt;context, webView, priv-&gt;userContentManager.get(), priv-&gt;relatedView);
</del><ins>+    webkitWebContextCreatePageForWebView(priv-&gt;context.get(), webView, priv-&gt;userContentManager.get(), priv-&gt;relatedView);
</ins><span class="cx"> 
</span><span class="cx">     priv-&gt;loadObserver = std::make_unique&lt;PageLoadStateObserver&gt;(webView);
</span><span class="cx">     getPage(webView)-&gt;pageLoadState().addObserver(*priv-&gt;loadObserver);
</span><span class="lines">@@ -706,7 +706,7 @@
</span><span class="cx"> 
</span><span class="cx">     switch (propId) {
</span><span class="cx">     case PROP_WEB_CONTEXT:
</span><del>-        g_value_set_object(value, webView-&gt;priv-&gt;context);
</del><ins>+        g_value_set_object(value, webView-&gt;priv-&gt;context.get());
</ins><span class="cx">         break;
</span><span class="cx">     case PROP_SETTINGS:
</span><span class="cx">         g_value_set_object(value, webkit_web_view_get_settings(webView));
</span><span class="lines">@@ -756,7 +756,7 @@
</span><span class="cx">         webView-&gt;priv-&gt;loadObserver.reset();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    webkitWebContextWebViewDestroyed(webView-&gt;priv-&gt;context, webView);
</del><ins>+    webkitWebContextWebViewDestroyed(webView-&gt;priv-&gt;context.get(), webView);
</ins><span class="cx"> 
</span><span class="cx">     G_OBJECT_CLASS(webkit_web_view_parent_class)-&gt;dispose(object);
</span><span class="cx"> }
</span><span class="lines">@@ -1811,7 +1811,7 @@
</span><span class="cx">         priv-&gt;mainResource = 0;
</span><span class="cx">         priv-&gt;waitingForMainResource = false;
</span><span class="cx">     } else if (loadEvent == WEBKIT_LOAD_COMMITTED) {
</span><del>-        WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv-&gt;context);
</del><ins>+        WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv-&gt;context.get());
</ins><span class="cx">         GUniquePtr&lt;char&gt; faviconURI(webkit_favicon_database_get_favicon_uri(database, priv-&gt;activeURI.data()));
</span><span class="cx">         webkitWebViewUpdateFaviconURI(webView, faviconURI.get());
</span><span class="cx"> 
</span><span class="lines">@@ -1843,7 +1843,7 @@
</span><span class="cx"> {
</span><span class="cx">     webkitWebViewCancelAuthenticationRequest(webView);
</span><span class="cx"> 
</span><del>-    WebKitTLSErrorsPolicy tlsErrorsPolicy = webkit_web_context_get_tls_errors_policy(webView-&gt;priv-&gt;context);
</del><ins>+    WebKitTLSErrorsPolicy tlsErrorsPolicy = webkit_web_context_get_tls_errors_policy(webView-&gt;priv-&gt;context.get());
</ins><span class="cx">     if (tlsErrorsPolicy == WEBKIT_TLS_ERRORS_POLICY_FAIL) {
</span><span class="cx">         gboolean returnValue;
</span><span class="cx">         g_signal_emit(webView, signals[LOAD_FAILED_WITH_TLS_ERRORS], 0, failingURI, certificate, tlsErrors, &amp;returnValue);
</span><span class="lines">@@ -2247,7 +2247,7 @@
</span><span class="cx"> {
</span><span class="cx">     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
</span><span class="cx"> 
</span><del>-    return webView-&gt;priv-&gt;context;
</del><ins>+    return webView-&gt;priv-&gt;context.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -3381,7 +3381,7 @@
</span><span class="cx">     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
</span><span class="cx">     g_return_val_if_fail(uri, 0);
</span><span class="cx"> 
</span><del>-    WebKitDownload* download = webkitWebContextStartDownload(webView-&gt;priv-&gt;context, uri, getPage(webView));
</del><ins>+    WebKitDownload* download = webkitWebContextStartDownload(webView-&gt;priv-&gt;context.get(), uri, getPage(webView));
</ins><span class="cx">     webkitDownloadSetWebView(download, webView);
</span><span class="cx"> 
</span><span class="cx">     return download;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28ToolsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Tools/ChangeLog (181227 => 181228)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Tools/ChangeLog        2015-03-08 09:11:27 UTC (rev 181227)
+++ releases/WebKitGTK/webkit-2.8/Tools/ChangeLog        2015-03-08 09:12:54 UTC (rev 181228)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-03-04  Debarshi Ray  &lt;debarshir@gnome.org&gt;
+
+        [GTK] WebView should hold a reference on WebContext because non-default contexts are a reality
+        https://bugs.webkit.org/show_bug.cgi?id=142225
+
+        Reviewed by Carlos Garcia Campos.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
+        (testWebViewWebContextLifetime):
+        (beforeAll):
+
</ins><span class="cx"> 2015-03-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [SOUP] Synchronous XMLHttpRequests can time out when we reach the max connections limit
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28ToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp (181227 => 181228)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2015-03-08 09:11:27 UTC (rev 181227)
+++ releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2015-03-08 09:12:54 UTC (rev 181228)
</span><span class="lines">@@ -64,6 +64,36 @@
</span><span class="cx">     g_assert(webkit_web_view_get_context(webView.get()) == test-&gt;m_webContext.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void testWebViewWebContextLifetime(WebViewTest* test, gconstpointer)
+{
+    WebKitWebContext* webContext = webkit_web_context_new();
+    test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(webContext));
+
+    GtkWidget* webView = webkit_web_view_new_with_context(webContext);
+    test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(webView));
+
+    g_object_ref_sink(webView);
+    g_object_unref(webContext);
+
+    // Check that the web view still has a valid context.
+    WebKitWebContext* tmpContext = webkit_web_view_get_context(WEBKIT_WEB_VIEW(webView));
+    g_assert_true(WEBKIT_IS_WEB_CONTEXT(tmpContext));
+    g_object_unref(webView);
+
+    WebKitWebContext* webContext2 = webkit_web_context_new();
+    test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(webContext2));
+
+    GtkWidget* webView2 = webkit_web_view_new_with_context(webContext2);
+    test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(webView2));
+
+    g_object_ref_sink(webView2);
+    g_object_unref(webView2);
+
+    // Check that the context is still valid.
+    g_assert_true(WEBKIT_IS_WEB_CONTEXT(webContext2));
+    g_object_unref(webContext2);
+}
+
</ins><span class="cx"> static void testWebViewCustomCharset(WebViewTest* test, gconstpointer)
</span><span class="cx"> {
</span><span class="cx">     g_assert(!webkit_web_view_get_custom_charset(test-&gt;m_webView));
</span><span class="lines">@@ -809,6 +839,7 @@
</span><span class="cx">     gServer-&gt;run(serverCallback);
</span><span class="cx"> 
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;web-context&quot;, testWebViewWebContext);
</span><ins>+    WebViewTest::add(&quot;WebKitWebView&quot;, &quot;web-context-lifetime&quot;, testWebViewWebContextLifetime);
</ins><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;custom-charset&quot;, testWebViewCustomCharset);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;settings&quot;, testWebViewSettings);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;zoom-level&quot;, testWebViewZoomLevel);
</span></span></pre>
</div>
</div>

</body>
</html>