Bug 28682

Summary: [Qt] QtWebKit Persistent API
Product: WebKit Reporter: Laszlo Gombos <laszlo.gombos>
Component: WebKit QtAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: hausmann, kenneth
Priority: P2 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
first try.
eric: review-
second try
ariya.hidayat: review-
3rd. try none

Laszlo Gombos
Reported 2009-08-24 13:12:16 PDT
This bug is to track and review QtWebKit persistent API - as it has been discussed on #qtwebkit. Directions from Simon regarding QtWebKit persistency - By default QtWebKit should not store any data persistently - There should be an easy way (that is one call) to enable WebKit persistency - that is enable all the features that might create persistent data - Would be nice to have a function which sets up the base directory path for all persistent data - Would be nice to have a default for the base directory path so that clients can just enable persistency, without worrying about the path
Attachments
first try. (9.72 KB, patch)
2009-08-24 14:28 PDT, Laszlo Gombos
eric: review-
second try (10.48 KB, patch)
2009-09-03 12:56 PDT, Laszlo Gombos
ariya.hidayat: review-
3rd. try (12.21 KB, patch)
2009-09-04 14:15 PDT, Laszlo Gombos
no flags
Laszlo Gombos
Comment 1 2009-08-24 14:28:22 PDT
Created attachment 38500 [details] first try. Putting this up for review to collect feedback. Patch implements the followings: - Disable LocalStorage, ApplicationCache, HTML5 offline storage by default - If persistency is enabled the default directory for LocalStorage and ApplicationCache is now based on QDesktopServices::DataLocation and not QDesktopServices::CacheLocation - If persistency is enabled initialize HTML5 offline storage as well - this fixed offline Storage for QtLauncher (it is crashing now) Looking for feedback on - function name and signature for enablePersistentStorage - Is there a need/can we maintain a disablePersistentStorage function (other WebKit ports does not seems to have this option)
Eric Seidel (no email)
Comment 2 2009-09-02 02:49:34 PDT
Comment on attachment 38500 [details] first try. Your changelog doesn't really have nearly enough description of what you're doing. Doesn't QtWebKit have a policy of adding unit tests for changes?
Laszlo Gombos
Comment 3 2009-09-02 19:11:13 PDT
Just to capture some of the discussion (in person/from IRC) with Simon and Kenneth. One idea was to add an enum argument so that this function can be used to configure not only the default for all persistent data but also for each individual persistent feature as well. One issue with that is that some persistent features are per page (more precisely per pageGroup) some other are static for the QtWebKit instance. I think the function that initializes persistent directory for all persistent features needs to be static. Also I would like to highlight that most of these persistent features - once enabled - can not be easily turned off. The test case that I proposed in https://bugs.webkit.org/show_bug.cgi?id=28836 highlight some of the specifics of the problem. I would propose that we "position" this API as some sort of initialization API that is expected to be called only once of a lifetime of a QtWebKit instance. In fact we might want to actually enforce that so the function is a no-op for all the subsequent calls - as far as I can tell most of all the other WebKit ports already behave that way.
Laszlo Gombos
Comment 4 2009-09-03 12:56:00 PDT
Created attachment 39003 [details] second try Filled out ChangeLog properly as Simon indicated this API looks quite good already. I'm not sure if this needs a test case as this API does not add new functionality. It is merely a convenience function that server a use-case that most QtWebKit client would want - that is to enable all persistent features.
Ariya Hidayat
Comment 5 2009-09-04 06:33:16 PDT
Comment on attachment 39003 [details] second try Looks good, except that we need a unit test (no matter how simple it is). It's a matter of checking all settings before calling enablePersistentStorage, and then checking everything again after. Sanity checks only, but hey, it's better to do it than to regret it later :) r- until the test is added.
Laszlo Gombos
Comment 6 2009-09-04 14:15:50 PDT
Created attachment 39090 [details] 3rd. try Added autotest as requested by Eric and Ariya.
Simon Hausmann
Comment 7 2009-09-08 03:33:01 PDT
Comment on attachment 39090 [details] 3rd. try r=me > +++ WebKit/qt/QtLauncher/main.cpp (working copy) > @@ -443,7 +443,7 @@ int main(int argc, char **argv) > > QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); > QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); > - QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true); > + QWebSettings::globalSettings()->enablePersistentStorage(); > > @@ -152,6 +151,7 @@ DumpRenderTree::DumpRenderTree() > , m_notifier(0) > { > qt_drt_overwritePluginDirectories(); > + QWebSettings::globalSettings()->enablePersistentStorage(); > > m_controller = new LayoutTestController(this); > connect(m_controller, SIGNAL(done()), this, SLOT(dump())); When landing, please change these to use QWebSettings::enablePersistentStorage() instead of QWebSettings::globalSettings()->enablePersistentStorage(). One could argue that DumpRenderTree should not share the persistent storage files/path with the default browser location, to avoid possible side-effects (towards either side :). But that's a minor detail :)
Laszlo Gombos
Comment 8 2009-09-08 06:29:07 PDT
Note You need to log in before you can comment on or make changes to this bug.