[Merge] lp:~mardy/webbrowser-app/clear-cookies into lp:webbrowser-app

David Barth david.barth at canonical.com
Fri Sep 26 13:42:23 UTC 2014



Diff comments:

> === modified file 'src/app/webcontainer/webapp-container.cpp'
> --- src/app/webcontainer/webapp-container.cpp	2014-08-26 07:15:22 +0000
> +++ src/app/webcontainer/webapp-container.cpp	2014-09-26 08:37:56 +0000
> @@ -49,6 +49,31 @@
>  namespace
>  {
>  
> +/* Hack to clear the local data of the webapp, when it's integrated with OA:
> + * https://bugs.launchpad.net/bugs/1371659
> + * This is needed because cookie sets from different accounts might not
> + * completely overwrite each other, and therefore we end up with an
> + * inconsistent cookie jar. */
> +static void clearCookiesHack(const QString &provider)
> +{
> +    if (provider.isEmpty()) {
> +        qWarning() << "--clear-cookies only works with an accountProvider" << endl;
> +        return;
> +    }
> +
> +    /* check both ~/.local/share and ~/.cache, as the data will eventually be
> +     * moving from the first to the latter.
> +     */
> +    QStringList baseDirs;
> +    baseDirs << QStandardPaths::writableLocation(QStandardPaths::DataLocation);
> +    baseDirs << QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
> +
> +    Q_FOREACH(const QString &baseDir, baseDirs) {
> +        QDir dir(baseDir);
> +        dir.removeRecursively();
> +    }
> +}

Yes, that's why i didn't want that to be a default, hardcoded behavior either.
And because erasing the cookies you are about to inject does not resolve the issue with Google. The app detects extra cookies (which are from the other account) and blocks here, considering that the code didn't succeed in de-logging the previous user.

> +
>  static QString currentArchitecturePathName()
>  {
>  #if defined(Q_PROCESSOR_X86_32)
> @@ -237,6 +262,9 @@
>              }
>          } else if (argument.startsWith("--accountProvider=")) {
>              m_accountProvider = argument.split("--accountProvider=")[1];
> +        } else if (argument == "--clear-cookies") {
> +            qWarning() << argument << " is an unsupported option: it can be removed without notice..." << endl;
> +            clearCookiesHack(m_accountProvider);
>          } else if (argument == "--store-session-cookies") {
>              m_storeSessionCookies = true;
>          } else if (argument == "--enable-back-forward") {
> 


-- 
https://code.launchpad.net/~mardy/webbrowser-app/clear-cookies/+merge/235754
Your team Ubuntu Phablet Team is subscribed to branch lp:webbrowser-app.



More information about the Ubuntu-reviews mailing list