Bug 24283 - QWebPage::acceptNavigationRequest type is not QWebPage::NavigationTypeReload when QWebPage::reload() is called
Summary: QWebPage::acceptNavigationRequest type is not QWebPage::NavigationTypeReload ...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Benjamin Meyer
Keywords: Qt
Depends on:
Reported: 2009-03-01 20:58 PST by Benjamin Meyer
Modified: 2014-02-03 03:50 PST (History)
5 users (show)

See Also:

Fix with test (5.12 KB, patch)
2009-03-02 10:40 PST, Benjamin Meyer
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Meyer 2009-03-01 20:58:12 PST
After calling QWebPage::reload() QWebPage::acceptNavigationRequest() is called, but the type is not WebPage::NavigationTypeReload, but is QWebPage::Other

In FrameLoader.cpp FrameLoader::reload should it always call setTriggeringAction()?  Currently it is only calling it if request.httpMethod() == "POST".  This causes dispatchDecidePolicyForNavigationAction to to only now that it is a reload when it is a post.

Below it the initial patch that solves this.  If this is correct I can turn this into a proper patch.

--- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
@@ -2456,9 +2456,10 @@ void FrameLoader::reload(bool endToEndReload)
     // If we're about to re-post, set up action so the application can warn the user.
     if (request.httpMethod() == "POST")
         loader->setTriggeringAction(NavigationAction(request.url(), NavigationTypeFormResubmitted));
+    else
+        loader->setTriggeringAction(NavigationAction(request.url(),
+                    endToEndReload ? FrameLoadTypeReloadFromOrigin : FrameLoadTypeReload, 0));

     loadWithDocumentLoader(loader.get(), endToEndReload ? FrameLoadTypeReloadFromOrigin : FrameLoadTypeReload, 0);
Comment 1 Benjamin Meyer 2009-03-02 10:40:18 PST
Created attachment 28183 [details]
Fix with test
Comment 2 Adam Treat 2009-03-12 11:21:06 PDT
This looks correct in principle to me although I wonder if it'll cause a behavior change in Safari.  Would feel better if Darin or someone more familiar with loader could look at it.
Comment 3 Adam Treat 2009-03-12 11:47:39 PDT
After talking with ap and anttik on IRC we agreed the patch should be amended to use NavigationType instead of FrameLoadType enum in the NavigationAction ctor.  Also, you should amend the in-code comment to explain what is happening and why.

Finally, can you give a real world case where an application would need to be able to distinguish between Reload and Other for purposes of deciding the navigation policy as this might have unintended consequences for other API's and their clients. (e.g. why the Qt port needs to distinguish this)
Comment 4 Kent Hansen 2010-03-12 02:52:28 PST
Any plans to proceed with this patch?
Comment 5 Benjamin Meyer 2010-03-12 06:50:22 PST
I want to say I wrote this patch when trying to implement the reload and shift-reload feature for arora.
Comment 6 Jocelyn Turcotte 2014-02-03 03:50:32 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.