← Back to team overview

ubuntu-phone team mailing list archive

Re: Persisting cookies in Oxide

 

On Wed, Jul 16, 2014 at 7:04 AM, Robert Schroll <rschroll@xxxxxxxxx> wrote:

> On Tue, Jul 15, 2014 at 8:26 PM, Alexandre Abreu <
> alexandre.abreu@xxxxxxxxxxxxx> wrote:
>
>> There might be a few reasons for that. Are you directly using the
>> Oxide.WebView or do you use it through the Ubuntu.Web.UbuntuWebView
>> component?
>>
>
> I'm using the Oxide.WebView directly, since I need to set some custom user
> scripts.
>
>
>  If you are directly using the Oxide.WebView you might not have set the
>> dataPath for the WebContext of the Oxide WebView. Unless things have
>> changed, an empty dataPath means that the cookies/data resources are not
>> persisted,
>>
>
> That seems to have done it.  I already have a C++ module that returns
> QStandardPaths::DataLocation (amongst other things), so I could replicate
> the behavior of the UbuntuWebView easily enough.
>
> Do you know if it's possible to make Oxide read the cookies stored by
> QtWebKit?  If so, does anyone know where QtWebKit stored its cookies?


There’s not code readily available in oxide to import QtWebKit cookies, but
I guess you could write some if you really need to.
QtWebKit stores its cookies under $dataLocation/.QtWebKit/cookies.db, in an
sqlite database.
You might want to take a look at the "*cookie-store.[h|cpp]" files under
http://bazaar.launchpad.net/~phablet-team/webbrowser-app/trunk/files/head:/src/app/webcontainer/,
it has some logic to read/write cookies from/to QtWebKit and Chromium.


 Also although less likely since the above might put your in the right
>> direction, you might want to play with the sessionCookieMode of the
>> WebContext associated with your Oxide webview and set it to WebContext.
>> SessionCookieModePersistent.
>>
>
> It seems to work, even though sessionCookieMode is set to
> SessionCookieModeEphemeral.  Is this expected?  Should I change it to
> Persistent to be safe in the future?
>

See
https://code.google.com/p/chromium/codesearch#chromium/src/content/public/browser/cookie_store_factory.h&q=SessionCookieMode&sq=package:chromium&l=42
for an explanation of what the various values for SessionCookieMode mean.


I don't know if this is relevant to my issue, but I get these messages on
> the console, regardless of whether I'm setting the WebContext properties:
>
>> Cannot set WebContext.sessionCookieMode once the context is in use
>> Cannot set WebContext.dataPath once the context is in use
>>
> I have no idea what code is causing this, but I'm pretty sure it's not
> anything I'm doing.
>

That looks similar to https://bugs.launchpad.net/webbrowser-app/+bug/1324855,
the fact that you’re not using Ubuntu.Web seems to suggest the issue is in
oxide itself, would you mind commenting on the bug report to explain how
beru is also affected?

Cheers,

 Olivier

>

Follow ups

References