<!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>[163781] trunk</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/163781">163781</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-10 05:46:59 -0800 (Mon, 10 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Add API to create a webview related to another one
https://bugs.webkit.org/show_bug.cgi?id=128498

Reviewed by Gustavo Noronha Silva.

Source/WebKit2:

Add webkit_web_view_new_with_related_view() to create a new
WebView sharing the same web process as the given one.

* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextCreatePageForWebView): Use the given related
WebView to pass a related WebPageProxy to webkitWebViewBaseCreateWebPage().
* UIProcess/API/gtk/WebKitWebContextPrivate.h:
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewConstructed): Pass the related web view to webkitWebContextCreatePageForWebView().
(webkitWebViewSetProperty):
(webkit_web_view_class_init): Add related-view construct-only property.
(webkit_web_view_new_with_related_view): New public method to
create a web view with a related one.
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseCreate): Pass nullptr as related page to webkitWebViewBaseCreateWebPage().
(webkitWebViewBaseCreateWebPage): Use the given related
WebPageProxy to initialize the web page configuration.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.

Tools:

* MiniBrowser/gtk/BrowserWindow.c:
(webViewCreate): Use webkit_web_view_new_with_related_view() when
creating a new web view for window.open().
* TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp:
(testMultiprocessWebViewCreateReadyClose): Add test case to check
that window.open() works when creating the new WebView related to
the existing one, and that no new web process is spawned when
using webkit_web_view_new_with_related_view().
(beforeAll):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasePrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsergtkBrowserWindowc">trunk/Tools/MiniBrowser/gtk/BrowserWindow.c</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestMultiprocesscpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-02-10  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Add API to create a webview related to another one
+        https://bugs.webkit.org/show_bug.cgi?id=128498
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Add webkit_web_view_new_with_related_view() to create a new
+        WebView sharing the same web process as the given one.
+
+        * UIProcess/API/gtk/WebKitWebContext.cpp:
+        (webkitWebContextCreatePageForWebView): Use the given related
+        WebView to pass a related WebPageProxy to webkitWebViewBaseCreateWebPage().
+        * UIProcess/API/gtk/WebKitWebContextPrivate.h:
+        * UIProcess/API/gtk/WebKitWebView.cpp:
+        (webkitWebViewConstructed): Pass the related web view to webkitWebContextCreatePageForWebView().
+        (webkitWebViewSetProperty):
+        (webkit_web_view_class_init): Add related-view construct-only property.
+        (webkit_web_view_new_with_related_view): New public method to
+        create a web view with a related one.
+        * UIProcess/API/gtk/WebKitWebView.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseCreate): Pass nullptr as related page to webkitWebViewBaseCreateWebPage().
+        (webkitWebViewBaseCreateWebPage): Use the given related
+        WebPageProxy to initialize the web page configuration.
+        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
+        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.
+
</ins><span class="cx"> 2014-02-10  Lukasz Bialek  &lt;l.bialek@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Spelling unit tests should use ecore_main_loop_iterate()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -1038,11 +1038,12 @@
</span><span class="cx">     context-&gt;priv-&gt;uriSchemeRequests.remove(customProtocolID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebView* webView, WebKitWebViewGroup* webViewGroup)
</del><ins>+void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebView* webView, WebKitWebViewGroup* webViewGroup, WebKitWebView* relatedView)
</ins><span class="cx"> {
</span><span class="cx">     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView);
</span><span class="cx">     WebPageGroup* pageGroup = webViewGroup ? webkitWebViewGroupGetPageGroup(webViewGroup) : 0;
</span><del>-    webkitWebViewBaseCreateWebPage(webViewBase, context-&gt;priv-&gt;context.get(), pageGroup);
</del><ins>+    WebPageProxy* relatedPage = relatedView ? webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(relatedView)) : nullptr;
+    webkitWebViewBaseCreateWebPage(webViewBase, context-&gt;priv-&gt;context.get(), pageGroup, relatedPage);
</ins><span class="cx"> 
</span><span class="cx">     WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase);
</span><span class="cx">     context-&gt;priv-&gt;webViews.set(page-&gt;pageID(), webView);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID, API::URLRequest*);
</span><span class="cx"> void webkitWebContextStopLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
</span><span class="cx"> void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
</span><del>-void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitWebViewGroup*);
</del><ins>+void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitWebViewGroup*, WebKitWebView*);
</ins><span class="cx"> void webkitWebContextWebViewDestroyed(WebKitWebContext*, WebKitWebView*);
</span><span class="cx"> WebKitWebView* webkitWebContextGetWebViewForPage(WebKitWebContext*, WebKit::WebPageProxy*);
</span><span class="cx"> WebKitWebViewGroup* webkitWebContextGetDefaultWebViewGroup(WebKitWebContext*);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -132,6 +132,7 @@
</span><span class="cx">     PROP_0,
</span><span class="cx"> 
</span><span class="cx">     PROP_WEB_CONTEXT,
</span><ins>+    PROP_RELATED_VIEW,
</ins><span class="cx">     PROP_GROUP,
</span><span class="cx">     PROP_TITLE,
</span><span class="cx">     PROP_ESTIMATED_LOAD_PROGRESS,
</span><span class="lines">@@ -157,6 +158,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     WebKitWebContext* context;
</span><ins>+    WebKitWebView* relatedView;
</ins><span class="cx">     CString title;
</span><span class="cx">     CString customTextEncoding;
</span><span class="cx">     double estimatedLoadProgress;
</span><span class="lines">@@ -502,7 +504,9 @@
</span><span class="cx"> 
</span><span class="cx">     WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
</span><span class="cx">     WebKitWebViewPrivate* priv = webView-&gt;priv;
</span><del>-    webkitWebContextCreatePageForWebView(priv-&gt;context, webView, priv-&gt;group.get());
</del><ins>+    webkitWebContextCreatePageForWebView(priv-&gt;context, webView, priv-&gt;group.get(), priv-&gt;relatedView);
+    // The related view is only valid during the construction.
+    priv-&gt;relatedView = nullptr;
</ins><span class="cx"> 
</span><span class="cx">     webkitWebViewBaseSetDownloadRequestHandler(WEBKIT_WEB_VIEW_BASE(webView), webkitWebViewHandleDownloadRequest);
</span><span class="cx"> 
</span><span class="lines">@@ -531,6 +535,11 @@
</span><span class="cx">         webView-&gt;priv-&gt;context = webContext ? WEBKIT_WEB_CONTEXT(webContext) : webkit_web_context_get_default();
</span><span class="cx">         break;
</span><span class="cx">     }
</span><ins>+    case PROP_RELATED_VIEW: {
+        gpointer relatedView = g_value_get_object(value);
+        webView-&gt;priv-&gt;relatedView = relatedView ? WEBKIT_WEB_VIEW(relatedView) : nullptr;
+        break;
+    }
</ins><span class="cx">     case PROP_GROUP: {
</span><span class="cx">         gpointer group = g_value_get_object(value);
</span><span class="cx">         webView-&gt;priv-&gt;group = group ? WEBKIT_WEB_VIEW_GROUP(group) : 0;
</span><span class="lines">@@ -637,6 +646,25 @@
</span><span class="cx">                                                         WEBKIT_TYPE_WEB_CONTEXT,
</span><span class="cx">                                                         static_cast&lt;GParamFlags&gt;(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
</span><span class="cx">     /**
</span><ins>+     * WebKitWebView:related-view:
+     *
+     * The related #WebKitWebView used when creating the view to share the
+     * same web process. This property is not readable because the related
+     * web view is only valid during the object construction.
+     *
+     * Since: 2.4
+     */
+    g_object_class_install_property(
+        gObjectClass,
+        PROP_RELATED_VIEW,
+        g_param_spec_object(
+            &quot;related-view&quot;,
+            _(&quot;Related WebView&quot;),
+            _(&quot;The related WebKitWebView used when creating the view to share the same web process&quot;),
+            WEBKIT_TYPE_WEB_VIEW,
+            static_cast&lt;GParamFlags&gt;(WEBKIT_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
+
+    /**
</ins><span class="cx">      * WebKitWebView:group:
</span><span class="cx">      *
</span><span class="cx">      * The #WebKitWebViewGroup of the view.
</span><span class="lines">@@ -890,6 +918,11 @@
</span><span class="cx">      * If this signal is handled the signal handler should return the
</span><span class="cx">      * newly created #WebKitWebView.
</span><span class="cx">      *
</span><ins>+     * When using %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES
+     * process model, the new #WebKitWebView should be related to
+     * @web_view to share the same web process, see webkit_web_view_new_with_related_view
+     * for more details.
+     *
</ins><span class="cx">      * The new #WebKitWebView should not be displayed to the user
</span><span class="cx">      * until the #WebKitWebView::ready-to-show signal is emitted.
</span><span class="cx">      *
</span><span class="lines">@@ -1882,6 +1915,29 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * webkit_web_view_new_with_related_view:
+ * @web_view: the related #WebKitWebView
+ *
+ * Creates a new #WebKitWebView sharing the same web process with @web_view.
+ * This method doesn't have any effect when %WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS
+ * process model is used, because a single web process is shared for all the web views in the
+ * same #WebKitWebContext. When using %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES process model,
+ * this method should always be used when creating the #WebKitWebView in the #WebKitWebView::create signal.
+ * You can also use this method to implement other process models based on %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES,
+ * like for example, sharing the same web process for all the views in the same security domain.
+ *
+ * Returns: (transfer full): The newly created #WebKitWebView widget
+ *
+ * Since: 2.4
+ */
+GtkWidget* webkit_web_view_new_with_related_view(WebKitWebView* webView)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);
+
+    return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, &quot;related-view&quot;, webView, nullptr));
+}
+
+/**
</ins><span class="cx">  * webkit_web_view_new_with_group:
</span><span class="cx">  * @group: a #WebKitWebViewGroup
</span><span class="cx">  *
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -266,6 +266,9 @@
</span><span class="cx"> webkit_web_view_new_with_context                     (WebKitWebContext          *context);
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_API GtkWidget *
</span><ins>+webkit_web_view_new_with_related_view                (WebKitWebView             *web_view);
+
+WEBKIT_API GtkWidget *
</ins><span class="cx"> webkit_web_view_new_with_group                       (WebKitWebViewGroup        *group);
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_API WebKitWebContext *
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -939,7 +939,7 @@
</span><span class="cx"> WebKitWebViewBase* webkitWebViewBaseCreate(WebContext* context, WebPageGroup* pageGroup)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(g_object_new(WEBKIT_TYPE_WEB_VIEW_BASE, NULL));
</span><del>-    webkitWebViewBaseCreateWebPage(webkitWebViewBase, context, pageGroup);
</del><ins>+    webkitWebViewBaseCreateWebPage(webkitWebViewBase, context, pageGroup, nullptr);
</ins><span class="cx">     return webkitWebViewBase;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -965,12 +965,13 @@
</span><span class="cx">     priv-&gt;pageProxy-&gt;pageGroup().preferences().setAcceleratedCompositingEnabled(false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebContext* context, WebPageGroup* pageGroup)
</del><ins>+void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebContext* context, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
</ins><span class="cx"> {
</span><span class="cx">     WebKitWebViewBasePrivate* priv = webkitWebViewBase-&gt;priv;
</span><span class="cx"> 
</span><span class="cx">     WebPageConfiguration webPageConfiguration;
</span><span class="cx">     webPageConfiguration.pageGroup = pageGroup;
</span><ins>+    webPageConfiguration.relatedPage = relatedPage;
</ins><span class="cx">     priv-&gt;pageProxy = context-&gt;createWebPage(*priv-&gt;pageClient, std::move(webPageConfiguration));
</span><span class="cx">     priv-&gt;pageProxy-&gt;initializeWebPage();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> WebKitWebViewBase* webkitWebViewBaseCreate(WebKit::WebContext*, WebKit::WebPageGroup*);
</span><span class="cx"> GtkIMContext* webkitWebViewBaseGetIMContext(WebKitWebViewBase*);
</span><span class="cx"> WebKit::WebPageProxy* webkitWebViewBaseGetPage(WebKitWebViewBase*);
</span><del>-void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, WebKit::WebContext*, WebKit::WebPageGroup*);
</del><ins>+void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, WebKit::WebContext*, WebKit::WebPageGroup*, WebKit::WebPageProxy*);
</ins><span class="cx"> void webkitWebViewBaseSetTooltipText(WebKitWebViewBase*, const char*);
</span><span class="cx"> void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&amp;);
</span><span class="cx"> void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -95,6 +95,7 @@
</span><span class="cx"> &lt;SUBSECTION&gt;
</span><span class="cx"> webkit_web_view_new
</span><span class="cx"> webkit_web_view_new_with_context
</span><ins>+webkit_web_view_new_with_related_view
</ins><span class="cx"> webkit_web_view_new_with_group
</span><span class="cx"> webkit_web_view_get_context
</span><span class="cx"> webkit_web_view_get_group
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Tools/ChangeLog        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-02-10  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Add API to create a webview related to another one
+        https://bugs.webkit.org/show_bug.cgi?id=128498
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * MiniBrowser/gtk/BrowserWindow.c:
+        (webViewCreate): Use webkit_web_view_new_with_related_view() when
+        creating a new web view for window.open().
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp:
+        (testMultiprocessWebViewCreateReadyClose): Add test case to check
+        that window.open() works when creating the new WebView related to
+        the existing one, and that no new web process is spawned when
+        using webkit_web_view_new_with_related_view().
+        (beforeAll):
+
</ins><span class="cx"> 2014-02-10  Eva Balazsfalvi  &lt;balazsfalvi.eva@stud.u-szeged.hu&gt;
</span><span class="cx"> 
</span><span class="cx">         If not running on Mac, build-webkit should not print Safari related output
</span></span></pre></div>
<a id="trunkToolsMiniBrowsergtkBrowserWindowc"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -346,7 +346,7 @@
</span><span class="cx"> 
</span><span class="cx"> static GtkWidget *webViewCreate(WebKitWebView *webView, BrowserWindow *window)
</span><span class="cx"> {
</span><del>-    WebKitWebView *newWebView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_context(webkit_web_view_get_context(webView)));
</del><ins>+    WebKitWebView *newWebView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_related_view(webView));
</ins><span class="cx">     webkit_web_view_set_settings(newWebView, webkit_web_view_get_settings(webView));
</span><span class="cx"> 
</span><span class="cx">     GtkWidget *newWindow = browser_window_new(newWebView, GTK_WINDOW(window));
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestMultiprocesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp (163780 => 163781)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp        2014-02-10 13:16:01 UTC (rev 163780)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp        2014-02-10 13:46:59 UTC (rev 163781)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;TestMain.h&quot;
</span><span class="cx"> #include &quot;WebKitTestBus.h&quot;
</span><ins>+#include &quot;WebViewTest.h&quot;
</ins><span class="cx"> #include &lt;webkit2/webkit2.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -104,6 +105,99 @@
</span><span class="cx">     g_assert_cmpuint(test-&gt;webProcessPid(0), !=, test-&gt;webProcessPid(1));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+class UIClientMultiprocessTest: public WebViewTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(UIClientMultiprocessTest);
+
+    enum WebViewEvents {
+        Create,
+        ReadyToShow,
+        Close
+    };
+
+    static GtkWidget* viewCreateCallback(WebKitWebView* webView, UIClientMultiprocessTest* test)
+    {
+        return test-&gt;viewCreate(webView);
+    }
+
+    static void viewReadyToShowCallback(WebKitWebView* webView, UIClientMultiprocessTest* test)
+    {
+        test-&gt;viewReadyToShow(webView);
+    }
+
+    static void viewCloseCallback(WebKitWebView* webView, UIClientMultiprocessTest* test)
+    {
+        test-&gt;viewClose(webView);
+    }
+
+    UIClientMultiprocessTest()
+    {
+        webkit_settings_set_javascript_can_open_windows_automatically(webkit_web_view_get_settings(m_webView), TRUE);
+        g_signal_connect(m_webView, &quot;create&quot;, G_CALLBACK(viewCreateCallback), this);
+    }
+
+    ~UIClientMultiprocessTest()
+    {
+        g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+    }
+
+    GtkWidget* viewCreate(WebKitWebView* webView)
+    {
+        g_assert(webView == m_webView);
+
+        GtkWidget* newWebView = webkit_web_view_new_with_related_view(webView);
+        g_object_ref_sink(newWebView);
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(newWebView));
+        m_webViewEvents.append(Create);
+
+        g_signal_connect(newWebView, &quot;ready-to-show&quot;, G_CALLBACK(viewReadyToShowCallback), this);
+        g_signal_connect(newWebView, &quot;close&quot;, G_CALLBACK(viewCloseCallback), this);
+
+        return newWebView;
+    }
+
+    void viewReadyToShow(WebKitWebView* webView)
+    {
+        g_assert(m_webView != webView);
+        m_webViewEvents.append(ReadyToShow);
+    }
+
+    void viewClose(WebKitWebView* webView)
+    {
+        g_assert(m_webView != webView);
+
+        m_webViewEvents.append(Close);
+        g_object_unref(webView);
+        g_main_loop_quit(m_mainLoop);
+    }
+
+    void waitUntilNewWebViewClose()
+    {
+        g_main_loop_run(m_mainLoop);
+    }
+
+    Vector&lt;WebViewEvents&gt; m_webViewEvents;
+};
+
+static void testMultiprocessWebViewCreateReadyClose(UIClientMultiprocessTest* test, gconstpointer)
+{
+    // At this point the web process of the current view has already been created.
+    // We save it here to check that after window.open() the number of processes
+    // is the same.
+    guint32 processCountBefore = nextInitializationId - 1;
+    test-&gt;loadHtml(&quot;&lt;html&gt;&lt;body onLoad=\&quot;window.open().close();\&quot;&gt;&lt;/html&gt;&quot;, nullptr);
+    test-&gt;waitUntilNewWebViewClose();
+
+    Vector&lt;UIClientMultiprocessTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
+    g_assert_cmpint(events.size(), ==, 3);
+    g_assert_cmpint(events[0], ==, UIClientMultiprocessTest::Create);
+    g_assert_cmpint(events[1], ==, UIClientMultiprocessTest::ReadyToShow);
+    g_assert_cmpint(events[2], ==, UIClientMultiprocessTest::Close);
+
+    guint32 processesCountAfter =  nextInitializationId - 1;
+    g_assert_cmpuint(processesCountAfter, ==, processCountBefore);
+}
+
</ins><span class="cx"> static void initializeWebExtensions(WebKitWebContext* context, gpointer)
</span><span class="cx"> {
</span><span class="cx">     initializeWebExtensionsSignalCount++;
</span><span class="lines">@@ -133,6 +227,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     MultiprocessTest::add(&quot;WebKitWebContext&quot;, &quot;process-per-web-view&quot;, testProcessPerWebView);
</span><ins>+    UIClientMultiprocessTest::add(&quot;WebKitWebView&quot;, &quot;multiprocess-create-ready-close&quot;, testMultiprocessWebViewCreateReadyClose);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void afterAll()
</span></span></pre>
</div>
</div>

</body>
</html>