Merge lp:~phablet-team/webbrowser-app/OTA-15 into lp:~phablet-team/webbrowser-app/OTA-14-vivid

Proposed by Olivier Tilloy on 2017-01-24
Status: Merged
Merged at revision: 1529
Proposed branch: lp:~phablet-team/webbrowser-app/OTA-15
Merge into: lp:~phablet-team/webbrowser-app/OTA-14-vivid
Diff against target: 250 lines (+107/-42)
8 files modified
CMakeLists.txt (+0/-5)
debian/changelog (+11/-0)
debian/control (+1/-2)
src/Ubuntu/CMakeLists.txt (+0/-8)
src/Ubuntu/Web/UbuntuWebContext.qml (+7/-1)
src/Ubuntu/Web/ua-overrides-desktop.js.in (+43/-14)
src/Ubuntu/Web/ua-overrides-mobile.js.in (+39/-12)
tests/unittests/qml/CMakeLists.txt (+6/-0)
To merge this branch: bzr merge lp:~phablet-team/webbrowser-app/OTA-15
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team 2017-01-24 Pending
Review via email: mp+315484@code.launchpad.net

Commit message

* Replace chromium version in UA overrides at runtime, not at build time (LP: #1599695)
* Complete overhaul of UA overrides.
* Add UA overrides for Google+ (LP: #1656310)
* Add a UA override for Ebay (LP: #1575780)

To post a comment you must log in.
1532. By Olivier Tilloy on 2017-01-25

Add a UA override for appear.in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-07-01 13:09:27 +0000
3+++ CMakeLists.txt 2017-01-25 13:24:58 +0000
4@@ -11,11 +11,6 @@
5 if(NOT INTLTOOL_EXTRACT)
6 message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package")
7 endif()
8-find_program(XVFBRUN xvfb-run)
9-if(NOT XVFBRUN)
10- message(FATAL_ERROR "Could not find xvfb-run, please install the xvfb package")
11-endif()
12-set(XVFB_COMMAND ${XVFBRUN} -s "-screen 0 640x480x24" -a)
13
14 # Standard install paths
15 include(GNUInstallDirs)
16
17=== modified file 'debian/changelog'
18--- debian/changelog 2017-01-13 18:34:37 +0000
19+++ debian/changelog 2017-01-25 13:24:58 +0000
20@@ -1,3 +1,14 @@
21+webbrowser-app (0.23+15.04.20170125-0ubuntu1) UNRELEASED; urgency=medium
22+
23+ * Replace chromium version in UA overrides at runtime,
24+ not at build time (LP: #1599695)
25+ * Complete overhaul of UA overrides.
26+ * Add UA overrides for Google+ (LP: #1656310)
27+ * Add a UA override for Ebay (LP: #1575780)
28+ * Add a UA override for appear.in (LP: #1659288)
29+
30+ -- Olivier Tilloy <olivier.tilloy@canonical.com> Wed, 25 Jan 2017 14:23:38 +0100
31+
32 webbrowser-app (0.23+15.04.20160825-0ubuntu1) vivid; urgency=medium
33
34 [ Florian Boucault ]
35
36=== modified file 'debian/control'
37--- debian/control 2016-08-25 09:52:00 +0000
38+++ debian/control 2017-01-25 13:24:58 +0000
39@@ -11,7 +11,7 @@
40 dh-translations,
41 libapparmor-dev,
42 libevdev-dev,
43- liboxideqt-qmlplugin (>= 1.15),
44+ liboxideqt-qmlplugin (>= 1.12),
45 libqt5sql5-sqlite,
46 libudev-dev,
47 lsb-release,
48@@ -23,7 +23,6 @@
49 qml-module-qtquick2 (>= 5.4),
50 qml-module-qtquick-layouts,
51 qml-module-qttest,
52- qmlscene,
53 qt5-default,
54 qt5-qmake,
55 qtbase5-dev (>= 5.4),
56
57=== modified file 'src/Ubuntu/CMakeLists.txt'
58--- src/Ubuntu/CMakeLists.txt 2016-07-01 13:06:40 +0000
59+++ src/Ubuntu/CMakeLists.txt 2017-01-25 13:24:58 +0000
60@@ -23,13 +23,5 @@
61 OUTPUT_VARIABLE UBUNTU_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
62 add_definitions(-DUBUNTU_VERSION="${UBUNTU_VERSION}")
63
64-execute_process(COMMAND ${XVFB_COMMAND} qmlscene --quit ${CMAKE_CURRENT_SOURCE_DIR}/chromium-version.qml
65- OUTPUT_VARIABLE CHROMIUM_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
66-string(REGEX MATCH "\\[(.*)\\]" _ ${CHROMIUM_VERSION})
67-set(CHROMIUM_VERSION ${CMAKE_MATCH_1})
68-if(NOT CHROMIUM_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$")
69- message(FATAL_ERROR "Invalid chromium version: '${CHROMIUM_VERSION}'")
70-endif()
71-
72 add_subdirectory(Components)
73 add_subdirectory(Web)
74
75=== modified file 'src/Ubuntu/Web/UbuntuWebContext.qml'
76--- src/Ubuntu/Web/UbuntuWebContext.qml 2016-06-14 18:49:01 +0000
77+++ src/Ubuntu/Web/UbuntuWebContext.qml 2017-01-25 13:24:58 +0000
78@@ -88,7 +88,13 @@
79 }
80 if (temp !== null) {
81 console.log("Loaded %1 UA override(s) from %2".arg(temp.overrides.length).arg(Qt.resolvedUrl(script)))
82- userAgentOverrides = temp.overrides
83+ var chromiumVersion = Oxide.Oxide.chromiumVersion
84+ var overrides = []
85+ for (var o in temp.overrides) {
86+ var override = temp.overrides[o]
87+ overrides.push([override[0], override[1].replace(/\$\{CHROMIUM_VERSION\}/g, chromiumVersion)])
88+ }
89+ userAgentOverrides = overrides
90 temp.destroy()
91 }
92 }
93
94=== modified file 'src/Ubuntu/Web/ua-overrides-desktop.js.in'
95--- src/Ubuntu/Web/ua-overrides-desktop.js.in 2016-08-19 10:10:12 +0000
96+++ src/Ubuntu/Web/ua-overrides-desktop.js.in 2017-01-25 13:24:58 +0000
97@@ -1,5 +1,5 @@
98 /*
99- * Copyright 2014-2016 Canonical Ltd.
100+ * Copyright 2014-2017 Canonical Ltd.
101 *
102 * This file is part of webbrowser-app.
103 *
104@@ -18,18 +18,47 @@
105
106 .pragma library
107
108+// Note: when changing the value of this variable, all domains which
109+// use it must be carefully tested to ensure no regression.
110+var chrome_desktop_override = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/${CHROMIUM_VERSION} Chrome/${CHROMIUM_VERSION} Safari/537.36";
111+
112 var overrides = [
113- ["^https?:\/\/(www\.)?google\.com\/calendar", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chromium/@CHROMIUM_VERSION@ Chrome/@CHROMIUM_VERSION@ Safari/537.36"],
114- ["^http:\/\/chrome\.angrybirds\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"], // http://pad.lv/1284158
115- ["^https?:\/\/(www\.)?youtube\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"], // http://pad.lv/1412880
116- ["^https?:\/\/(www\.)?google\..+\/maps", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"], // http://pad.lv/1503506, http://pad.lv/1551649
117- ["^https?:\/\/mail\.google\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"], // http://pad.lv/1452616
118-
119- // Google hangouts (https://launchpad.net/bugs/1565055)
120- ["^https?:\/\/hangouts\.google\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"],
121- ["^https?:\/\/talkgadget\.google\.com\/hangouts\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"],
122- ["^https?:\/\/plus\.google\.com\/hangouts\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"],
123-
124- // Google recaptcha (https://launchpad.net/bugs/1599146)
125- ["^https:\/\/www\.google\.com\/recaptcha\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"],
126+ // Google calendar
127+ ["^https:\/\/calendar\.google\.com\/", chrome_desktop_override],
128+ ["^https:\/\/.+\.google\.com\/calendar\/", chrome_desktop_override],
129+
130+ // Youtube (https://launchpad.net/bugs/1412880)
131+ ["^https:\/\/(www\.)?youtube\.com\/", chrome_desktop_override],
132+
133+ // Google maps (https://launchpad.net/bugs/1503506, https://launchpad.net/bugs/1551649)
134+ ["^https:\/\/(www\.)?google\..+\/maps", chrome_desktop_override],
135+
136+ // Gmail (https://launchpad.net/bugs/1452616)
137+ ["^https:\/\/mail\.google\.com\/", chrome_desktop_override],
138+
139+ // Google docs (https://launchpad.net/bugs/1643386)
140+ ["^https:\/\/(docs|drive)\.google\.com\/", chrome_desktop_override],
141+
142+ // Google plus (https://launchpad.net/bugs/1656310)
143+ ["^https:\/\/plus\.google\.com\/", chrome_desktop_override],
144+
145+ // Google hangouts (https://launchpad.net/bugs/1565055)
146+ ["^https:\/\/hangouts\.google\.com\/", chrome_desktop_override],
147+ ["^https:\/\/talkgadget\.google\.com\/hangouts\/", chrome_desktop_override],
148+ ["^https:\/\/plus\.google\.com\/hangouts\/", chrome_desktop_override],
149+
150+ // Google recaptcha (https://launchpad.net/bugs/1599146)
151+ ["^https:\/\/www\.google\.com\/recaptcha\/", chrome_desktop_override],
152+
153+ // (mobile) twitter (https://launchpad.net/bugs/1577834)
154+ ["^https:\/\/mobile\.twitter\.com\/", chrome_desktop_override],
155+
156+ // meet.jit.si (https://launchpad.net/bugs/1635971)
157+ ["^https:\/\/meet\.jit\.si\/", chrome_desktop_override],
158+
159+ // ESPN websites (https://launchpad.net/bugs/1637285)
160+ ["^https?:\/\/(.+\.)?espn(fc)?\.co(m|\.uk)\/", chrome_desktop_override],
161+
162+ // Ebay (https://launchpad.net/bugs/1575780)
163+ ["^https?:\/\/(.+\.)?ebay\.(at|be|ca|ch|cn|co\.jp|co\.th|co\.uk|com|com\.au|com\.hk|com\.my|com\.sg|com\.tw|de|es|fr|ie|in|it|nl|ph|pl|se|vn)\/", chrome_desktop_override],
164 ];
165
166=== modified file 'src/Ubuntu/Web/ua-overrides-mobile.js.in'
167--- src/Ubuntu/Web/ua-overrides-mobile.js.in 2016-08-19 10:10:12 +0000
168+++ src/Ubuntu/Web/ua-overrides-mobile.js.in 2017-01-25 13:24:58 +0000
169@@ -1,5 +1,5 @@
170 /*
171- * Copyright 2014-2016 Canonical Ltd.
172+ * Copyright 2014-2017 Canonical Ltd.
173 *
174 * This file is part of webbrowser-app.
175 *
176@@ -18,19 +18,46 @@
177
178 .pragma library
179
180+// Note: when changing the values of these variables, all domains which
181+// use them must be carefully tested to ensure no regression.
182+var android_no_device_override = "Mozilla/5.0 (Linux; Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
183+var nexus5_override = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
184+var ubuntu_like_android_override = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
185+var no_android_token = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
186+
187 var overrides = [
188- ["^https?:\/\/mail\.google\.com\/", "Mozilla/5.0 (Linux; Android 5.0;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"], // http://pad.lv/1375889
189- ["^https?:\/\/(www|m)\.youtube\.com\/", "Mozilla/5.0 (Linux; Android 5.0;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"], // http://pad.lv/1228415, http://pad.lv/1415107, http://pad.lv/1417258, http://pad.lv/1499394, http://pad.lv/1408760, http://pad.lv/1437485
190- ["^http:\/\/chrome\.angrybirds\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"], // http://pad.lv/1284158
191- ["^https?:\/\/(\w+\.)*hsbc\.com\.br\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"], // http://pad.lv/1380657
192- ["^http:\/\/(\w+\.)*espn\.(go\.)?com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"], // http://pad.lv/1316259
193- ["^https?:\/\/(www|m)\.facebook\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"], // http://pad.lv/1538056, http://pad.lv/1457661
194- ["^https?:\/\/(mobile\.)?nytimes\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"], // http://pad.lv/1573620
195+ // Youtube (https://launchpad.net/bugs/1228415, https://launchpad.net/bugs/1415107, https://launchpad.net/bugs/1417258, https://launchpad.net/bugs/1499394, https://launchpad.net/bugs/1408760, https://launchpad.net/bugs/1437485)
196+ ["^https:\/\/(www|m)\.youtube\.com\/", android_no_device_override],
197+
198+ // Gmail (https://launchpad.net/bugs/1375889)
199+ ["^https:\/\/mail\.google\.com\/", android_no_device_override],
200+
201+ // Google plus (https://launchpad.net/bugs/1656310)
202+ ["^https:\/\/plus\.google\.com\/", ubuntu_like_android_override],
203+
204 // Google hangouts (https://launchpad.net/bugs/1565055)
205- ["^https?:\/\/hangouts\.google\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"],
206- ["^https?:\/\/talkgadget\.google\.com\/hangouts\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"],
207- ["^https?:\/\/plus\.google\.com\/hangouts\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Mobile Safari/537.36"],
208+ ["^https:\/\/hangouts\.google\.com\/", ubuntu_like_android_override],
209+ ["^https:\/\/talkgadget\.google\.com\/hangouts\/", ubuntu_like_android_override],
210+ ["^https:\/\/plus\.google\.com\/hangouts\/", ubuntu_like_android_override],
211
212 // Google recaptcha (https://launchpad.net/bugs/1599146)
213- ["^https:\/\/www\.google\.com\/recaptcha\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/@CHROMIUM_VERSION@ Safari/537.36"],
214+ ["^https:\/\/www\.google\.com\/recaptcha\/", ubuntu_like_android_override],
215+
216+ // Facebook (https://launchpad.net/bugs/1538056, https://launchpad.net/bugs/1457661)
217+ ["^https:\/\/(www|m)\.facebook\.com\/", nexus5_override],
218+
219+ // Twitter (https://launchpad.net/bugs/1577834)
220+ ["^https:\/\/mobile\.twitter\.com\/", no_android_token],
221+
222+ // meet.jit.si (https://launchpad.net/bugs/1635971)
223+ ["^https:\/\/meet\.jit\.si\/", ubuntu_like_android_override],
224+
225+ // ESPN websites (https://launchpad.net/bugs/1316259)
226+ ["^http:\/\/(\w+\.)*espn\.(go\.)?com\/", ubuntu_like_android_override],
227+
228+ // New York Times (https://launchpad.net/bugs/1573620)
229+ ["^https?:\/\/(mobile\.)?nytimes\.com\/", nexus5_override],
230+
231+ // appear.in (https://launchpad.net/bugs/1659288)
232+ ["^https:\/\/appear\.in\/", no_android_token],
233 ];
234
235=== modified file 'tests/unittests/qml/CMakeLists.txt'
236--- tests/unittests/qml/CMakeLists.txt 2016-07-01 12:51:45 +0000
237+++ tests/unittests/qml/CMakeLists.txt 2017-01-25 13:24:58 +0000
238@@ -6,6 +6,12 @@
239 find_package(Qt5QuickTest REQUIRED)
240 find_package(Qt5Sql REQUIRED)
241
242+find_program(XVFBRUN xvfb-run)
243+if(NOT XVFBRUN)
244+ message(FATAL_ERROR "Could not find xvfb-run, please install the xvfb package")
245+endif()
246+set(XVFB_COMMAND ${XVFBRUN} -s "-screen 0 640x480x24" -a)
247+
248 set(TEST tst_QmlTests)
249 set(SOURCES
250 ${webbrowser-common_SOURCE_DIR}/favicon-fetcher.cpp

Subscribers

People subscribed via source and target branches

to all changes: