Merge lp:~abreu-alexandre/webbrowser-app/webapp-properties-ua-override-fix-rtm-14.09 into lp:webbrowser-app/rtm-14.09

Proposed by Alexandre Abreu
Status: Rejected
Rejected by: Olivier Tilloy
Proposed branch: lp:~abreu-alexandre/webbrowser-app/webapp-properties-ua-override-fix-rtm-14.09
Merge into: lp:webbrowser-app/rtm-14.09
Diff against target: 67 lines (+12/-13)
2 files modified
src/app/webcontainer/WebApp.qml (+1/-12)
src/app/webcontainer/webapp-container.qml (+11/-1)
To merge this branch: bzr merge lp:~abreu-alexandre/webbrowser-app/webapp-properties-ua-override-fix-rtm-14.09
Reviewer Review Type Date Requested Status
Olivier Tilloy Disapprove
Review via email: mp+243834@code.launchpad.net

Commit message

A Webapp has the option to either specify a command line option to have a specific UA overriding the default or hgave a local webapp-properties.json file that defines the UA override such as:

{
    "name": "MyWebapp",
    "includes":["http://user-agent.me/*"],
    "domain":"user-agent.me",
    "homepage":"http://user-agent.me/",
    "user-agent-override": "Mozilla/5.0 custom-user-agent-string (unlike AnyOtheBrowser)"
}

This currently does not work, or to be more precise works but the url is set before during the init flow, and the UA string is being set after the website was browsed to.

Description of the change

Backport of

https://code.launchpad.net/~abreu-alexandre/webbrowser-app/fix-webapp-properties-ua-override/+merge/238991

Here is the description of the MR replicated:

"A Webapp has the option to either specify a command line option to have a specific UA overriding the default or hgave a local webapp-properties.json file that defines the UA override such as:

{
    "name": "MyWebapp",
    "includes":["http://user-agent.me/*"],
    "domain":"user-agent.me",
    "homepage":"http://user-agent.me/",
    "user-agent-override": "Mozilla/5.0 custom-user-agent-string (unlike AnyOtheBrowser)"
}

This currently does not work, or to be more precise works but the url is set before during the init flow, and the UA string is being set after the website was browsed to."

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Not needed any longer, as the entire trunk was backported to RTM.

review: Disapprove

Unmerged revisions

777. By Alexandre Abreu

BAckport webapp-properties.json UA override fix to RTM

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-11-10 17:08:15 +0000
3+++ src/app/webcontainer/WebApp.qml 2014-12-05 16:47:50 +0000
4@@ -38,7 +38,7 @@
5 property alias webappUrlPatterns: webview.webappUrlPatterns
6 property alias popupRedirectionUrlPrefix: webview.popupRedirectionUrlPrefix
7 property alias webviewOverrideFile: webview.webviewOverrideFile
8- property string localUserAgentOverride: ""
9+ property alias localUserAgentOverride: webview.localUserAgentOverride
10
11 property bool backForwardButtonsVisible: false
12 property bool chromeVisible: false
13@@ -58,16 +58,6 @@
14 }
15 ]
16
17- function getLocalUserAgentOverrideIfAny() {
18- if (localUserAgentOverride.length !== 0)
19- return localUserAgentOverride
20-
21- if (webappName && unityWebapps.model.exists(webappName))
22- return unityWebapps.model.userAgentOverrideFor(webappName)
23-
24- return ""
25- }
26-
27 Item {
28 anchors.fill: parent
29
30@@ -82,7 +72,6 @@
31 }
32 height: parent.height - osk.height - (webapp.chromeless ? 0 : chromeLoader.item.visibleHeight)
33 developerExtrasEnabled: webapp.developerExtrasEnabled
34- localUserAgentOverride: getLocalUserAgentOverrideIfAny()
35 }
36
37 Loader {
38
39=== modified file 'src/app/webcontainer/webapp-container.qml'
40--- src/app/webcontainer/webapp-container.qml 2014-10-08 09:23:14 +0000
41+++ src/app/webcontainer/webapp-container.qml 2014-12-05 16:47:50 +0000
42@@ -78,7 +78,7 @@
43 webappModelSearchPath: root.webappModelSearchPath
44 webappUrlPatterns: root.webappUrlPatterns
45
46- localUserAgentOverride: root.localUserAgentOverride
47+ localUserAgentOverride: getLocalUserAgentOverrideIfAny()
48
49 popupRedirectionUrlPrefix: root.popupRedirectionUrlPrefix
50 webviewOverrideFile: root.webviewOverrideFile
51@@ -102,6 +102,16 @@
52 Component.onCompleted: i18n.domain = "webbrowser-app"
53 }
54
55+ function getLocalUserAgentOverrideIfAny() {
56+ if (localUserAgentOverride.length !== 0)
57+ return localUserAgentOverride
58+
59+ if (webappName && webappModel.exists(webappName))
60+ return webappModel.userAgentOverrideFor(webappName)
61+
62+ return ""
63+ }
64+
65 UnityWebApps.UnityWebappsAppModel {
66 id: webappModel
67 searchPath: root.webappModelSearchPath

Subscribers

People subscribed via source and target branches