Title: [230767] trunk
Revision
230767
Author
commit-qu...@webkit.org
Date
2018-04-18 10:50:15 -0700 (Wed, 18 Apr 2018)

Log Message

REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
https://bugs.webkit.org/show_bug.cgi?id=184570
<rdar://problem/34807323>

Patch by Sihui Liu <sihui_...@apple.com> on 2018-04-18
Reviewed by Chris Dumez.

Source/WebCore:

Set FrameLoadType properly when error occurs in reload.

tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::load):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230766 => 230767)


--- trunk/Source/WebCore/ChangeLog	2018-04-18 17:31:41 UTC (rev 230766)
+++ trunk/Source/WebCore/ChangeLog	2018-04-18 17:50:15 UTC (rev 230767)
@@ -1,3 +1,18 @@
+2018-04-18  Sihui Liu  <sihui_...@apple.com>
+
+        REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
+        https://bugs.webkit.org/show_bug.cgi?id=184570
+        <rdar://problem/34807323>
+
+        Reviewed by Chris Dumez.
+
+        Set FrameLoadType properly when error occurs in reload.
+
+        tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::load):
+
 2018-04-18  Chris Dumez  <cdu...@apple.com>
 
         Add support for converting a local window to a remote window

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (230766 => 230767)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-04-18 17:31:41 UTC (rev 230766)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-04-18 17:50:15 UTC (rev 230767)
@@ -1428,8 +1428,8 @@
     if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->originalRequest().url())) {
         r.setCachePolicy(ReloadIgnoringCacheData);
         type = FrameLoadType::Same;
-    } else if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->unreachableURL()) && m_loadType == FrameLoadType::Reload)
-        type = FrameLoadType::Reload;
+    } else if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->unreachableURL()) && isReload(m_loadType))
+        type = m_loadType;
     else if (m_loadType == FrameLoadType::RedirectWithLockedBackForwardList && !newDocumentLoader->unreachableURL().isEmpty() && newDocumentLoader->substituteData().isValid())
         type = FrameLoadType::RedirectWithLockedBackForwardList;
     else

Modified: trunk/Tools/ChangeLog (230766 => 230767)


--- trunk/Tools/ChangeLog	2018-04-18 17:31:41 UTC (rev 230766)
+++ trunk/Tools/ChangeLog	2018-04-18 17:50:15 UTC (rev 230767)
@@ -1,3 +1,16 @@
+2018-04-18  Sihui Liu  <sihui_...@apple.com>
+
+        REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
+        https://bugs.webkit.org/show_bug.cgi?id=184570
+        <rdar://problem/34807323>
+
+        Reviewed by Chris Dumez.
+
+        Add API test coverage.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:
+        (TEST):
+
 2018-04-18  Chris Dumez  <cdu...@apple.com>
 
         Add support for converting a local window to a remote window

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm (230766 => 230767)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm	2018-04-18 17:31:41 UTC (rev 230766)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm	2018-04-18 17:50:15 UTC (rev 230767)
@@ -128,4 +128,31 @@
     [webView loadHTMLString:@"<html>hi</html>" baseURL:[NSURL URLWithString:@"file:///.file/id="]];
 }
 
+TEST(WKWebView, LoadAlternateHTMLStringFromProvisionalLoadErrorReload)
+{
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    auto controller = adoptNS([[LoadAlternateHTMLStringFromProvisionalLoadErrorController alloc] init]);
+    [webView setNavigationDelegate:controller.get()];
+
+    NSURL *invalidURL = [NSURL URLWithString:@"https://www.example.com%3C%3E/"];
+    [webView loadRequest:[NSURLRequest requestWithURL:invalidURL]];
+    TestWebKitAPI::Util::run(&isDone);
+    isDone = false;
+
+    [webView reload];
+    TestWebKitAPI::Util::run(&isDone);
+    isDone = false;
+
+    [webView reloadFromOrigin];
+    TestWebKitAPI::Util::run(&isDone);
+    isDone = false;
+
+    [webView _reloadExpiredOnly];
+    TestWebKitAPI::Util::run(&isDone);
+    isDone = false;
+
+    WKBackForwardList *list = [webView backForwardList];
+    EXPECT_EQ((NSUInteger)0, list.backList.count);
+}
+
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to