Changeset 199664 in webkit


Ignore:
Timestamp:
Apr 18, 2016 3:36:29 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

Pending API Request URL is wrong after reloading
https://bugs.webkit.org/show_bug.cgi?id=139342

Reviewed by Darin Adler.

Source/WebKit2:

It happens when reloading a web view loaded with anything but a
URL, because the bf list is not updated for those cases and
WebPageProxy::reload() is setting the current bf list item URL as
pending API request URL. This also causes that progress is
reported wrongly, because
WebPageProxy::decidePolicyForNavigationAction() resets the pending
API request URL when it's different than the requested URL. The
page load transaction causes the progress to be changed, reporting
1.0 (the previous one), but later something < 1.0 is reported
again by the progress tracker.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::reload): Use the current active URL as
pending API request URL, falling back to the current bf list item
URL when empty.

Tools:

Update test case to check that the active URL should remain the
same after a reload.

  • TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp:

(TestWebKitAPI::TEST):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r199663 r199664  
     12016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Pending API Request URL is wrong after reloading
     4        https://bugs.webkit.org/show_bug.cgi?id=139342
     5
     6        Reviewed by Darin Adler.
     7
     8        It happens when reloading a web view loaded with anything but a
     9        URL, because the bf list is not updated for those cases and
     10        WebPageProxy::reload() is setting the current bf list item URL as
     11        pending API request URL. This also causes that progress is
     12        reported wrongly, because
     13        WebPageProxy::decidePolicyForNavigationAction() resets the pending
     14        API request URL when it's different than the requested URL. The
     15        page load transaction causes the progress to be changed, reporting
     16        1.0 (the previous one), but later something < 1.0 is reported
     17        again by the progress tracker.
     18
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::reload): Use the current active URL as
     21        pending API request URL, falling back to the current bf list item
     22        URL when empty.
     23
    1242016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
    225
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r199663 r199664  
    10921092    SandboxExtension::Handle sandboxExtensionHandle;
    10931093
    1094     if (m_backForwardList->currentItem()) {
    1095         String url = m_backForwardList->currentItem()->url();
     1094    String url = m_pageLoadState.activeURL();
     1095    if (url.isEmpty() && m_backForwardList->currentItem())
     1096        url = m_backForwardList->currentItem()->url();
     1097
     1098    if (!url.isEmpty()) {
    10961099        auto transaction = m_pageLoadState.transaction();
    10971100        m_pageLoadState.setPendingAPIRequestURL(transaction, url);
  • trunk/Tools/ChangeLog

    r199663 r199664  
     12016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Pending API Request URL is wrong after reloading
     4        https://bugs.webkit.org/show_bug.cgi?id=139342
     5
     6        Reviewed by Darin Adler.
     7
     8        Update test case to check that the active URL should remain the
     9        same after a reload.
     10
     11        * TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp:
     12        (TestWebKitAPI::TEST):
     13
    1142016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/PendingAPIRequestURL.cpp

    r199663 r199664  
    3535namespace TestWebKitAPI {
    3636
     37static bool done;
     38
    3739TEST(WebKit2, PendingAPIRequestURL)
    3840{
    3941    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    4042    PlatformWebView webView(context.get());
     43
     44    WKPageLoaderClientV0 loaderClient;
     45    memset(&loaderClient, 0, sizeof(loaderClient));
     46    loaderClient.base.version = 0;
     47    loaderClient.didFinishLoadForFrame = [](WKPageRef, WKFrameRef, WKTypeRef, const void*) { done = true; };
     48    WKPageSetPageLoaderClient(webView.page(), &loaderClient.base);
    4149
    4250    WKRetainPtr<WKURLRef> activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     
    4856    ASSERT_NOT_NULL(activeURL.get());
    4957    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
    50     WKPageStopLoading(webView.page());
     58    Util::run(&done);
     59    done = false;
     60
     61    WKPageReload(webView.page());
     62    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     63    ASSERT_NOT_NULL(activeURL.get());
     64    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
     65    Util::run(&done);
     66    done = false;
    5167
    5268    WKRetainPtr<WKStringRef> htmlString = Util::toWK("<body>Hello, World</body>");
     
    5672    ASSERT_NOT_NULL(activeURL.get());
    5773    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
    58     WKPageStopLoading(webView.page());
     74    Util::run(&done);
     75    done = false;
    5976
    60     url = adoptWK(WKURLCreateWithUTF8CString("http://www.webkit.org"));
     77    WKPageReload(webView.page());
     78    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     79    ASSERT_NOT_NULL(activeURL.get());
     80    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
     81    Util::run(&done);
     82    done = false;
     83
     84    url = adoptWK(Util::createURLForResource("simple2", "html"));
    6185    WKPageLoadHTMLString(webView.page(), htmlString.get(), url.get());
    6286    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
    6387    ASSERT_NOT_NULL(activeURL.get());
    6488    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
    65     WKPageStopLoading(webView.page());
     89    Util::run(&done);
     90    done = false;
     91
     92    WKPageReload(webView.page());
     93    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     94    ASSERT_NOT_NULL(activeURL.get());
     95    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
     96    Util::run(&done);
     97    done = false;
    6698
    6799    WKRetainPtr<WKDataRef> data = adoptWK(WKDataCreate(nullptr, 0));
     
    70102    ASSERT_NOT_NULL(activeURL.get());
    71103    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
    72     WKPageStopLoading(webView.page());
     104    Util::run(&done);
     105    done = false;
     106
     107    WKPageReload(webView.page());
     108    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     109    ASSERT_NOT_NULL(activeURL.get());
     110    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
     111    Util::run(&done);
     112    done = false;
    73113
    74114    WKPageLoadData(webView.page(), data.get(), nullptr, nullptr, url.get());
     
    76116    ASSERT_NOT_NULL(activeURL.get());
    77117    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
    78     WKPageStopLoading(webView.page());
     118    Util::run(&done);
     119    done = false;
     120
     121    WKPageReload(webView.page());
     122    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     123    ASSERT_NOT_NULL(activeURL.get());
     124    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
     125    Util::run(&done);
     126    done = false;
    79127
    80128    WKPageLoadAlternateHTMLString(webView.page(), htmlString.get(), nullptr, url.get());
     
    82130    ASSERT_NOT_NULL(activeURL.get());
    83131    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
    84     WKPageStopLoading(webView.page());
     132    Util::run(&done);
     133    done = false;
     134
     135    WKPageReload(webView.page());
     136    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     137    ASSERT_NOT_NULL(activeURL.get());
     138    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), url.get()));
     139    Util::run(&done);
     140    done = false;
    85141
    86142    WKRetainPtr<WKStringRef> plainTextString = Util::toWK("Hello, World");
     
    89145    ASSERT_NOT_NULL(activeURL.get());
    90146    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
    91     WKPageStopLoading(webView.page());
     147    Util::run(&done);
     148    done = false;
     149
     150    WKPageReload(webView.page());
     151    activeURL = adoptWK(WKPageCopyActiveURL(webView.page()));
     152    ASSERT_NOT_NULL(activeURL.get());
     153    EXPECT_TRUE(WKURLIsEqual(activeURL.get(), blankURL.get()));
     154    Util::run(&done);
     155    done = false;
    92156
    93157    url = adoptWK(WKURLCreateWithUTF8CString("file:///tmp/index.html"));
Note: See TracChangeset for help on using the changeset viewer.