Diff
Modified: trunk/Source/WebKit/ChangeLog (235138 => 235139)
--- trunk/Source/WebKit/ChangeLog 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Source/WebKit/ChangeLog 2018-08-21 21:14:36 UTC (rev 235139)
@@ -1,3 +1,26 @@
+2018-08-21 Alex Christensen <[email protected]>
+
+ Remove unused shouldKeepCurrentBackForwardListItemInList check
+ https://bugs.webkit.org/show_bug.cgi?id=188805
+
+ Reviewed by Andy Estes.
+
+ The check was only done in WKPageLoaderClient, and nobody implements the check.
+ It was not needed to put in WKPageNavigationClient or WKNavigationDelegate, so let's remove it!
+ This removes the unused ability to go back and remove the current back/forward list item.
+
+ * UIProcess/API/APILoaderClient.h:
+ (API::LoaderClient::didChangeBackForwardList):
+ (API::LoaderClient::shouldKeepCurrentBackForwardListItemInList): Deleted.
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageLoaderClient):
+ * UIProcess/WebBackForwardList.cpp:
+ (WebKit::WebBackForwardList::addItem):
+ (WebKit::WebBackForwardList::goToItem):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList): Deleted.
+ * UIProcess/WebPageProxy.h:
+
2018-08-21 Wenson Hsieh <[email protected]>
[Attachment Support] Augment _WKAttachment SPI to handle NSFileWrappers in addition to NSData
Modified: trunk/Source/WebKit/UIProcess/API/APILoaderClient.h (235138 => 235139)
--- trunk/Source/WebKit/UIProcess/API/APILoaderClient.h 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Source/WebKit/UIProcess/API/APILoaderClient.h 2018-08-21 21:14:36 UTC (rev 235139)
@@ -90,7 +90,6 @@
virtual bool processDidCrash(WebKit::WebPageProxy&) { return false; }
virtual void didChangeBackForwardList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, Vector<Ref<WebKit::WebBackForwardListItem>>&&) { }
- virtual bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&) { return true; }
virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&, API::Object*) { }
virtual void didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore&, WebKit::WebFrameProxy&) { }
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (235138 => 235139)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2018-08-21 21:14:36 UTC (rev 235139)
@@ -1042,6 +1042,7 @@
explicit LoaderClient(const WKPageLoaderClientBase* client)
{
initialize(client);
+ ASSERT(!m_client.shouldKeepCurrentBackForwardListItemInList);
}
private:
@@ -1248,14 +1249,6 @@
m_client.didChangeBackForwardList(toAPI(&page), toAPI(addedItem), toAPI(removedItemsArray.get()), m_client.base.clientInfo);
}
- bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy& page, WebKit::WebBackForwardListItem& item) override
- {
- if (!m_client.shouldKeepCurrentBackForwardListItemInList)
- return true;
-
- return m_client.shouldKeepCurrentBackForwardListItemInList(toAPI(&page), toAPI(&item), m_client.base.clientInfo);
- }
-
void willGoToBackForwardListItem(WebPageProxy& page, WebBackForwardListItem& item, API::Object* userData) override
{
if (m_client.willGoToBackForwardListItem)
Modified: trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp (235138 => 235139)
--- trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp 2018-08-21 21:14:36 UTC (rev 235139)
@@ -141,11 +141,8 @@
ASSERT(m_entries.isEmpty());
m_currentIndex = 0;
m_hasCurrentIndex = true;
- } else {
- shouldKeepCurrentItem = m_page->shouldKeepCurrentBackForwardListItemInList(m_entries[m_currentIndex]);
- if (shouldKeepCurrentItem)
- m_currentIndex++;
- }
+ } else
+ m_currentIndex++;
auto* newItemPtr = newItem.ptr();
if (!shouldKeepCurrentItem) {
@@ -198,32 +195,12 @@
// If we're going to an item different from the current item, ask the client if the current
// item should remain in the list.
auto& currentItem = m_entries[m_currentIndex];
- bool shouldKeepCurrentItem = true;
- if (currentItem.ptr() != &item) {
+ if (currentItem.ptr() != &item)
m_page->recordAutomaticNavigationSnapshot();
- shouldKeepCurrentItem = m_page->shouldKeepCurrentBackForwardListItemInList(m_entries[m_currentIndex]);
- }
- // If the client said to remove the current item, remove it and then update the target index.
- Vector<Ref<WebBackForwardListItem>> removedItems;
- if (!shouldKeepCurrentItem) {
- removedItems.append(currentItem.copyRef());
- m_entries.remove(m_currentIndex);
- targetIndex = notFound;
- for (size_t i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].ptr() == &item) {
- targetIndex = i;
- break;
- }
- }
- ASSERT(targetIndex != notFound);
- }
-
m_currentIndex = targetIndex;
LOG(BackForward, "(Back/Forward) WebBackForwardList %p going to item %s, is now at index %zu", this, item.itemID().logString(), targetIndex);
-
- m_page->didChangeBackForwardList(nullptr, WTFMove(removedItems));
}
WebBackForwardListItem* WebBackForwardList::currentItem() const
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (235138 => 235139)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-21 21:14:36 UTC (rev 235139)
@@ -1290,13 +1290,6 @@
}
}
-bool WebPageProxy::shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem& item)
-{
- PageClientProtector protector(m_pageClient);
-
- return m_loaderClient->shouldKeepCurrentBackForwardListItemInList(*this, item);
-}
-
bool WebPageProxy::canShowMIMEType(const String& mimeType)
{
if (MIMETypeRegistry::canShowMIMEType(mimeType))
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (235138 => 235139)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-21 21:14:36 UTC (rev 235139)
@@ -468,8 +468,6 @@
void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<Ref<WebBackForwardListItem>>&& removed);
void willGoToBackForwardListItem(const WebCore::BackForwardItemIdentifier&, bool inPageCache, const UserData&);
- bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem&);
-
bool willHandleHorizontalScrollEvents() const;
void updateWebsitePolicies(WebsitePoliciesData&&);
Modified: trunk/Tools/ChangeLog (235138 => 235139)
--- trunk/Tools/ChangeLog 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Tools/ChangeLog 2018-08-21 21:14:36 UTC (rev 235139)
@@ -1,5 +1,15 @@
2018-08-21 Alex Christensen <[email protected]>
+ Remove unused shouldKeepCurrentBackForwardListItemInList check
+ https://bugs.webkit.org/show_bug.cgi?id=188805
+
+ Reviewed by Andy Estes.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/ShouldKeepCurrentBackForwardListItemInList.cpp: Removed.
+
+2018-08-21 Alex Christensen <[email protected]>
+
Transition more API tests from WKPageLoaderClient to WKPageNavigationClient
https://bugs.webkit.org/show_bug.cgi?id=188813
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (235138 => 235139)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-08-21 21:14:36 UTC (rev 235139)
@@ -534,7 +534,6 @@
7CCE7F111A411AE600447C4C /* RestoreSessionStateContainingFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0ADBE8212FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp */; };
7CCE7F121A411AE600447C4C /* ScrollPinningBehaviors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */; };
7CCE7F131A411AE600447C4C /* ShouldGoToBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */; };
- 7CCE7F141A411AE600447C4C /* ShouldKeepCurrentBackForwardListItemInList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */; };
7CCE7F151A411AE600447C4C /* SpacebarScrolling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */; };
7CCE7F161A411AE600447C4C /* TerminateTwice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */; };
7CCE7F171A411AE600447C4C /* UserMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */; };
@@ -1499,7 +1498,6 @@
51CD1C711B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "modal-alerts-in-new-about-blank-window.html"; sourceTree = "<group>"; };
51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKHTTPCookieStore.mm; sourceTree = "<group>"; };
51DB16CD1F085047001FA4C5 /* WebViewIconLoading.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewIconLoading.mm; sourceTree = "<group>"; };
- 51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldKeepCurrentBackForwardListItemInList.cpp; sourceTree = "<group>"; };
51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalStorageClear.mm; sourceTree = "<group>"; };
51E6A8951D2F1C7700C004B6 /* LocalStorageClear.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = LocalStorageClear.html; sourceTree = "<group>"; };
51E780361919AFF8001829A2 /* simple2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = simple2.html; sourceTree = "<group>"; };
@@ -2938,7 +2936,6 @@
2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */,
51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */,
51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */,
- 51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */,
C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
76734997193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp */,
7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */,
@@ -3947,7 +3944,6 @@
A17991881E1C994E00A505ED /* SharedBuffer.mm in Sources */,
A179918B1E1CA24100A505ED /* SharedBufferTest.cpp in Sources */,
7CCE7F131A411AE600447C4C /* ShouldGoToBackForwardListItem.cpp in Sources */,
- 7CCE7F141A411AE600447C4C /* ShouldKeepCurrentBackForwardListItemInList.cpp in Sources */,
37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */,
7C83E0C51D0A654600FEBCF3 /* ShrinkToFit.mm in Sources */,
7CCE7ECD1A411A7E00447C4C /* SimplifyMarkup.mm in Sources */,
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldKeepCurrentBackForwardListItemInList.cpp (235138 => 235139)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldKeepCurrentBackForwardListItemInList.cpp 2018-08-21 21:11:50 UTC (rev 235138)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldKeepCurrentBackForwardListItemInList.cpp 2018-08-21 21:14:36 UTC (rev 235139)
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * 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"
-
-// This test navigates from simple.html, to simple2.html, to simple3.html
-// When navigating from simple2 to simple3, it disallows the simple2 back/forward list item from staying in the list
-// It then navigates back from simple3, expecting to land at simple.
-
-namespace TestWebKitAPI {
-
-static bool finished = false;
-static bool successfulSoFar = true;
-static int navigationNumber = 0;
-
-static bool itemURLLastComponentIsString(WKBackForwardListItemRef item, const char* string)
-{
- WKRetainPtr<WKURLRef> url = ""
- WKRetainPtr<WKStringRef> path = adoptWK(WKURLCopyLastPathComponent(url.get()));
-
- return WKStringIsEqualToUTF8CString(path.get(), string);
-}
-
-static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef, const void*)
-{
- // Only mark finished when the main frame loads
- if (!WKFrameIsMainFrame(frame))
- return;
-
- finished = true;
- navigationNumber++;
-
- WKBackForwardListRef list = WKPageGetBackForwardList(page);
- WKBackForwardListItemRef currentItem = WKBackForwardListGetCurrentItem(list);
- WKBackForwardListItemRef backItem = WKBackForwardListGetBackItem(list);
- WKBackForwardListItemRef forwardItem = WKBackForwardListGetForwardItem(list);
- unsigned forwardCount = WKBackForwardListGetForwardListCount(list);
-
- // This test should never have a forward list.
- if (forwardCount)
- successfulSoFar = false;
-
- if (navigationNumber == 1) {
- // We've only performed 1 navigation, we should only have a current item.
- if (!currentItem || !itemURLLastComponentIsString(currentItem, "simple.html"))
- successfulSoFar = false;
- if (backItem || forwardItem)
- successfulSoFar = false;
- } else if (navigationNumber == 2) {
- // On the second navigation, simple2 should be current and simple should be the back item.
- if (!currentItem || !itemURLLastComponentIsString(currentItem, "simple2.html"))
- successfulSoFar = false;
- if (!backItem || !itemURLLastComponentIsString(backItem, "simple.html"))
- successfulSoFar = false;
- if (forwardItem)
- successfulSoFar = false;
- } else if (navigationNumber == 3) {
- // On the third navigation the item for simple2 should have been removed.
- // So simple3 should be current and simple should still be the back item.
- if (!currentItem || !itemURLLastComponentIsString(currentItem, "simple3.html"))
- successfulSoFar = false;
- if (!backItem || !itemURLLastComponentIsString(backItem, "simple.html"))
- successfulSoFar = false;
- if (forwardItem)
- successfulSoFar = false;
- } else if (navigationNumber == 4) {
- // After the fourth navigation (which was a "back" navigation), the item for simple3 should have been removed.
- // So simple should be current and there should be no other items.
- if (!currentItem || !itemURLLastComponentIsString(currentItem, "simple.html"))
- successfulSoFar = false;
- if (backItem || forwardItem)
- successfulSoFar = false;
- }
-}
-
-static void willGoToBackForwardListItem(WKPageRef, WKBackForwardListItemRef item, WKTypeRef userData, const void*)
-{
- if (!itemURLLastComponentIsString(item, "simple.html"))
- successfulSoFar = false;
-}
-
-static bool shouldKeepCurrentBackForwardListItemInList(WKPageRef page, WKBackForwardListItemRef item, const void*)
-{
- // We make sure the item for "simple2.html" is removed when we navigate to "simple3.html"
- // We also want to make sure the item for "simple3.html" is removed when we go back to "simple.html"
- // So we only want to keep "simple.html"
- return itemURLLastComponentIsString(item, "simple.html");
-}
-
-static void setPageLoaderClient(WKPageRef page)
-{
- WKPageLoaderClientV5 loaderClient;
- memset(&loaderClient, 0, sizeof(loaderClient));
-
- loaderClient.base.version = 5;
- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
- loaderClient.shouldKeepCurrentBackForwardListItemInList = shouldKeepCurrentBackForwardListItemInList;
- loaderClient.willGoToBackForwardListItem = willGoToBackForwardListItem;
-
- WKPageSetPageLoaderClient(page, &loaderClient.base);
-}
-
-TEST(WebKit, ShouldKeepCurrentBackForwardListItemInList)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
-
- PlatformWebView webView(context.get());
- setPageLoaderClient(webView.page());
-
- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
- Util::run(&finished);
- EXPECT_EQ(successfulSoFar, true);
-
- finished = false;
- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple2", "html")).get());
- Util::run(&finished);
- EXPECT_EQ(successfulSoFar, true);
-
- finished = false;
- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple3", "html")).get());
- Util::run(&finished);
- EXPECT_EQ(successfulSoFar, true);
-
- finished = false;
- WKPageGoBack(webView.page());
- Util::run(&finished);
-
- EXPECT_EQ(successfulSoFar, true);
- EXPECT_EQ(navigationNumber, 4);
-}
-
-} // namespace TestWebKitAPI
-
-
-#endif