Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store form data in sessions #4813

Open
jamespharvey20 opened this issue May 28, 2019 · 5 comments
Open

Store form data in sessions #4813

jamespharvey20 opened this issue May 28, 2019 · 5 comments
Labels
priority: 1 - middle Issues which should be done at some point, but aren't that important.

Comments

@jamespharvey20
Copy link

jamespharvey20 commented May 28, 2019

After a simulated crash (kill -9) qute automatically restores my last session. But, if I was editing a form and hadn't submitted it, it doesn't recover the data. It loads the page fresh, with the original data from the server.

Firefox and chromium both support this. Opera (at least by default, not sure if there's a way) doesn't.

I realize not everyone would want this, so I'd definitely propose that it be a setting.

I asked in IRC if I missed a way to do this, or if I should open a feature request, and others said:

jgkamat | I don't think we can do it so it will probably just be closed but sure
jgkamat | we would need to get the form data from qtwebengine/webkit, and to do that we would either need to get it from the backend or inject some js to get it. And once we get it, we need to stick it into the sessions file which is really badly formatted atm
jgkamat | actually, it's possible the form data is stored in the webenginehistory object, so maybe if we just used that instead of the custom thing we would get this for free http://doc.qt.io/qt-5/qwebenginehistory.html
toofar | Where does it say the form data is stored in there?
jgkamat | I'm just assuming it's in there because undo saves/restores using it and undo saves form data
jgkamat | anyway, if that's changed it will cause all the plain-text purists to come out of the woodwork again so that's probably not going to happen either :P

Fingers crossed that it's added rather than closed. :-) For me, I can't use a browser that doesn't do this. I try not to, but I have unsaved data too often (private wiki) and thanks to AMD, my system crashes about once a week. I hate that feeling of "what did i just lose?"

@user202729
Copy link
Contributor

About "plain text purists": but it feels weird that we reimplement all the Qt internal just to convert the data to/from text. Isn't it a better way to just let Qt handle it, and provide the converter as an external tool (or a qutebrowser command) for users wanting to view them as text?


note 1. Yes, QWebEngineHistory does store the form data. http://0x0.st/zagj.py
note 2. This is unrelated but for some reason it's impossible to open a data: URL containing space.
note 3. The extra Q in this line of code quite significantly changes the meaning.

@The-Compiler
Copy link
Member

The-Compiler commented May 28, 2019

About "plain text purists": but it feels weird that we reimplement all the Qt internal just to convert the data to/from text. Isn't it a better way to just let Qt handle it, and provide the converter as an external tool (or a qutebrowser command) for users wanting to view them as text?

Having sessions in plain text isn't really a feature I'd want to give up - it's quite useful when e.g. one of the pages being restored causes QtWeb{Kit,Engine} to crash, or to track sessions in git repos, etc.

I'd say I'm rather pragmatic - if there's a clear benefit from having things in a binary format, and it's a format which is still user-viewable and editable (say, the sqlite history), I think having that binary is definitely a good idea. Here, it's in a Chromium-internal format, and if we need converter code anyways, why not store it as text in the first place?

edit: Also, storing it in a binary format would make it impossible to save a session with QtWebEngine and load it with QtWebKit or vice-versa.

note 1. Yes, QWebEngineHistory does store the form data. http://0x0.st/zagj.py

Interesting! Should be possible to add that to session files as well, I guess?

Repost because I've seen various pastebin services go down over the years: https://paste.the-compiler.org/view/09429b49

note 2. This is unrelated but for some reason it's impossible to open a data: URL containing space.

Is that space properly urlencoded? Also, why not just use setHtml?

note 3. The extra Q in this line of code quite significantly changes the meaning.

Well spotted! I'll push a fix.

@The-Compiler The-Compiler added the priority: 1 - middle Issues which should be done at some point, but aren't that important. label May 28, 2019
@The-Compiler The-Compiler changed the title Feature: Add a way to recover form data after crash Store form data in sessions May 28, 2019
@user202729
Copy link
Contributor

Because currently the converter code loses data.

(In this case because it's preferable to have the data in plain text format, the best way would be to write some code to convert between the types. However the data might be lost when transferred between webengine and webkit)

Is that space properly urlencoded? Also, why not just use setHtml?

Yes, I did use %20 instead of space. (By the way, I was talking about qutebrowser, not the example program)

@The-Compiler
Copy link
Member

Yes, I did use %20 instead of space. (By the way, I was talking about qutebrowser, not the example program)

Probably #2429.

@The-Compiler
Copy link
Member

#5359 is probably going to fix this as well FWIW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: 1 - middle Issues which should be done at some point, but aren't that important.
Projects
None yet
Development

No branches or pull requests

3 participants