Bug 26848

Summary: [Qt] ResourceHandle::willLoadFromCache needs to be implmeneted QtWebKit.
Product: WebKit Reporter: Yongjun Zhang <yongjun.zhang>
Component: WebKit QtAssignee: Yongjun Zhang <yongjun.zhang>
Status: RESOLVED FIXED    
Severity: Normal CC: hausmann, laszlo.gombos, zecke
Priority: P2 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Implement willLoadFromCache for QtWebKit.
zecke: review-
modify the patch to include Zecke's review comments. hausmann: review+

Description Yongjun Zhang 2009-06-30 11:26:58 PDT
When disk cache is enabled, WebCore can figure out if the next main load could be loaded from cache by calling willLoadFromCache when do form repost (FrameLoader.cpp:4530).  willLoadFromCache in QtWebKit is currently not implemented and always returns false.
Comment 1 Yongjun Zhang 2009-06-30 11:32:39 PDT
Created attachment 32079 [details]
Implement willLoadFromCache for QtWebKit.

Implement ResouceHandler::willLoadFromCache in QtWebKit, add Frame* argument to generic willLoadFromCache because it is needed to figure out the right QNetworkAccessManager from QWebPage.
Comment 2 Eric Seidel (no email) 2009-06-30 14:39:18 PDT
Comment on attachment 32079 [details]
Implement willLoadFromCache for QtWebKit.

Why does Qt need the frame and no other port does?

Isn't there a global "network manager"?
+    QNetworkAccessManager* manager = QWebFramePrivate::kit(frame)->page()->networkAccessManager();
Comment 3 Simon Hausmann 2009-07-01 01:53:02 PDT
(In reply to comment #2)
> (From update of attachment 32079 [details] [review])
> Why does Qt need the frame and no other port does?
> 
> Isn't there a global "network manager"?
> +    QNetworkAccessManager* manager =
> QWebFramePrivate::kit(frame)->page()->networkAccessManager();
> 

I think the Qt port is the only one that allows that kind of sandboxing, where there is a per page (or page group) specific network manager and similar things. From an application developer's point of view that's very convenient.

Comment 4 Holger Freyther 2009-07-06 07:33:20 PDT
Comment on attachment 32079 [details]
Implement willLoadFromCache for QtWebKit.


> -bool ResourceHandle::willLoadFromCache(ResourceRequest& request)
> +bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame* frame)

this will break the mac build... remove the unused parameter


> +#if QT_VERSION >= 0x040400
> +    QNetworkAccessManager* manager = QWebFramePrivate::kit(frame)->page()->networkAccessManager();
> +    QAbstractNetworkCache* cache = manager->cache();


this will not work on Qt4.4... the cache got added in Qt 4.5...

please revise the patch, it looks good otherwise!
Comment 5 Holger Freyther 2009-07-06 07:37:40 PDT
(In reply to comment #2)
> (From update of attachment 32079 [details])
> Why does Qt need the frame and no other port does?
> 
> Isn't there a global "network manager"?
> +    QNetworkAccessManager* manager =
> QWebFramePrivate::kit(frame)->page()->networkAccessManager();

Qt has a network manager instance per QWebPage. E.g. different parts of the app (think of the help system) have different policies for networking access... anyway this was just a quick example.

Prior changes due this included the static/synchronous XMLHttpRequest implementation and cookies. Back then we have added the Frame*/Document* to the signature with Apple's review, I think it is the same case here.
Comment 6 Yongjun Zhang 2009-07-20 12:40:39 PDT
Created attachment 33100 [details]
modify the patch to include Zecke's review comments.

Incorporate Zeke's comments:

1. leave Frame* argument empty to be able to  build in mac.
2. enable the feature in QT_VERSION 4.5, where disk cache was first introduced.
Comment 7 Simon Hausmann 2009-07-29 03:32:47 PDT
Comment on attachment 33100 [details]
modify the patch to include Zecke's review comments.

r=me. There's a typo in the ChangeLog and the "No new tests" line shouldn't be there, but I'll remove that when landing.
Comment 8 Simon Hausmann 2009-07-29 03:33:29 PDT
Landed in r46535