Title: [230431] releases/WebKitGTK/webkit-2.20
Revision
230431
Author
carlo...@webkit.org
Date
2018-04-09 08:46:45 -0700 (Mon, 09 Apr 2018)

Log Message

Merge r230245 - ASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID when reloading page while a page is loading
https://bugs.webkit.org/show_bug.cgi?id=153210

Reviewed by Alex Christensen.

Source/WebKit:

The assert happens when WebPage::reload() is called twice and the first time the reload is ignored by
FrameLoader because the document URL is empty. In that case the pending navigation is not reset, because
FrameLoader::reload() returns before creating the document loader.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reload): Check if the pending navigation has been reset after calling FrameLoader::reload()
and reset it otherwise.

Tools:

Add unit tests to WebKit C API and WebKitGLib.

* TestWebKitAPI/Tests/WebKit/PageLoadBasic.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitGLib/TestLoaderClient.cpp:
(LoadTwiceAndReloadTest::reloadOnFinishLoad):
(LoadTwiceAndReloadTest::LoadTwiceAndReloadTest):
(LoadTwiceAndReloadTest::~LoadTwiceAndReloadTest):
(LoadTwiceAndReloadTest::waitUntilFinished):
(testWebViewLoadTwiceAndReload):
(beforeAll):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog (230430 => 230431)


--- releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog	2018-04-09 15:46:35 UTC (rev 230430)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog	2018-04-09 15:46:45 UTC (rev 230431)
@@ -1,5 +1,20 @@
 2018-04-03  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        ASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID when reloading page while a page is loading
+        https://bugs.webkit.org/show_bug.cgi?id=153210
+
+        Reviewed by Alex Christensen.
+
+        The assert happens when WebPage::reload() is called twice and the first time the reload is ignored by
+        FrameLoader because the document URL is empty. In that case the pending navigation is not reset, because
+        FrameLoader::reload() returns before creating the document loader.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::reload): Check if the pending navigation has been reset after calling FrameLoader::reload()
+        and reset it otherwise.
+
+2018-04-03  Carlos Garcia Campos  <cgar...@igalia.com>
+
         [GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback)
         https://bugs.webkit.org/show_bug.cgi?id=183346
 

Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/WebPage/WebPage.cpp (230430 => 230431)


--- releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-04-09 15:46:35 UTC (rev 230430)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-04-09 15:46:45 UTC (rev 230431)
@@ -1349,6 +1349,12 @@
 
     m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), WTFMove(sandboxExtensionHandle));
     corePage()->userInputBridge().reloadFrame(m_mainFrame->coreFrame(), OptionSet<ReloadOption>::fromRaw(reloadOptions));
+
+    if (m_pendingNavigationID) {
+        // This can happen if FrameLoader::reload() returns early because the document URL is empty.
+        // The reload does nothing so we need to reset the pending navigation. See webkit.org/b/153210.
+        m_pendingNavigationID = 0;
+    }
 }
 
 void WebPage::goForward(uint64_t navigationID, uint64_t backForwardItemID)

Modified: releases/WebKitGTK/webkit-2.20/Tools/ChangeLog (230430 => 230431)


--- releases/WebKitGTK/webkit-2.20/Tools/ChangeLog	2018-04-09 15:46:35 UTC (rev 230430)
+++ releases/WebKitGTK/webkit-2.20/Tools/ChangeLog	2018-04-09 15:46:45 UTC (rev 230431)
@@ -1,5 +1,24 @@
 2018-04-03  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        ASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID when reloading page while a page is loading
+        https://bugs.webkit.org/show_bug.cgi?id=153210
+
+        Reviewed by Alex Christensen.
+
+        Add unit tests to WebKit C API and WebKitGLib.
+
+        * TestWebKitAPI/Tests/WebKit/PageLoadBasic.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitGLib/TestLoaderClient.cpp:
+        (LoadTwiceAndReloadTest::reloadOnFinishLoad):
+        (LoadTwiceAndReloadTest::LoadTwiceAndReloadTest):
+        (LoadTwiceAndReloadTest::~LoadTwiceAndReloadTest):
+        (LoadTwiceAndReloadTest::waitUntilFinished):
+        (testWebViewLoadTwiceAndReload):
+        (beforeAll):
+
+2018-04-03  Carlos Garcia Campos  <cgar...@igalia.com>
+
         [GTK] Test /webkit/WebKitWebPage/context-menu is failing since r229831
         https://bugs.webkit.org/show_bug.cgi?id=184260
 

Modified: releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKit/PageLoadBasic.cpp (230430 => 230431)


--- releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKit/PageLoadBasic.cpp	2018-04-09 15:46:35 UTC (rev 230430)
+++ releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKit/PageLoadBasic.cpp	2018-04-09 15:46:45 UTC (rev 230431)
@@ -174,6 +174,39 @@
     EXPECT_TRUE(WKURLIsEqual(activeUrl.get(), url.get()));
 }
 
+TEST(WebKit, PageLoadTwiceAndReload)
+{
+    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+    PlatformWebView webView(context.get());
+
+    test1Done = false;
+    static unsigned loadsCount = 0;
+
+    WKPageLoaderClientV0 loaderClient;
+    memset(&loaderClient, 0, sizeof(loaderClient));
+    loaderClient.base.version = 0;
+    loaderClient.base.clientInfo = nullptr;
+    loaderClient.didFailProvisionalLoadWithErrorForFrame = [](WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo) {
+        loadsCount++;
+        WKPageReload(page);
+    };
+    loaderClient.didFinishLoadForFrame = [](WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) {
+        if (++loadsCount == 3) {
+            test1Done = true;
+            return;
+        }
+        WKPageReload(page);
+    };
+    WKPageSetPageLoaderClient(webView.page(), &loaderClient.base);
+
+    WKRetainPtr<WKURLRef> url1(AdoptWK, Util::createURLForResource("simple", "html"));
+    WKRetainPtr<WKURLRef> url2(AdoptWK, Util::createURLForResource("simple2", "html"));
+    WKPageLoadURL(webView.page(), url1.get());
+    WKPageLoadURL(webView.page(), url2.get());
+
+    Util::run(&test1Done);
+}
+
 } // namespace TestWebKitAPI
 
 #endif

Modified: releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKitGLib/TestLoaderClient.cpp (230430 => 230431)


--- releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKitGLib/TestLoaderClient.cpp	2018-04-09 15:46:35 UTC (rev 230430)
+++ releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKitGLib/TestLoaderClient.cpp	2018-04-09 15:46:45 UTC (rev 230431)
@@ -203,6 +203,43 @@
     assertNormalLoadHappened(test->m_loadEvents);
 }
 
+class LoadTwiceAndReloadTest : public WebViewTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(LoadTwiceAndReloadTest);
+
+    static void reloadOnFinishLoad(WebKitWebView* view, WebKitLoadEvent loadEvent, LoadTwiceAndReloadTest* test)
+    {
+        if (++test->m_loadsCount == 3)
+            test->quitMainLoop();
+        webkit_web_view_reload(view);
+    }
+
+    LoadTwiceAndReloadTest()
+    {
+        g_signal_connect(m_webView, "load-changed", G_CALLBACK(reloadOnFinishLoad), this);
+    }
+
+    ~LoadTwiceAndReloadTest()
+    {
+        g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
+    }
+
+    void waitUntilFinished()
+    {
+        m_loadsCount = 0;
+        g_main_loop_run(m_mainLoop);
+    }
+
+    unsigned m_loadsCount { 0 };
+};
+
+static void testWebViewLoadTwiceAndReload(LoadTwiceAndReloadTest* test, gconstpointer)
+{
+    test->loadURI(kServer->getURIForPath("/normal").data());
+    test->loadURI(kServer->getURIForPath("/normal2").data());
+    test->waitUntilFinished();
+}
+
 class ViewURITrackingTest: public LoadTrackingTest {
 public:
     MAKE_GLIB_TEST_FIXTURE(ViewURITrackingTest);
@@ -617,6 +654,7 @@
     LoadTrackingTest::add("WebKitWebView", "progress", testLoadProgress);
     LoadTrackingTest::add("WebKitWebView", "reload", testWebViewReload);
     LoadTrackingTest::add("WebKitWebView", "history-load", testWebViewHistoryLoad);
+    LoadTwiceAndReloadTest::add("WebKitWebView", "load-twice-and-reload", testWebViewLoadTwiceAndReload);
 
     // This test checks that web view notify::uri signal is correctly emitted
     // and the uri is already updated when loader client signals are emitted.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to