Title: [116626] trunk
Revision
116626
Author
ves...@webkit.org
Date
2012-05-10 04:12:25 -0700 (Thu, 10 May 2012)

Log Message

WebPageProxy::activeURL() should return the pending API request, even when there's no main frame

https://bugs.webkit.org/show_bug.cgi?id=85806

The m_pendingAPIRequestURL member is used (presumably) to mask over the async
nature of WebKit2, so that starting a load of a URL will reflect that URL
immedeatly from activeURL, even if the request has not been passed over to
the web process yet and reflected there.

This works well, except in the case of the initial request, where the main
frame creation happens on the web process side and is notified back to the
UI process. Until we've recived the notification we don't know about the main
frame, and this race condition will potentially give us an empty url instead
of the pending request.

To solve this we always return the pending API request if it's set, even
when there's no mainframe yet (that we known about).

Reviewed by Simon Hausmann.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (116625 => 116626)


--- trunk/Source/WebKit2/ChangeLog	2012-05-10 10:56:00 UTC (rev 116625)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-10 11:12:25 UTC (rev 116626)
@@ -1,3 +1,26 @@
+2012-05-07  Tor Arne Vestbø  <tor.arne.ves...@nokia.com>
+
+        WebPageProxy::activeURL() should return the pending API request, even when there's no main frame
+        https://bugs.webkit.org/show_bug.cgi?id=85806
+
+        The m_pendingAPIRequestURL member is used (presumably) to mask over the async
+        nature of WebKit2, so that starting a load of a URL will reflect that URL
+        immedeatly from activeURL, even if the request has not been passed over to
+        the web process yet and reflected there.
+
+        This works well, except in the case of the initial request, where the main
+        frame creation happens on the web process side and is notified back to the
+        UI process. Until we've recived the notification we don't know about the main
+        frame, and this race condition will potentially give us an empty url instead
+        of the pending request.
+
+        To solve this we always return the pending API request if it's set, even
+        when there's no mainframe yet (that we known about).
+
+        Reviewed by Simon Hausmann.
+
+        * UIProcess/WebPageProxy.cpp:
+
 2012-05-09  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         Move suspendAnimations to use Internals interface.

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (116625 => 116626)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-05-10 10:56:00 UTC (rev 116625)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-05-10 11:12:25 UTC (rev 116626)
@@ -660,13 +660,15 @@
 
 String WebPageProxy::activeURL() const
 {
+    // If there is a currently pending url, it is the active URL,
+    // even when there's no main frame yet, as it might be the
+    // first API request.
+    if (!m_pendingAPIRequestURL.isNull())
+        return m_pendingAPIRequestURL;
+
     if (!m_mainFrame)
         return String();
 
-    // If there is a currently pending url, it is the active URL.
-    if (!m_pendingAPIRequestURL.isNull())
-        return m_pendingAPIRequestURL;
-
     if (!m_mainFrame->unreachableURL().isEmpty())
         return m_mainFrame->unreachableURL();
 

Modified: trunk/Tools/ChangeLog (116625 => 116626)


--- trunk/Tools/ChangeLog	2012-05-10 10:56:00 UTC (rev 116625)
+++ trunk/Tools/ChangeLog	2012-05-10 11:12:25 UTC (rev 116626)
@@ -1,3 +1,26 @@
+2012-05-07  Tor Arne Vestbø  <tor.arne.ves...@nokia.com>
+
+        WebPageProxy::activeURL() should return the pending API request, even when there's no main frame
+        https://bugs.webkit.org/show_bug.cgi?id=85806
+
+        The m_pendingAPIRequestURL member is used (presumably) to mask over the async
+        nature of WebKit2, so that starting a load of a URL will reflect that URL
+        immedeatly from activeURL, even if the request has not been passed over to
+        the web process yet and reflected there.
+
+        This works well, except in the case of the initial request, where the main
+        frame creation happens on the web process side and is notified back to the
+        UI process. Until we've recived the notification we don't know about the main
+        frame, and this race condition will potentially give us an empty url instead
+        of the pending request.
+
+        To solve this we always return the pending API request if it's set, even
+        when there's no mainframe yet (that we known about).
+
+        Reviewed by Simon Hausmann.
+
+        * TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
+
 2012-05-10  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
 
         [EFL][DRT] Clear added user style sheets before a new testcase execution.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp (116625 => 116626)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp	2012-05-10 10:56:00 UTC (rev 116625)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp	2012-05-10 11:12:25 UTC (rev 116626)
@@ -135,9 +135,17 @@
     policyClient.decidePolicyForResponse = decidePolicyForResponse;
     WKPageSetPagePolicyClient(webView.page(), &policyClient);
 
+    // Before loading anything, the active url should be null
+    EXPECT_NULL(WKPageCopyActiveURL(webView.page()));
+
     WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
     WKPageLoadURL(webView.page(), url.get());
 
+    // But immediately after starting a load, the active url should reflect the request
+    WKRetainPtr<WKURLRef> activeUrl = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeUrl.get());
+    EXPECT_TRUE(WKURLIsEqual(activeUrl.get(), url.get()));
+
     Util::run(&test1Done);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to