Title: [199663] trunk
Revision
199663
Author
[email protected]
Date
2016-04-18 03:01:45 -0700 (Mon, 18 Apr 2016)

Log Message

Pending API request URL no set when loading Data, Alternate HTML or plain text
https://bugs.webkit.org/show_bug.cgi?id=136916

Reviewed by Darin Adler.

Source/WebKit2:

Set pending API request URL for all load methods in
WebPageProxy. This ensures that right after calling those methods,
the active URL is the requested one and that
PageLoadState::isLoading() returns true.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadAlternateHTMLString):
(WebKit::WebPageProxy::loadPlainTextString):
(WebKit::WebPageProxy::loadWebArchiveData):

Tools:

Add new test to check that active URL is the requested one right
after calling WKPage load methods.

* TestWebKitAPI/PlatformEfl.cmake:
* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp: Added.
(TestWebKitAPI::TEST):
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
(WebViewTest::loadPlainText): Remove FIXME.
(WebViewTest::loadBytes): Ditto.
(WebViewTest::loadAlternateHTML): Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (199662 => 199663)


--- trunk/Source/WebKit2/ChangeLog	2016-04-18 09:48:33 UTC (rev 199662)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-18 10:01:45 UTC (rev 199663)
@@ -1,3 +1,20 @@
+2016-04-18  Carlos Garcia Campos  <[email protected]>
+
+        Pending API request URL no set when loading Data, Alternate HTML or plain text
+        https://bugs.webkit.org/show_bug.cgi?id=136916
+
+        Reviewed by Darin Adler.
+
+        Set pending API request URL for all load methods in
+        WebPageProxy. This ensures that right after calling those methods,
+        the active URL is the requested one and that
+        PageLoadState::isLoading() returns true.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::loadAlternateHTMLString):
+        (WebKit::WebPageProxy::loadPlainTextString):
+        (WebKit::WebPageProxy::loadWebArchiveData):
+
 2016-04-18  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r199660.

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (199662 => 199663)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-04-18 09:48:33 UTC (rev 199662)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-04-18 10:01:45 UTC (rev 199663)
@@ -971,7 +971,7 @@
 
     auto transaction = m_pageLoadState.transaction();
 
-    m_pageLoadState.setPendingAPIRequestURL(transaction, !baseURL.isEmpty() ? baseURL : ASCIILiteral("about:blank"));
+    m_pageLoadState.setPendingAPIRequestURL(transaction, !baseURL.isEmpty() ? baseURL : blankURL().string());
 
     if (!isValid())
         reattachToWebProcess();
@@ -993,7 +993,7 @@
 
     auto transaction = m_pageLoadState.transaction();
 
-    m_pageLoadState.setPendingAPIRequestURL(transaction, !baseURL.isEmpty() ? baseURL : ASCIILiteral("about:blank"));
+    m_pageLoadState.setPendingAPIRequestURL(transaction, !baseURL.isEmpty() ? baseURL : blankURL().string());
 
     if (!isValid())
         reattachToWebProcess();
@@ -1021,6 +1021,7 @@
 
     auto transaction = m_pageLoadState.transaction();
 
+    m_pageLoadState.setPendingAPIRequestURL(transaction, unreachableURL);
     m_pageLoadState.setUnreachableURL(transaction, unreachableURL);
 
     if (m_mainFrame)
@@ -1040,6 +1041,9 @@
     if (!isValid())
         reattachToWebProcess();
 
+    auto transaction = m_pageLoadState.transaction();
+    m_pageLoadState.setPendingAPIRequestURL(transaction, blankURL().string());
+
     m_process->send(Messages::WebPage::LoadPlainTextString(string, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
     m_process->responsivenessTimer().start();
 }
@@ -1052,6 +1056,9 @@
     if (!isValid())
         reattachToWebProcess();
 
+    auto transaction = m_pageLoadState.transaction();
+    m_pageLoadState.setPendingAPIRequestURL(transaction, blankURL().string());
+
     m_process->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference(), UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
     m_process->responsivenessTimer().start();
 }

Modified: trunk/Tools/ChangeLog (199662 => 199663)


--- trunk/Tools/ChangeLog	2016-04-18 09:48:33 UTC (rev 199662)
+++ trunk/Tools/ChangeLog	2016-04-18 10:01:45 UTC (rev 199663)
@@ -1,3 +1,23 @@
+2016-04-18  Carlos Garcia Campos  <[email protected]>
+
+        Pending API request URL no set when loading Data, Alternate HTML or plain text
+        https://bugs.webkit.org/show_bug.cgi?id=136916
+
+        Reviewed by Darin Adler.
+
+        Add new test to check that active URL is the requested one right
+        after calling WKPage load methods.
+
+        * TestWebKitAPI/PlatformEfl.cmake:
+        * TestWebKitAPI/PlatformGTK.cmake:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp: Added.
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
+        (WebViewTest::loadPlainText): Remove FIXME.
+        (WebViewTest::loadBytes): Ditto.
+        (WebViewTest::loadAlternateHTML): Ditto.
+
 2016-04-18  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r199660.

Modified: trunk/Tools/TestWebKitAPI/PlatformEfl.cmake (199662 => 199663)


--- trunk/Tools/TestWebKitAPI/PlatformEfl.cmake	2016-04-18 09:48:33 UTC (rev 199662)
+++ trunk/Tools/TestWebKitAPI/PlatformEfl.cmake	2016-04-18 10:01:45 UTC (rev 199663)
@@ -94,6 +94,7 @@
     PageLoadBasic
     PageLoadDidChangeLocationWithinPageForFrame
     ParentFrame
+    PendingAPIRequestURL
     PreventEmptyUserAgent
     PrivateBrowsingPushStateNoHistoryCallback
     ResponsivenessTimerDoesntFireEarly

Modified: trunk/Tools/TestWebKitAPI/PlatformGTK.cmake (199662 => 199663)


--- trunk/Tools/TestWebKitAPI/PlatformGTK.cmake	2016-04-18 09:48:33 UTC (rev 199662)
+++ trunk/Tools/TestWebKitAPI/PlatformGTK.cmake	2016-04-18 10:01:45 UTC (rev 199663)
@@ -98,6 +98,7 @@
     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/PageLoadBasic.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/PendingAPIRequestURL.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/PreventEmptyUserAgent.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ReloadPageAfterCrash.cpp

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (199662 => 199663)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-04-18 09:48:33 UTC (rev 199662)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-04-18 10:01:45 UTC (rev 199663)
@@ -7,6 +7,7 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		0766DD201A5AD5200023E3BB /* PendingAPIRequestURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0766DD1F1A5AD5200023E3BB /* PendingAPIRequestURL.cpp */; };
 		0F139E771A423A5B00F590F5 /* WeakObjCPtr.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E751A423A5300F590F5 /* WeakObjCPtr.mm */; };
 		0F139E781A423A6B00F590F5 /* PlatformUtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */; };
 		0F139E791A42457000F590F5 /* PlatformUtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */; };
@@ -506,6 +507,7 @@
 /* Begin PBXFileReference section */
 		00BC16851680FE810065F1E5 /* PublicSuffix.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PublicSuffix.mm; sourceTree = "<group>"; };
 		00CD9F6215BE312C002DA2CE /* BackForwardList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BackForwardList.mm; sourceTree = "<group>"; };
+		0766DD1F1A5AD5200023E3BB /* PendingAPIRequestURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PendingAPIRequestURL.cpp; sourceTree = "<group>"; };
 		0BCD833414857CE400EA2003 /* HashMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HashMap.cpp; sourceTree = "<group>"; };
 		0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TemporaryChange.cpp; sourceTree = "<group>"; };
 		0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformUtilitiesCocoa.mm; path = cocoa/PlatformUtilitiesCocoa.mm; sourceTree = "<group>"; };
@@ -1199,6 +1201,7 @@
 		BC9096411255616000083756 /* WebKit2 */ = {
 			isa = PBXGroup;
 			children = (
+				0766DD1F1A5AD5200023E3BB /* PendingAPIRequestURL.cpp */,
 				0F139E741A423A4600F590F5 /* cocoa */,
 				C0C5D3BB14598B6F00A802A6 /* mac */,
 				BC90977B125571AE00083756 /* Resources */,
@@ -1952,6 +1955,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+                                0766DD201A5AD5200023E3BB /* PendingAPIRequestURL.cpp in Sources */,
 				2D9A53AF1B31FA8D0074D5AA /* ShrinkToFit.mm in Sources */,
 				51B454EC1B4E236B0085EAA6 /* WebViewCloseInsideDidFinishLoadForFrame.mm in Sources */,
 				57901FAD1CAF12C200ED64F9 /* LoadInvalidURLRequest.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp (0 => 199663)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp	2016-04-18 10:01:45 UTC (rev 199663)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_HAVE_C_SPI
+
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include <WebKit/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+TEST(WebKit2, PendingAPIRequestURL)
+{
+    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+    PlatformWebView webView(context.get());
+
+    WKRetainPtr<WKURLRef> activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    EXPECT_NULL(activeURL.get());
+
+    WKRetainPtr<WKURLRef> url = "" "html"));
+    WKPageLoadURL(webView.page(), url.get());
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
+    WKPageStopLoading(webView.page());
+
+    WKRetainPtr<WKStringRef> htmlString = Util::toWK("<body>Hello, World</body>");
+    WKRetainPtr<WKURLRef> blankURL = adoptWK(WKURLCreateWithUTF8CString("about:blank"));
+    WKPageLoadHTMLString(webView.page(), htmlString.get(), nullptr);
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
+    WKPageStopLoading(webView.page());
+
+    url = ""
+    WKPageLoadHTMLString(webView.page(), htmlString.get(), url.get());
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
+    WKPageStopLoading(webView.page());
+
+    WKRetainPtr<WKDataRef> data = "" 0));
+    WKPageLoadData(webView.page(), data.get(), nullptr, nullptr, nullptr);
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
+    WKPageStopLoading(webView.page());
+
+    WKPageLoadData(webView.page(), data.get(), nullptr, nullptr, url.get());
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
+    WKPageStopLoading(webView.page());
+
+    WKPageLoadAlternateHTMLString(webView.page(), htmlString.get(), nullptr, url.get());
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
+    WKPageStopLoading(webView.page());
+
+    WKRetainPtr<WKStringRef> plainTextString = Util::toWK("Hello, World");
+    WKPageLoadPlainTextString(webView.page(), plainTextString.get());
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
+    WKPageStopLoading(webView.page());
+
+    url = ""
+    WKPageLoadFile(webView.page(), url.get(), nullptr);
+    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
+    ASSERT_NOT_NULL(activeURL.get());
+    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
+    WKPageStopLoading(webView.page());
+}
+
+} // namespace TestWebKitAPI
+
+#endif

Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp (199662 => 199663)


--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp	2016-04-18 09:48:33 UTC (rev 199662)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp	2016-04-18 10:01:45 UTC (rev 199663)
@@ -82,12 +82,8 @@
 {
     m_activeURI = "about:blank";
     webkit_web_view_load_plain_text(m_webView, plainText);
-#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
 }
 
 void WebViewTest::loadBytes(GBytes* bytes, const char* mimeType, const char* encoding, const char* baseURI)
@@ -97,12 +93,8 @@
     else
         m_activeURI = baseURI;
     webkit_web_view_load_bytes(m_webView, bytes, mimeType, encoding, baseURI);
-#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
 }
 
 void WebViewTest::loadRequest(WebKitURIRequest* request)
@@ -117,11 +109,7 @@
 {
     m_activeURI = contentURI;
     webkit_web_view_load_alternate_html(m_webView, html, contentURI, baseURI);
-#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());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to