Merge lp:~osomon/webbrowser-app/cacheLocation into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 912
Merged at revision: 920
Proposed branch: lp:~osomon/webbrowser-app/cacheLocation
Merge into: lp:webbrowser-app
Diff against target: 83 lines (+21/-2)
2 files modified
src/Ubuntu/Web/UbuntuWebContext.qml (+2/-1)
src/Ubuntu/Web/plugin.cpp (+19/-1)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/cacheLocation
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+250730@code.launchpad.net

Commit message

Specify the cache path on the web context, to avoid caching data under ~/.local/share/.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

What about existing cache data in .local/share? How will users get rid of that?

Revision history for this message
Olivier Tilloy (osomon) wrote :

Good point, I’ll add some code to purge it on startup.

912. By Olivier Tilloy

Purge the old cache data that was previously written to the data location.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Web/UbuntuWebContext.qml'
2--- src/Ubuntu/Web/UbuntuWebContext.qml 2014-11-28 17:49:22 +0000
3+++ src/Ubuntu/Web/UbuntuWebContext.qml 2015-02-26 10:13:52 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright 2014 Canonical Ltd.
7+ * Copyright 2014-2015 Canonical Ltd.
8 *
9 * This file is part of webbrowser-app.
10 *
11@@ -22,6 +22,7 @@
12 Oxide.WebContext {
13 readonly property string defaultUserAgent: __ua.defaultUA
14
15+ cachePath: cacheLocation
16 dataPath: dataLocation
17 userAgent: defaultUserAgent
18
19
20=== modified file 'src/Ubuntu/Web/plugin.cpp'
21--- src/Ubuntu/Web/plugin.cpp 2014-11-26 10:38:23 +0000
22+++ src/Ubuntu/Web/plugin.cpp 2015-02-26 10:13:52 +0000
23@@ -1,5 +1,5 @@
24 /*
25- * Copyright 2013-2014 Canonical Ltd.
26+ * Copyright 2013-2015 Canonical Ltd.
27 *
28 * This file is part of webbrowser-app.
29 *
30@@ -34,6 +34,7 @@
31 {
32 Q_OBJECT
33
34+ Q_PROPERTY(QString cacheLocation READ cacheLocation NOTIFY cacheLocationChanged)
35 Q_PROPERTY(QString dataLocation READ dataLocation NOTIFY dataLocationChanged)
36 Q_PROPERTY(QString formFactor READ formFactor CONSTANT)
37 Q_PROPERTY(QString webviewDevtoolsDebugHost READ devtoolsHost CONSTANT)
38@@ -43,6 +44,7 @@
39 public:
40 UbuntuWebPluginContext(QObject* parent = 0);
41
42+ QString cacheLocation() const;
43 QString dataLocation() const;
44 QString formFactor();
45 QString devtoolsHost();
46@@ -50,6 +52,7 @@
47 QStringList hostMappingRules();
48
49 Q_SIGNALS:
50+ void cacheLocationChanged() const;
51 void dataLocationChanged() const;
52
53 private:
54@@ -66,14 +69,29 @@
55 , m_hostMappingRulesQueried(false)
56 {
57 connect(QCoreApplication::instance(), SIGNAL(applicationNameChanged()),
58+ this, SIGNAL(cacheLocationChanged()));
59+ connect(QCoreApplication::instance(), SIGNAL(applicationNameChanged()),
60 this, SIGNAL(dataLocationChanged()));
61 }
62
63+QString UbuntuWebPluginContext::cacheLocation() const
64+{
65+ QDir location(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
66+ if (!location.exists()) {
67+ QDir::root().mkpath(location.absolutePath());
68+ }
69+ return location.absolutePath();
70+}
71+
72 QString UbuntuWebPluginContext::dataLocation() const
73 {
74 QDir location(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
75 if (!location.exists()) {
76 QDir::root().mkpath(location.absolutePath());
77+ } else {
78+ // Prior to fixing https://launchpad.net/bugs/1424726, chromium’s cache
79+ // data was written to the data location. Purge the old cache data.
80+ QDir(location.absoluteFilePath("Cache")).removeRecursively();
81 }
82 return location.absolutePath();
83 }

Subscribers

People subscribed via source and target branches

to status/vote changes: