Bug 99445 - [Qt][WK2] REGRESSION(r131428): cookies.db created on wrong place
Summary: [Qt][WK2] REGRESSION(r131428): cookies.db created on wrong place
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 420+
Hardware: All All
: P2 Normal
Assignee: János Badics
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks: 89666
  Show dependency treegraph
 
Reported: 2012-10-16 03:26 PDT by Csaba Osztrogonác
Modified: 2012-10-26 01:24 PDT (History)
7 users (show)

See Also:


Attachments
proposed patch (1.37 KB, patch)
2012-10-25 07:00 PDT, János Badics
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Csaba Osztrogonác 2012-10-16 03:26:37 PDT
Everything created in the dir named /tmp/WebKitTestRunner-cQBEjz 
like this, but cookies.db is /tmp/WebKitTestRunner-cQBEjzcookies.db

It seems a slash is missing somewhere .
Comment 1 János Badics 2012-10-25 07:00:27 PDT
Created attachment 170638 [details]
proposed patch

There is a missing slash in CookieJarQt.cpp. I have added a slash there but I suppose that there would be some more elegant solutions because adding a slash directly doesn't look very professional.
Consider this patch as a first step
Comment 2 Simon Hausmann 2012-10-26 00:36:06 PDT
Comment on attachment 170638 [details]
proposed patch

Yeah, this patch comes from WK2's QtDefaultDataLocation.cpp, the QString defaultDataLocation() function in particular.

Now we do things like this in various places:

    s_defaultDatabaseDirectory = defaultDataLocation() + QLatin1String("Databases");

or

    defaultDataLocation() + QLatin1String("WebpageIcons.db");

or (as you spotted) cookieStoragePath + QLatin1String("/cookies.db"); where cookieStoragePath comes from the same function (through several levels of indirection).

I suggest to harden defaultDataLocation() instead and at the end of the function make sure that the path ends with a separator, i.e.

if (!s_dataLocation.endsWith(QDir::separator())
    s_dataLocation.append(QDir::separator());
Comment 3 Simon Hausmann 2012-10-26 00:38:22 PDT
Oh, but yeah this doesn't help in the WTR case when WTR sets properties like m_overrideLocalStorageDirectory
Comment 4 Simon Hausmann 2012-10-26 00:41:23 PDT
Comment on attachment 170638 [details]
proposed patch

Ok, so since this patch can also come directly through the WK2 C API we have to protect this end. I don't think a double-slash hurts, so let's go for this :)
Comment 5 János Badics 2012-10-26 01:02:39 PDT
(In reply to comment #4)
> (From update of attachment 170638 [details])
> Ok, so since this patch can also come directly through the WK2 C API we have to protect this end. I don't think a double-slash hurts, so let's go for this :)

Thank you for the comments, I'm looking into it.
Comment 6 WebKit Review Bot 2012-10-26 01:24:38 PDT
Comment on attachment 170638 [details]
proposed patch

Clearing flags on attachment: 170638

Committed r132583: <http://trac.webkit.org/changeset/132583>
Comment 7 WebKit Review Bot 2012-10-26 01:24:42 PDT
All reviewed patches have been landed.  Closing bug.