<!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>[144890] releases/WebKitGTK/webkit-2.0/Source/WebKit2</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/144890">144890</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2013-03-05 23:54:56 -0800 (Tue, 05 Mar 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK][WK2] Add WebKitWebPage::webkit_web_page_get_uri to WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=111288

Patch by Manuel Rego Casasnovas &lt;rego@igalia.com&gt; on 2013-03-05
Reviewed by Carlos Garcia Campos.

Add new property URI to WebKitWebPage providing a method
webkit_web_page_get_uri to get it and the signal &quot;notify::uri&quot; to
monitor changes in the URI.

* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Include new method in
GTK+ doc.
* UIProcess/API/gtk/tests/TestLoaderClient.cpp:
(testWebPageURI):
(beforeAll):
(afterAll): Add test to check that WebKitWebPage URI matches with
WebKitWebView value. The tests is listening for changes in WebKitWebPage
URI via D-Bus and checks that value is the same than WebKitWebView URI.
It also checks that the order of the URIs in a redirection is right.
* UIProcess/API/gtk/tests/WebExtensionTest.cpp:
(uriChangedCallback):
(pageCreatedCallback): Add new D-Bus signal &quot;URIChanged&quot; connected to
&quot;notify::uri&quot; signal of WebKitWebPage.
* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
(_WebKitWebPagePrivate): Add new URI attribute.
(webkitWebPageSetURI): Method to set the URI and emit the &quot;notify:uri&quot;
signal if it has changed.
(didStartProvisionalLoadForFrame): At this point it use the unreachable
URL from provisional document loader if any. Otherwise, it uses the URL
from provisional document loader.
(didReceiveServerRedirectForProvisionalLoadForFrame): In the case of
redirections it works like for didStartProvisionalLoadForFrame getting
the unreachable URL if any.
(didSameDocumentNavigationForFrame): In this case it gets the URL from
the document loader.
(webkitWebPageGetProperty): Add code related to URI property.
(webkit_web_page_class_init): Add bits related to URI property.
(webkitWebPageCreate): Implement callbacks to monitor URI changes.
(webkit_web_page_get_uri): Return URI attribute.
* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h: Add new method
header.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit20SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit20SourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit20SourceWebKit2UIProcessAPIgtktestsTestLoaderClientcpp">releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit20SourceWebKit2UIProcessAPIgtktestsWebExtensionTestcpp">releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit20SourceWebKit2WebProcessInjectedBundleAPIgtkWebKitWebPagecpp">releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit20SourceWebKit2WebProcessInjectedBundleAPIgtkWebKitWebPageh">releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit20SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog (144889 => 144890)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog        2013-03-06 07:53:47 UTC (rev 144889)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog        2013-03-06 07:54:56 UTC (rev 144890)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2013-03-05  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
+
+        [GTK][WK2] Add WebKitWebPage::webkit_web_page_get_uri to WebKit2 GTK+ API
+        https://bugs.webkit.org/show_bug.cgi?id=111288
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add new property URI to WebKitWebPage providing a method
+        webkit_web_page_get_uri to get it and the signal &quot;notify::uri&quot; to
+        monitor changes in the URI.
+
+        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Include new method in
+        GTK+ doc.
+        * UIProcess/API/gtk/tests/TestLoaderClient.cpp:
+        (testWebPageURI):
+        (beforeAll):
+        (afterAll): Add test to check that WebKitWebPage URI matches with
+        WebKitWebView value. The tests is listening for changes in WebKitWebPage
+        URI via D-Bus and checks that value is the same than WebKitWebView URI.
+        It also checks that the order of the URIs in a redirection is right.
+        * UIProcess/API/gtk/tests/WebExtensionTest.cpp:
+        (uriChangedCallback):
+        (pageCreatedCallback): Add new D-Bus signal &quot;URIChanged&quot; connected to
+        &quot;notify::uri&quot; signal of WebKitWebPage.
+        * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
+        (_WebKitWebPagePrivate): Add new URI attribute.
+        (webkitWebPageSetURI): Method to set the URI and emit the &quot;notify:uri&quot;
+        signal if it has changed.
+        (didStartProvisionalLoadForFrame): At this point it use the unreachable
+        URL from provisional document loader if any. Otherwise, it uses the URL
+        from provisional document loader.
+        (didReceiveServerRedirectForProvisionalLoadForFrame): In the case of
+        redirections it works like for didStartProvisionalLoadForFrame getting
+        the unreachable URL if any.
+        (didSameDocumentNavigationForFrame): In this case it gets the URL from
+        the document loader.
+        (webkitWebPageGetProperty): Add code related to URI property.
+        (webkit_web_page_class_init): Add bits related to URI property.
+        (webkitWebPageCreate): Implement callbacks to monitor URI changes.
+        (webkit_web_page_get_uri): Return URI attribute.
+        * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h: Add new method
+        header.
+
</ins><span class="cx"> 2013-03-04  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Some WebKit2 GTK+ unit tests are failing in 32 bits bot
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit20SourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (144889 => 144890)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2013-03-06 07:53:47 UTC (rev 144889)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2013-03-06 07:54:56 UTC (rev 144890)
</span><span class="lines">@@ -954,6 +954,7 @@
</span><span class="cx"> &lt;FILE&gt;WebKitWebPage&lt;/FILE&gt;
</span><span class="cx"> WebKitWebPage
</span><span class="cx"> webkit_web_page_get_dom_document
</span><ins>+webkit_web_page_get_uri
</ins><span class="cx"> 
</span><span class="cx"> &lt;SUBSECTION Standard&gt;
</span><span class="cx"> WebKitWebPageClass
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit20SourceWebKit2UIProcessAPIgtktestsTestLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp (144889 => 144890)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp        2013-03-06 07:53:47 UTC (rev 144889)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp        2013-03-06 07:54:56 UTC (rev 144890)
</span><span class="lines">@@ -22,11 +22,14 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;LoadTrackingTest.h&quot;
</span><ins>+#include &quot;WebKitTestBus.h&quot;
</ins><span class="cx"> #include &quot;WebKitTestServer.h&quot;
</span><ins>+#include &quot;WebViewTest.h&quot;
</ins><span class="cx"> #include &lt;gtk/gtk.h&gt;
</span><span class="cx"> #include &lt;libsoup/soup.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><ins>+static WebKitTestBus* bus;
</ins><span class="cx"> static WebKitTestServer* kServer;
</span><span class="cx"> 
</span><span class="cx"> static void testLoadingStatus(LoadTrackingTest* test, gconstpointer data)
</span><span class="lines">@@ -280,6 +283,62 @@
</span><span class="cx">     test-&gt;waitUntilLoadFinished();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+class WebPageURITest: public WebViewTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(WebPageURITest);
+
+    static void webPageURIChangedCallback(GDBusConnection*, const char*, const char*, const char*, const char*, GVariant* result, WebPageURITest* test)
+    {
+        const char* uri;
+        g_variant_get(result, &quot;(&amp;s)&quot;, &amp;uri);
+        test-&gt;m_webPageURIs.append(uri);
+    }
+
+    static void webViewURIChanged(GObject*, GParamSpec*, WebPageURITest* test)
+    {
+        test-&gt;m_webViewURIs.append(webkit_web_view_get_uri(test-&gt;m_webView));
+    }
+
+    WebPageURITest()
+    {
+        GRefPtr&lt;GDBusProxy&gt; proxy = adoptGRef(bus-&gt;createProxy(&quot;org.webkit.gtk.WebExtensionTest&quot;,
+            &quot;/org/webkit/gtk/WebExtensionTest&quot;, &quot;org.webkit.gtk.WebExtensionTest&quot;, m_mainLoop));
+        guint id = g_dbus_connection_signal_subscribe(
+            g_dbus_proxy_get_connection(proxy.get()),
+            0,
+            &quot;org.webkit.gtk.WebExtensionTest&quot;,
+            &quot;URIChanged&quot;,
+            &quot;/org/webkit/gtk/WebExtensionTest&quot;,
+            0,
+            G_DBUS_SIGNAL_FLAGS_NONE,
+            reinterpret_cast&lt;GDBusSignalCallback&gt;(webPageURIChangedCallback),
+            this,
+            0);
+        g_assert(id);
+
+        g_signal_connect(m_webView, &quot;notify::uri&quot;, G_CALLBACK(webViewURIChanged), this);
+    }
+
+    Vector&lt;CString&gt; m_webPageURIs;
+    Vector&lt;CString&gt; m_webViewURIs;
+
+};
+
+static void testWebPageURI(WebPageURITest* test, gconstpointer)
+{
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/redirect&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+
+    g_assert_cmpint(test-&gt;m_webPageURIs.size(), ==, test-&gt;m_webViewURIs.size());
+    for (size_t i = 0; i &lt; test-&gt;m_webPageURIs.size(); ++i)
+        ASSERT_CMP_CSTRING(test-&gt;m_webPageURIs[i], ==, test-&gt;m_webViewURIs[i]);
+
+    g_assert_cmpint(test-&gt;m_webPageURIs.size(), ==, 2);
+    ASSERT_CMP_CSTRING(test-&gt;m_webPageURIs[0], ==, kServer-&gt;getURIForPath(&quot;/redirect&quot;));
+    ASSERT_CMP_CSTRING(test-&gt;m_webPageURIs[1], ==, kServer-&gt;getURIForPath(&quot;/normal&quot;));
+
+}
+
</ins><span class="cx"> static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
</span><span class="cx"> {
</span><span class="cx">     static const char* responseString = &quot;&lt;html&gt;&lt;body&gt;Testing!Testing!Testing!Testing!Testing!Testing!Testing!&quot;
</span><span class="lines">@@ -318,6 +377,11 @@
</span><span class="cx"> 
</span><span class="cx"> void beforeAll()
</span><span class="cx"> {
</span><ins>+    webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(), WEBKIT_TEST_WEB_EXTENSIONS_DIR);
+    bus = new WebKitTestBus();
+    if (!bus-&gt;run())
+        return;
+
</ins><span class="cx">     kServer = new WebKitTestServer();
</span><span class="cx">     kServer-&gt;run(serverCallback);
</span><span class="cx"> 
</span><span class="lines">@@ -338,9 +402,11 @@
</span><span class="cx">     ViewURITrackingTest::add(&quot;WebKitWebView&quot;, &quot;active-uri&quot;, testWebViewActiveURI);
</span><span class="cx"> 
</span><span class="cx">     ViewIsLoadingTest::add(&quot;WebKitWebView&quot;, &quot;is-loading&quot;, testWebViewIsLoading);
</span><ins>+    WebPageURITest::add(&quot;WebKitWebPage&quot;, &quot;get-uri&quot;, testWebPageURI);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void afterAll()
</span><span class="cx"> {
</span><ins>+    delete bus;
</ins><span class="cx">     delete kServer;
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit20SourceWebKit2UIProcessAPIgtktestsWebExtensionTestcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp (144889 => 144890)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp        2013-03-06 07:53:47 UTC (rev 144889)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp        2013-03-06 07:54:56 UTC (rev 144890)
</span><span class="lines">@@ -31,6 +31,9 @@
</span><span class="cx">     &quot;   &lt;arg type='s' name='title' direction='out'/&gt;&quot;
</span><span class="cx">     &quot;  &lt;/method&gt;&quot;
</span><span class="cx">     &quot;  &lt;signal name='DocumentLoaded'/&gt;&quot;
</span><ins>+    &quot;  &lt;signal name='URIChanged'&gt;&quot;
+    &quot;   &lt;arg type='s' name='uri' direction='out'/&gt;&quot;
+    &quot;  &lt;/signal&gt;&quot;
</ins><span class="cx">     &quot; &lt;/interface&gt;&quot;
</span><span class="cx">     &quot;&lt;/node&gt;&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -46,9 +49,23 @@
</span><span class="cx">     g_assert(ok);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void uriChangedCallback(WebKitWebPage* webPage, GParamSpec* pspec, gpointer userData)
+{
+    bool ok = g_dbus_connection_emit_signal(
+        G_DBUS_CONNECTION(userData),
+        0,
+        &quot;/org/webkit/gtk/WebExtensionTest&quot;,
+        &quot;org.webkit.gtk.WebExtensionTest&quot;,
+        &quot;URIChanged&quot;,
+        g_variant_new(&quot;(s)&quot;, webkit_web_page_get_uri(webPage)),
+        0);
+    g_assert(ok);
+}
+
</ins><span class="cx"> static void pageCreatedCallback(WebKitWebExtension*, WebKitWebPage* webPage, gpointer userData)
</span><span class="cx"> {
</span><span class="cx">     g_signal_connect(webPage, &quot;document-loaded&quot;, G_CALLBACK(documentLoadedCallback), userData);
</span><ins>+    g_signal_connect(webPage, &quot;notify::uri&quot;, G_CALLBACK(uriChangedCallback), userData);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void methodCallCallback(GDBusConnection* connection, const char* sender, const char* objectPath, const char* interfaceName, const char* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit20SourceWebKit2WebProcessInjectedBundleAPIgtkWebKitWebPagecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp (144889 => 144890)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp        2013-03-06 07:53:47 UTC (rev 144889)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp        2013-03-06 07:54:56 UTC (rev 144890)
</span><span class="lines">@@ -23,12 +23,17 @@
</span><span class="cx"> #include &quot;ImmutableDictionary.h&quot;
</span><span class="cx"> #include &quot;InjectedBundle.h&quot;
</span><span class="cx"> #include &quot;WKBundleAPICast.h&quot;
</span><ins>+#include &quot;WKBundleFrame.h&quot;
</ins><span class="cx"> #include &quot;WebFrame.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMDocumentPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitWebPagePrivate.h&quot;
</span><span class="cx"> #include &quot;WebProcess.h&quot;
</span><ins>+#include &lt;WebCore/Document.h&gt;
+#include &lt;WebCore/DocumentLoader.h&gt;
</ins><span class="cx"> #include &lt;WebCore/Frame.h&gt;
</span><ins>+#include &lt;glib/gi18n-lib.h&gt;
+#include &lt;wtf/text/CString.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -39,14 +44,64 @@
</span><span class="cx">     LAST_SIGNAL
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+enum {
+    PROP_0,
+
+    PROP_URI
+};
+
</ins><span class="cx"> struct _WebKitWebPagePrivate {
</span><span class="cx">     WebPage* webPage;
</span><ins>+
+    CString uri;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> static guint signals[LAST_SIGNAL] = { 0, };
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_DEFINE_TYPE(WebKitWebPage, webkit_web_page, G_TYPE_OBJECT)
</span><span class="cx"> 
</span><ins>+static CString getProvisionalURLForFrame(WebFrame* webFrame)
+{
+    DocumentLoader* documentLoader = webFrame-&gt;coreFrame()-&gt;loader()-&gt;provisionalDocumentLoader();
+    if (!documentLoader-&gt;unreachableURL().isEmpty())
+        return documentLoader-&gt;unreachableURL().string().utf8();
+
+    return documentLoader-&gt;url().string().utf8();
+}
+
+static void webkitWebPageSetURI(WebKitWebPage* webPage, const CString&amp; uri)
+{
+    if (webPage-&gt;priv-&gt;uri == uri)
+        return;
+
+    webPage-&gt;priv-&gt;uri = uri;
+    g_object_notify(G_OBJECT(webPage), &quot;uri&quot;);
+}
+
+static void didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo)
+{
+    if (!WKBundleFrameIsMainFrame(frame))
+        return;
+
+    webkitWebPageSetURI(WEBKIT_WEB_PAGE(clientInfo), getProvisionalURLForFrame(toImpl(frame)));
+}
+
+static void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo)
+{
+    if (!WKBundleFrameIsMainFrame(frame))
+        return;
+
+    webkitWebPageSetURI(WEBKIT_WEB_PAGE(clientInfo), getProvisionalURLForFrame(toImpl(frame)));
+}
+
+static void didSameDocumentNavigationForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef* userData, const void *clientInfo)
+{
+    if (!WKBundleFrameIsMainFrame(frame))
+        return;
+
+    webkitWebPageSetURI(WEBKIT_WEB_PAGE(clientInfo), toImpl(frame)-&gt;coreFrame()-&gt;document()-&gt;url().string().utf8());
+}
+
</ins><span class="cx"> static void didFinishDocumentLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void *clientInfo)
</span><span class="cx"> {
</span><span class="cx">     g_signal_emit(WEBKIT_WEB_PAGE(clientInfo), signals[DOCUMENT_LOADED], 0);
</span><span class="lines">@@ -111,9 +166,41 @@
</span><span class="cx">     WebProcess::shared().injectedBundle()-&gt;postMessage(String::fromUTF8(&quot;WebPage.DidFailLoadForResource&quot;), ImmutableDictionary::adopt(message).get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void webkitWebPageGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
+{
+    WebKitWebPage* webPage = WEBKIT_WEB_PAGE(object);
+
+    switch (propId) {
+    case PROP_URI:
+        g_value_set_string(value, webkit_web_page_get_uri(webPage));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+    }
+}
+
</ins><span class="cx"> static void webkit_web_page_class_init(WebKitWebPageClass* klass)
</span><span class="cx"> {
</span><ins>+    GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
+
+    gObjectClass-&gt;get_property = webkitWebPageGetProperty;
+
</ins><span class="cx">     /**
</span><ins>+     * WebKitWebPage:uri:
+     *
+     * The current active URI of the #WebKitWebPage.
+     */
+    g_object_class_install_property(
+        gObjectClass,
+        PROP_URI,
+        g_param_spec_string(
+            &quot;uri&quot;,
+            _(&quot;URI&quot;),
+            _(&quot;The current active URI of the web page&quot;),
+            0,
+            WEBKIT_PARAM_READABLE));
+
+    /**
</ins><span class="cx">      * WebKitWebPage::document-loaded:
</span><span class="cx">      * @web_page: the #WebKitWebPage on which the signal is emitted
</span><span class="cx">      *
</span><span class="lines">@@ -140,14 +227,14 @@
</span><span class="cx">     WKBundlePageLoaderClient loaderClient = {
</span><span class="cx">         kWKBundlePageResourceLoadClientCurrentVersion,
</span><span class="cx">         page,
</span><del>-        0, // didStartProvisionalLoadForFrame
-        0, // didReceiveServerRedirectForProvisionalLoadForFrame
</del><ins>+        didStartProvisionalLoadForFrame,
+        didReceiveServerRedirectForProvisionalLoadForFrame,
</ins><span class="cx">         0, // didFailProvisionalLoadWithErrorForFrame
</span><span class="cx">         0, // didCommitLoadForFrame
</span><span class="cx">         didFinishDocumentLoadForFrame,
</span><span class="cx">         0, // didFinishLoadForFrame,
</span><span class="cx">         0, // didFailLoadWithErrorForFrame
</span><del>-        0, // didSameDocumentNavigationForFrame
</del><ins>+        didSameDocumentNavigationForFrame,
</ins><span class="cx">         0, // didReceiveTitleForFrame
</span><span class="cx">         0, // didFirstLayoutForFrame
</span><span class="cx">         0, // didFirstVisuallyNonEmptyLayoutForFrame
</span><span class="lines">@@ -210,3 +297,22 @@
</span><span class="cx"> 
</span><span class="cx">     return kit(coreFrame-&gt;document());
</span><span class="cx"> }
</span><ins>+
+/**
+ * webkit_web_page_get_uri:
+ * @web_page: a #WebKitWebPage
+ *
+ * Returns the current active URI of @web_page.
+ *
+ * You can monitor the active URI by connecting to the notify::uri
+ * signal of @web_page.
+ *
+ * Returns: the current active URI of @web_view or %NULL if nothing has been
+ *    loaded yet.
+ */
+const gchar* webkit_web_page_get_uri(WebKitWebPage* webPage)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_PAGE(webPage), 0);
+
+    return webPage-&gt;priv-&gt;uri.data();
+}
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit20SourceWebKit2WebProcessInjectedBundleAPIgtkWebKitWebPageh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h (144889 => 144890)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h        2013-03-06 07:53:47 UTC (rev 144889)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h        2013-03-06 07:54:56 UTC (rev 144890)
</span><span class="lines">@@ -57,6 +57,9 @@
</span><span class="cx"> WEBKIT_API WebKitDOMDocument *
</span><span class="cx"> webkit_web_page_get_dom_document (WebKitWebPage *web_page);
</span><span class="cx"> 
</span><ins>+WEBKIT_API const gchar *
+webkit_web_page_get_uri (WebKitWebPage *web_page);
+
</ins><span class="cx"> G_END_DECLS
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>