Merge lp:~abreu-alexandre/webbrowser-app/enable-per-app-ua-override into lp:webbrowser-app

Proposed by Alexandre Abreu
Status: Merged
Merged at revision: 525
Proposed branch: lp:~abreu-alexandre/webbrowser-app/enable-per-app-ua-override
Merge into: lp:webbrowser-app
Diff against target: 137 lines (+36/-13)
5 files modified
src/app/webcontainer/WebApp.qml (+3/-1)
src/app/webcontainer/WebViewImplOxide.qml (+7/-1)
src/app/webcontainer/WebViewImplWebkit.qml (+5/-0)
src/app/webcontainer/WebappContainerWebview.qml (+18/-8)
src/app/webcontainer/webapp-container.cpp (+3/-3)
To merge this branch: bzr merge lp:~abreu-alexandre/webbrowser-app/enable-per-app-ua-override
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Olivier Tilloy Approve
Review via email: mp+216749@code.launchpad.net

Commit message

Add capability for single webapps to have specific UA overrides for the website that they serve

Description of the change

Add capability for single webapps to have specific UA overrides for the website that they serve,

Needs to be landed with this one:

https://code.launchpad.net/~abreu-alexandre/unity-webapps-qml/cleanup-and-fix-bindee-init/+merge/216750

To post a comment you must log in.
502. By Alexandre Abreu

Fix the network dialog reload Fixes: 1309138

503. By Alexandre Abreu

Oxide (and Chromium) does not inform of non user driven navigations (or more specifically redirects that would be part of an popup/webview load (after its been granted). Quite a few sites (e.g. Youtube), create popups when clicking on links (or following a window.open()) with proper youtube.com address but w/ redirection params, e.g.:
 http://www.youtube.com/redirect?q=http%3A%2F%2Fgodzillamovie.com%2F&redir_token=b8WPI1pq9FHXeHm2bN3KVLAJSfp8MTM5NzI2NDg3NEAxMzk3MTc4NDc0

In this instance the popup & navigation is granted, but then a redirect happens inside the popup to the real target url (here http://godzillamovie.com) which is not trapped by a navigation requested and therefore not filtered. The only way to do it atm is to listen to url changes in popups & also filter there. Fixes: 1294279

504. By PS Jenkins bot

Releasing 0.23+14.04.20140422-0ubuntu1

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:498
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/766/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4964
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/4221/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-amd64-ci/268
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/268
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/268/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-i386-ci/268
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4281
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5138
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5138/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4564
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4564/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6446/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6245

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/webbrowser-app-ci/766/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

119 +#include <QJsonDocument>
120 +#include <QJsonObject>

This looks unrelated (and unneeded), can it be removed?

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

30 + property string localUserAgentOverride
63 + property string localUserAgentOverride
79 + property string localUserAgentOverride

Can the default value of this property be explicitly set to "" ?
It would make sense, given that the getUAString function checks its length (and I’m not sure what the default value of a property is in QML if not explicitly defined, but in any case we shouldn’t rely on a behaviour that might change).

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

line 38 of the diff: s/overrided/overridden/

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

all done

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

LGTM.

review: Approve
505. By PS Jenkins bot

Resync trunk

506. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

507. By Alexandre Abreu

merge trunk

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 :

FAILED: Continuous integration, rev:507
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/796/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5220/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/4299
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-amd64-ci/298
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/298
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/298/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-i386-ci/298
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4487/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5445
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5445/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4885
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4885/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6527
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6725

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/webbrowser-app-ci/796/rebuild

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/app/webcontainer/WebApp.qml'
2--- src/app/webcontainer/WebApp.qml 2014-04-17 18:29:00 +0000
3+++ src/app/webcontainer/WebApp.qml 2014-04-30 01:44:12 +0000
4@@ -76,6 +76,8 @@
5 }
6 height: parent.height - osk.height
7 developerExtrasEnabled: webapp.developerExtrasEnabled
8+ localUserAgentOverride: webappName && unityWebapps.model.exists(webappName) ?
9+ unityWebapps.model.userAgentOverrideFor(webappName) : ""
10 }
11
12 ErrorSheet {
13@@ -91,7 +93,7 @@
14
15 PanelLoader {
16 id: panel
17- objectName: "panel"
18+ objectName: "panel"
19
20 currentWebview: webview.currentWebview
21 chromeless: webapp.chromeless
22
23=== modified file 'src/app/webcontainer/WebViewImplOxide.qml'
24--- src/app/webcontainer/WebViewImplOxide.qml 2014-04-18 15:46:34 +0000
25+++ src/app/webcontainer/WebViewImplOxide.qml 2014-04-30 01:44:12 +0000
26@@ -32,6 +32,7 @@
27 property bool developerExtrasEnabled: false
28 property var toolbar: null
29 property string webappName: ""
30+ property string localUserAgentOverride: ""
31 property var webappUrlPatterns: null
32
33 currentWebview: webview
34@@ -51,6 +52,11 @@
35 return formFactor !== "desktop";
36 }
37
38+ // Function defined by the UbuntuWebView and overridden here to handle potential webapp defined UA overrides
39+ function getUAString() {
40+ return webview.localUserAgentOverride.length === 0 ? undefined : webview.localUserAgentOverride
41+ }
42+
43 function isRunningAsANamedWebapp() {
44 return webview.webappName && typeof(webview.webappName) === 'string' && webview.webappName.length != 0
45 }
46@@ -76,7 +82,7 @@
47 // We still take the possible additional patterns specified in the command line
48 // (the in the case of finer grained ones specifically for the container and not
49 // as an 'install source' for the webapp).
50- if (webappUrlPatterns && webappUrlPatterns.length !== 0) {
51+ if (haveValidUrlPatterns()) {
52 for (var i = 0; i < webappUrlPatterns.length; ++i) {
53 var pattern = webappUrlPatterns[i]
54 if (url.match(pattern)) {
55
56=== modified file 'src/app/webcontainer/WebViewImplWebkit.qml'
57--- src/app/webcontainer/WebViewImplWebkit.qml 2014-03-28 15:42:34 +0000
58+++ src/app/webcontainer/WebViewImplWebkit.qml 2014-04-30 01:44:12 +0000
59@@ -34,6 +34,11 @@
60 property var toolbar: null
61 property string webappName: ""
62 property var webappUrlPatterns: null
63+ property string localUserAgentOverride: ""
64+
65+ function getUAString() {
66+ return webview.localUserAgentOverride.length === 0 ? undefined : webview.localUserAgentOverride
67+ }
68
69 experimental.certificateVerificationDialog: CertificateVerificationDialog {}
70 experimental.authenticationDialog: AuthenticationDialog {}
71
72=== modified file 'src/app/webcontainer/WebappContainerWebview.qml'
73--- src/app/webcontainer/WebappContainerWebview.qml 2014-04-10 18:45:42 +0000
74+++ src/app/webcontainer/WebappContainerWebview.qml 2014-04-30 01:44:12 +0000
75@@ -33,17 +33,27 @@
76 property var currentWebview: webappContainerWebViewLoader.item
77 property var toolbar: null
78 property var webappUrlPatterns
79+ property string localUserAgentOverride: ""
80
81 Loader {
82 id: webappContainerWebViewLoader
83 anchors.fill: parent
84- source: withOxide ? Qt.resolvedUrl("WebViewImplOxide.qml") : Qt.resolvedUrl("WebViewImplWebkit.qml")
85- onLoaded: {
86- webappContainerWebViewLoader.item.toolbar = containerWebview.toolbar
87- webappContainerWebViewLoader.item.url = containerWebview.url
88- webappContainerWebViewLoader.item.webappName = containerWebview.webappName
89- webappContainerWebViewLoader.item.webappUrlPatterns = containerWebview.webappUrlPatterns
90- webappContainerWebViewLoader.item.developerExtrasEnabled = containerWebview.developerExtrasEnabled
91- }
92+ }
93+
94+ Component.onCompleted: {
95+ var webappEngineSource =
96+ withOxide ?
97+ Qt.resolvedUrl("WebViewImplOxide.qml")
98+ : Qt.resolvedUrl("WebViewImplWebkit.qml");
99+
100+ webappContainerWebViewLoader.setSource(
101+ webappEngineSource,
102+ { toolbar: containerWebview.toolbar
103+ , localUserAgentOverride: containerWebview.localUserAgentOverride
104+ , url: containerWebview.url
105+ , webappName: containerWebview.webappName
106+ , webappUrlPatterns: containerWebview.webappUrlPatterns
107+ , developerExtrasEnabled: containerWebview.developerExtrasEnabled})
108 }
109 }
110+
111
112=== modified file 'src/app/webcontainer/webapp-container.cpp'
113--- src/app/webcontainer/webapp-container.cpp 2014-04-11 15:53:37 +0000
114+++ src/app/webcontainer/webapp-container.cpp 2014-04-30 01:44:12 +0000
115@@ -118,8 +118,8 @@
116 if (!urls.isEmpty()) {
117 m_window->setProperty("url", urls.first());
118 } else {
119- return false;
120- }
121+ return false;
122+ }
123 }
124
125 m_component->completeCreate();
126@@ -157,10 +157,10 @@
127 out << " --webapp=name try to match the webapp by name with an installed integration script" << endl;
128 out << " --webappModelSearchPath=PATH alter the search path for installed webapps and set it to PATH. PATH can be an absolute or path relative to CWD" << endl;
129 out << " --webappUrlPatterns=URL_PATTERNS list of comma-separated url patterns (wildcard based) that the webapp is allowed to navigate to" << endl;
130+ out << " --store-session-cookies store session cookies on disk" << endl;
131 out << "Chrome options (if none specified, no chrome is shown by default):" << endl;
132 out << " --enable-back-forward enable the display of the back and forward buttons" << endl;
133 out << " --enable-addressbar enable the display of the address bar" << endl;
134- out << " --store-session-cookies store session cookies on disk" << endl;
135 }
136
137 void WebappContainer::parseCommandLine()

Subscribers

People subscribed via source and target branches

to status/vote changes: