-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add command option to control enable/disable local storage #404
Add command option to control enable/disable local storage #404
Conversation
This definitely needs to be revised as a LocalStorage config shouldn't control the IndexedDB and AppCache settings. You should add additional flags for those if need be. |
I can set additional flags for LocalStorage, IndexedDB, AppCache respectively. And i suggest to add a new config option to disable any disk write actions thoroughly. will it make sense? |
Do you mean add a new config option that sets all of the various configs that control writing to disk (HTTP cache, LocalStorage, IndexedDB, and AppCache)? If so, I think that could be a handy config for those running PhantomJS on a system with limited resources. I would also suggest that you follow the existing naming pattern for the LocalStorage config options for the other new ones (IndexedDB and AppCache):
I think I'm also going to file an issue to update the config names for "disk-cache" and "disk-cache-max-size" to more closely align... probably change them to "http-cache" and "http-cache-quota" (but leave the other name around for a release or two to deprecate it). |
I will update a proposal commit soon which including the proposal naming. |
I'll take care of |
So how long will you merge my commits or take a new grace way to let we can control appcache or indexeddb respectively? I'm waiting this. :). |
If you mean "when would my changes be available in an official binary", then the answer is March 20th (in the 1.9 release). Till then, of course, you can easily build it yourself but hopefully you already knew that since you submitted a PR and edited the build script. :) |
Ugh, this will need further review.... didn't realize there was some weird relationship between offlineStorage and localStorage for their disk quota (and possibly more). @ariya @detro @vitallium Any knowledge on this WebKit oddity? |
Please combine it into just one commit. Also, what's that |
@JamesMGreene I referenced those comments in the file qwebsettings.cpp, anyone else can help review the changed part? @ariya the change |
The change |
issue link:http:https://code.google.com/p/phantomjs/issues/detail?id=1055 Sometimes we need the ability to control whether to enable the local storage or not, especially when we want to build a large scraping system. Add AppCache, IndexedDb, LocalStorage command line control flags respectively. Still need to add a global flag to enable/disable the whole disk written actions.
@ariya @JamesMGreene I combined the two commits into this one 7a5d545 . reverted the change in file |
Looks good, let me give it a try and test it! |
So my main question remains: does WebKit not have a way to specify the default quota for LocalStorage, or does it also utilize the If it's the latter, do we need to sum any config value the users pass for |
@vitallium: Thanks for the info but... how can you tell that
|
|
I believe you're saying that |
Almost, |
Whoa, somehow I missed that HTML5 offers offline SQL database in addition to IndexedDB. That's... weird. o_O Ugh, so I think this PR is all messed up now, then. The options marked as "indexed-db" would need to be updated to "offline-db" (or something like that). So, @vitallium, does enabling LocalStorage also enable IndexedDB? Or is IndexedDB always on? Or does enabling "OfflineStorage" enable both local "offline-db" plus IndexedDB? This is getting really confusing. |
Yea, HTML 5 is do damn confusing :)
|
Yeah, I noticed |
According to @brianleroux, offline storage DBs are "essentially deprecated" from HTML5. As such, perhaps we should just remove those "offline-db_" (currently incorrectly marked as "indexed-db_") options altogether...? |
well, websql is probably not moving forward and indexeddb is favored, but the browsers will continue to support for a very long time to come |
@brianleroux: Why? 👎 Sounds like it was only ever half-baked to begin with, why keep it around? |
@JamesMGreene thats how this whole browser thing works! if a feature is shipped in a browser, used by many apps/sites, and then rescinded, the internet breaks. we don't want that. |
I understand that bit of it but it seems doubtful to me that WebSQL has prolific use on the web. Have browser vendors seen usage stats suggesting otherwise? 😕 |
frankly: yes. |
Alright, then I guess PhantomJS needs to stay on the bandwagon as well. |
There ya go, @RockLi, it's all yours if you can find the time this weekend. :) |
okey, I got it. |
@RockLi Any weekend update? |
@JamesMGreene haven't finished yet, will continue working on that these evenings, and send out new PR ASAP. |
Thank you, looking forward to it! |
I tried building with this patch applied, but still get Gist: https://gist.github.com/johanlunds/5911808 Working in browser. Running in terminal with
|
Okay, I simplified the test a bit. Gist: https://gist.github.com/johanlunds/5912015. Running with
|
@johanlunds IndexedDB is disabled by default in QtWebkit. |
But the patch has it on by default. On Tue, Jul 2, 2013 at 9:27 PM, Vitaliy Slobodin [email protected]
|
@johanlunds do you mean this pull request? It's incorrect. |
Do you mean the patch or my interpretation of the code is incorrect? What command should I invoke then? I have read the comments in this PR and I think I've understood them. |
I'm talking about the patch. Support for IndexedDB is disabled by default. You can't enable it using this patch. As a side note: IndexedDB disabled because it's broken in the current Webkit version. |
Okay, thanks. Do you have any helpful pointers if I would like to investigate writing my own patch? To be clear: What I'm after is a fix to enable IndexedDb support in PhantomJS. |
@johanlunds Well, it's complicated. In the current Webkit version some features are designed as modules (http:https://trac.webkit.org/browser/trunk/Source/WebCore/Modules/) IndexedDB is one of them (http:https://trac.webkit.org/browser/trunk/Source/WebCore/Modules/indexeddb). To enable IndexedDB, you need to backport it. I don't think this is even possible, because you'd need to resolve a lot of references or write some code from scratch.
|
That's what I started to realize after doing some quick research on QTWebKit. That's too bad. This is probably way too big of an undertaking for me (and too difficult). |
@RockLi has error in the branch. Nor enabling and disabling of AppCache, LocalStorage and indexedDB via cli args will not work. A small patch below. diff --git a/src/config.cpp b/src/config.cpp
index 95a93a0..1a4600c 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -650,6 +650,9 @@ void Config::handleOption(const QString &option, const QVariant &value)
booleanFlags << "local-to-remote-url-access";
booleanFlags << "remote-debugger-autorun";
booleanFlags << "web-security";
+ booleanFlags << "appcache";
+ booleanFlags << "indexed-db";
+ booleanFlags << "local-storage";
if (booleanFlags.contains(option)) {
if ((value != "true") && (value != "yes") && (value != "false") && (value != "no")) {
setUnknownOption(QString("Invalid values for '%1' option.").arg(option)); Also I'm trying to change location of indexedDB ( |
@WoZ IndexedDB is disabled by default. And QtWebkit doesn't provide you an API to change the IndexedDB path. |
@vitallium What does http:https://qt-project.org/doc/qt-4.8/qwebsettings.html#setOfflineStoragePath do? Does it affect indexedDB and WebSQL? |
@WoZ This option is only for HTML5 Local Storage and WebSQL. And it doesn't affect IndexedDB. |
@WoZ @vitallium Sorry, I'm no expert but I did some research (see comments Mvh, On Fri, Jul 19, 2013 at 5:02 PM, Vitaliy Slobodin
|
@vitallium My tests give me another info.
|
+1 |
BUMP |
+1 |
Closing this one because it's invalid and old. Will be implemented later. |
Issue link: #11055
Sometimes we need the ability to control whether to enable the local storage or not, especially when we want to build a large scraping system.