Merge lp:~abreu-alexandre/webbrowser-app/webapp-navigation-handling into lp:webbrowser-app
- webapp-navigation-handling
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Alexandre Abreu |
Approved revision: | 297 |
Merged at revision: | 305 |
Proposed branch: | lp:~abreu-alexandre/webbrowser-app/webapp-navigation-handling |
Merge into: | lp:webbrowser-app |
Diff against target: |
273 lines (+117/-6) 7 files modified
src/Ubuntu/Components/Extras/Browser/UbuntuWebView.qml (+15/-2) src/app/Browser.qml (+38/-2) src/app/commandline-parser.cpp (+19/-0) src/app/commandline-parser.h (+3/-1) src/app/webbrowser-app.cpp (+10/-0) src/app/webbrowser-app.qml (+2/-0) tests/unittests/commandline-parser/tst_CommandLineParserTests.cpp (+30/-1) |
To merge this branch: | bzr merge lp:~abreu-alexandre/webbrowser-app/webapp-navigation-handling |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Alexandre Abreu (community) | Approve | ||
Olivier Tilloy | Approve | ||
Review via email:
|
Commit message
Navigation support
Description of the change
Navigation support
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:292
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
17 + property var onNavigationReq
18 UserAgent {
19 id: userAgent
20 }
21 experimental.
22 onNavigationReq
23 + if (onNavigationRe
24 + onNavigationReq
25 + if (request.action === WebView.
26 + return;
27 + }
This works, however I’m not convinced by the way it is implemented.
How about, instead of a property for a delegate function, implemented a default method in the base class (UbuntuWebView), called e.g. handleNavigatio
This would be functionally equivalent, but more elegant in my opinion.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
8 -import QtWebKit 3.0
9 +import QtWebKit 3.1
This will require the new version of QtWebKit to be in the archive, and backported to raring in a PPA. Is it already there?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
73 + var url = request.url + ' ';
Why is this needed?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
84 + var pattern = browser.
Why do you need to replace wildcards by '[^ ]*' ?
Couldn’t this substitution be done earlier on, when browser.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
82 + var matched = false;
Instead of using an intermediate boolean var, how about initially setting action to WebView.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
226 + property alias includes: browser.
Can this property be renamed to something more explicit? I’d like to see 'webapps' in the name, to make it crystal clear that this property affects only webapps.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:292
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 17 + property var onNavigationReq
> 18 UserAgent {
> 19 id: userAgent
> 20 }
> 21 experimental.
> 22 onNavigationReq
> 23 + if (onNavigationRe
> typeof(
> 24 + onNavigationReq
> 25 + if (request.action === WebView.
> 26 + return;
> 27 + }
>
> This works, however I’m not convinced by the way it is implemented.
> How about, instead of a property for a delegate function, implemented a
> default method in the base class (UbuntuWebView), called e.g.
> handleNavigatio
> it in Browser.qml?
>
> This would be functionally equivalent, but more elegant in my opinion.
I am not really sure about that one, since it gives too much liberty to the
UbuntuWebView's client/user. The semantics is supposed to be a delegation of
some specialized behaviour that could override the basic one; but w/ your solution
nothing prevents the client to forget to call the default behaviour, or for example
behaviours from colliding/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 73 + var url = request.url + ' ';
>
> Why is this needed?
because request.url is not a js string, but an object that evaluates to a string, I force the coercion this way,
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 8 -import QtWebKit 3.0
> 9 +import QtWebKit 3.1
>
> This will require the new version of QtWebKit to be in the archive, and
> backported to raring in a PPA. Is it already there?
yes it's in the archive for S, I'll validate that's it's there for R w/ Mirv
before top-approving,
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 226 + property alias includes: browser.
>
> Can this property be renamed to something more explicit? I’d like to see
> 'webapps' in the name, to make it crystal clear that this property affects
> only webapps.
done.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 82 + var matched = false;
>
> Instead of using an intermediate boolean var, how about initially setting
> action to WebView.
> include pattern matches, set it to WebView.
good idea, done
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 84 + var pattern =
> browser.
>
> Why do you need to replace wildcards by '[^ ]*' ?
> Couldn’t this substitution be done earlier on, when
> browser.
+100, done
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:293
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
> > 17 + property var onNavigationReq
> > 18 UserAgent {
> > 19 id: userAgent
> > 20 }
> > 21 experimental.
> > 22 onNavigationReq
> > 23 + if (onNavigationRe
> > typeof(
> > 24 + onNavigationReq
> > 25 + if (request.action === WebView.
> > 26 + return;
> > 27 + }
> >
> > This works, however I’m not convinced by the way it is implemented.
> > How about, instead of a property for a delegate function, implemented a
> > default method in the base class (UbuntuWebView), called e.g.
> > handleNavigatio
> > it in Browser.qml?
> >
> > This would be functionally equivalent, but more elegant in my opinion.
>
> I am not really sure about that one, since it gives too much liberty to the
> UbuntuWebView's client/user. The semantics is supposed to be a delegation of
> some specialized behaviour that could override the basic one; but w/ your
> solution
> nothing prevents the client to forget to call the default behaviour, or for
> example
> behaviours from colliding/
I’m not sure I’m following you. What I’m proposing is a different implementation, but the semantics are exactly the same: the specialized behavior is delegated to a function (which by default does nothing and can be overridden) instead of being delegated to a function object stored as a property.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
> > 73 + var url = request.url + ' ';
> >
> > Why is this needed?
>
> because request.url is not a js string, but an object that evaluates to a
> string, I force the coercion this way,
Wouldn’t it be cleaner (and strictly equivalent) to do: var url = request.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
> > 226 + property alias includes: browser.
> >
> > Can this property be renamed to something more explicit? I’d like to see
> > 'webapps' in the name, to make it crystal clear that this property affects
> > only webapps.
>
> done.
Thanks. Could you also rename the command-line argument and the property of the CommandLineParser class, for consistency?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
>
> Thanks. Could you also rename the command-line argument and the property of
> the CommandLineParser class, for consistency?
done
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
>
> Wouldn’t it be cleaner (and strictly equivalent) to do: var url =
> request.
done, although the previous expression is quite idiomatic
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> > > 17 + property var onNavigationReq
> > > 18 UserAgent {
> > > 19 id: userAgent
> > > 20 }
> > > 21 experimental.
> > > 22 onNavigationReq
> > > 23 + if (onNavigationRe
> > > typeof(
> > > 24 + onNavigationReq
> > > 25 + if (request.action === WebView.
> > > 26 + return;
> > > 27 + }
> > >
> > > This works, however I’m not convinced by the way it is implemented.
> > > How about, instead of a property for a delegate function, implemented a
> > > default method in the base class (UbuntuWebView), called e.g.
> > > handleNavigatio
> override
> > > it in Browser.qml?
> > >
> > > This would be functionally equivalent, but more elegant in my opinion.
> >
> > I am not really sure about that one, since it gives too much liberty to the
> > UbuntuWebView's client/user. The semantics is supposed to be a delegation of
> > some specialized behaviour that could override the basic one; but w/ your
> > solution
> > nothing prevents the client to forget to call the default behaviour, or for
> > example
> > behaviours from colliding/
>
> I’m not sure I’m following you. What I’m proposing is a different
> implementation, but the semantics are exactly the same: the specialized
> behavior is delegated to a function (which by default does nothing and can be
> overridden) instead of being delegated to a function object stored as a
> property.
forget about my comment, I read to quickly and overlooked the fact that the
property usage was the issue ..
done
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:294
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
124 +#include <QtCore/
It looks like this is unused. Can it be removed?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 124 +#include <QtCore/
>
> It looks like this is unused. Can it be removed?
done
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
In the two implementations of navigationReque
Also, could you please add a comment in the default implementation (the one that does nothing) to explain that items inheriting UbuntuWebView may override this method to implement a specific behavior?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> In the two implementations of navigationReque
> console.debug() be removed?
> Also, could you please add a comment in the default implementation (the one
> that does nothing) to explain that items inheriting UbuntuWebView may override
> this method to implement a specific behavior?
done
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:295
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
ABORTED: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:296
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
Looks good to me. Approving, and I’ll let you top-approve once we’re sure the required update to QtWebKit has been backported to Raring.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
Timo just told me that the QtWebkit patch has been backported to R and build into the qtwebkit release found in the SDK ppa (version 5.0.1-0ubuntu7~
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
It appears there are conflicts when merging into the latest trunk.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
Unapproved changes made after approval.
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:297
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'src/Ubuntu/Components/Extras/Browser/UbuntuWebView.qml' |
2 | --- src/Ubuntu/Components/Extras/Browser/UbuntuWebView.qml 2013-08-16 15:14:32 +0000 |
3 | +++ src/Ubuntu/Components/Extras/Browser/UbuntuWebView.qml 2013-09-13 22:57:01 +0000 |
4 | @@ -17,7 +17,7 @@ |
5 | */ |
6 | |
7 | import QtQuick 2.0 |
8 | -import QtWebKit 3.0 |
9 | +import QtWebKit 3.1 |
10 | import QtWebKit.experimental 1.0 |
11 | import Ubuntu.Components 0.1 |
12 | import Ubuntu.Components.Extras.Browser 0.1 |
13 | @@ -41,13 +41,26 @@ |
14 | |
15 | property real scale: experimental.test.contentsScale * experimental.test.devicePixelRatio |
16 | |
17 | + /** |
18 | + * Client overridable function called before the default treatment of a |
19 | + * valid navigation request. This function can stop the navigation request |
20 | + * if it sets the 'action' field of the request to IgnoreRequest. |
21 | + * |
22 | + */ |
23 | + function navigationRequestedDelegate(request) { } |
24 | + |
25 | UserAgent { |
26 | id: userAgent |
27 | } |
28 | experimental.userAgent: userAgent.defaultUA |
29 | onNavigationRequested: { |
30 | + request.action = WebView.AcceptRequest; |
31 | + |
32 | + navigationRequestedDelegate (request); |
33 | + if (request.action === WebView.IgnoreRequest) |
34 | + return; |
35 | + |
36 | _webview.experimental.userAgent = userAgent.getUAString(request.url) |
37 | - request.action = WebView.AcceptRequest |
38 | } |
39 | |
40 | experimental.preferences.navigatorQtObjectEnabled: true |
41 | |
42 | === modified file 'src/app/Browser.qml' |
43 | --- src/app/Browser.qml 2013-09-03 20:28:36 +0000 |
44 | +++ src/app/Browser.qml 2013-09-13 22:57:01 +0000 |
45 | @@ -17,7 +17,7 @@ |
46 | */ |
47 | |
48 | import QtQuick 2.0 |
49 | -import QtWebKit 3.0 |
50 | +import QtWebKit 3.1 |
51 | import QtWebKit.experimental 1.0 |
52 | import Ubuntu.Components 0.1 |
53 | import Ubuntu.Components.Extras.Browser 0.1 |
54 | @@ -32,6 +32,8 @@ |
55 | property real qtwebkitdpr |
56 | property bool developerExtrasEnabled: false |
57 | |
58 | + property var webappUrlPatterns: null |
59 | + |
60 | property bool webapp: false |
61 | property string webappName: "" |
62 | |
63 | @@ -305,6 +307,7 @@ |
64 | id: webappsComponent |
65 | |
66 | UnityWebApps.UnityWebApps { |
67 | + id: webapps |
68 | name: browser.webappName |
69 | bindee: tabsModel.currentWebview |
70 | actionsContext: browser.actionManager.globalContext |
71 | @@ -369,6 +372,38 @@ |
72 | } |
73 | } |
74 | |
75 | + function navigationRequestedDelegate(request) { |
76 | + if (! request.isMainFrame) { |
77 | + request.action = WebView.AcceptRequest; |
78 | + return; |
79 | + } |
80 | + |
81 | + var action = WebView.AcceptRequest; |
82 | + var url = request.url.toString(); |
83 | + |
84 | + // The list of url patterns defined by the webapp takes precedence over command line |
85 | + if (webapp && isRunningAsANamedWebapp() && webapps.model && webapps.model.exists(webapps.name)) { |
86 | + if ( ! webapps.model.doesUrlMatchesWebapp(webapps.name, url)) { |
87 | + action = WebView.IgnoreRequest; |
88 | + } |
89 | + } |
90 | + else if (browser.webappUrlPatterns && browser.webappUrlPatterns.length !== 0) { |
91 | + action = WebView.IgnoreRequest; |
92 | + for (var i = 0; i < browser.webappUrlPatterns.length; ++i) { |
93 | + var pattern = browser.webappUrlPatterns[i]; |
94 | + if (url.match(pattern)) { |
95 | + action = WebView.AcceptRequest; |
96 | + break; |
97 | + } |
98 | + } |
99 | + } |
100 | + |
101 | + request.action = action; |
102 | + if (action === WebView.IgnoreRequest) { |
103 | + Qt.openUrlExternally(url); |
104 | + } |
105 | + } |
106 | + |
107 | onNewTabRequested: browser.newTab(url, true) |
108 | |
109 | // Small shim needed when running as a webapp to wire-up connections |
110 | @@ -377,7 +412,8 @@ |
111 | // component as a way to bind to a webview lookalike without |
112 | // reaching out directly to its internals (see it as an interface). |
113 | function getUnityWebappsProxies() { |
114 | - return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview) |
115 | + var handlers = {}; |
116 | + return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview, handlers) |
117 | } |
118 | } |
119 | } |
120 | |
121 | === modified file 'src/app/commandline-parser.cpp' |
122 | --- src/app/commandline-parser.cpp 2013-09-06 16:29:55 +0000 |
123 | +++ src/app/commandline-parser.cpp 2013-09-13 22:57:01 +0000 |
124 | @@ -54,6 +54,19 @@ |
125 | m_fullscreen = true; |
126 | } else if (argument == "--inspector") { |
127 | m_remoteInspector = true; |
128 | + } else if (argument.startsWith("--webappUrlPatterns=")) { |
129 | + QString tail = argument.split("--webappUrlPatterns=")[1]; |
130 | + if (!tail.isEmpty()) { |
131 | + QStringList includePatterns = tail.split(","); |
132 | + Q_FOREACH(const QString & includePattern, includePatterns) |
133 | + { |
134 | + QString url = includePattern.trimmed(); |
135 | + if ( ! url.isEmpty()) |
136 | + { |
137 | + m_webappUrlPatterns.append(url); |
138 | + } |
139 | + } |
140 | + } |
141 | } else if (argument == "--enable-back-forward") { |
142 | m_chromeFlags |= BACK_FORWARD_BUTTONS; |
143 | } else if (argument == "--enable-activity") { |
144 | @@ -121,6 +134,7 @@ |
145 | out << " --inspector run a remote inspector on port " << REMOTE_INSPECTOR_PORT << endl; |
146 | out << " --webapp[=name] launch the browser as a webapp trying to match it by name with an installed webapp integration script (if any)" << endl; |
147 | out << " --app-id=APP_ID run the application with a specific APP_ID" << endl; |
148 | + out << " --webappUrlPatterns=url-patterns when running as a webapp (see --webapp), list of ',' separated url patterns (wildcard based) that the webapp can navigate to" << endl; |
149 | out << "Chrome options (if none specified, the whole chrome is enabled by default):" << endl; |
150 | out << " --chromeless do not display any chrome (web application mode), if set it overrides the other chrome options" << endl; |
151 | out << " --enable-back-forward enable the display of the back and forward buttons" << endl; |
152 | @@ -172,3 +186,8 @@ |
153 | { |
154 | return m_webappName; |
155 | } |
156 | + |
157 | +QStringList CommandLineParser::webappUrlPatterns() const |
158 | +{ |
159 | + return m_webappUrlPatterns; |
160 | +} |
161 | |
162 | === modified file 'src/app/commandline-parser.h' |
163 | --- src/app/commandline-parser.h 2013-09-06 16:29:55 +0000 |
164 | +++ src/app/commandline-parser.h 2013-09-13 22:57:01 +0000 |
165 | @@ -22,6 +22,7 @@ |
166 | // Qt |
167 | #include <QtCore/QObject> |
168 | #include <QtCore/QString> |
169 | +#include <QtCore/QStringList> |
170 | #include <QtCore/QUrl> |
171 | |
172 | class CommandLineParser : public QObject |
173 | @@ -60,9 +61,9 @@ |
174 | |
175 | QString appId() const; |
176 | |
177 | + QStringList webappUrlPatterns() const; |
178 | ChromeElementFlags chromeFlags() const; |
179 | |
180 | - |
181 | private: |
182 | bool m_help; |
183 | bool m_fullscreen; |
184 | @@ -71,6 +72,7 @@ |
185 | bool m_webapp; |
186 | QString m_webappName; |
187 | QString m_appid; |
188 | + QStringList m_webappUrlPatterns; |
189 | ChromeElementFlags m_chromeFlags; |
190 | }; |
191 | |
192 | |
193 | === modified file 'src/app/webbrowser-app.cpp' |
194 | --- src/app/webbrowser-app.cpp 2013-09-06 16:29:55 +0000 |
195 | +++ src/app/webbrowser-app.cpp 2013-09-13 22:57:01 +0000 |
196 | @@ -120,6 +120,16 @@ |
197 | browser->setProperty("activityButtonVisible", activityButtonVisible); |
198 | } |
199 | |
200 | + QStringList urlPatterns = m_arguments->webappUrlPatterns(); |
201 | + if ( ! urlPatterns.isEmpty()) |
202 | + { |
203 | + for (int i = 0; i < urlPatterns.count(); ++i) |
204 | + { |
205 | + urlPatterns[i].replace("*", "[^ ]*"); |
206 | + } |
207 | + browser->setProperty("webappUrlPatterns", urlPatterns); |
208 | + } |
209 | + |
210 | // Set the desired pixel ratio (not needed once we use Qt's way of calculating |
211 | // the proper pixel ratio by device/screen) |
212 | float webkitDpr = getQtWebkitDpr(); |
213 | |
214 | === modified file 'src/app/webbrowser-app.qml' |
215 | --- src/app/webbrowser-app.qml 2013-09-03 20:28:36 +0000 |
216 | +++ src/app/webbrowser-app.qml 2013-09-13 22:57:01 +0000 |
217 | @@ -25,6 +25,8 @@ |
218 | property alias qtwebkitdpr: browser.qtwebkitdpr |
219 | property alias developerExtrasEnabled: browser.developerExtrasEnabled |
220 | |
221 | + property alias webappUrlPatterns: browser.webappUrlPatterns |
222 | + |
223 | property alias backForwardButtonsVisible: browser.backForwardButtonsVisible |
224 | property alias activityButtonVisible: browser.activityButtonVisible |
225 | property alias addressBarVisible: browser.addressBarVisible |
226 | |
227 | === modified file 'tests/unittests/commandline-parser/tst_CommandLineParserTests.cpp' |
228 | --- tests/unittests/commandline-parser/tst_CommandLineParserTests.cpp 2013-09-06 16:13:18 +0000 |
229 | +++ tests/unittests/commandline-parser/tst_CommandLineParserTests.cpp 2013-09-13 22:57:01 +0000 |
230 | @@ -205,13 +205,42 @@ |
231 | QCOMPARE(CommandLineParser(args).webappName(), webappName); |
232 | } |
233 | |
234 | + void shouldUseIncludes_data() |
235 | + { |
236 | + QTest::addColumn<QStringList>("args"); |
237 | + QTest::addColumn<QStringList>("patterns"); |
238 | + |
239 | + QString BINARY("webbrowser-app"); |
240 | + QString INCLUDE_PATTERN("http://www.ubuntu.*/*"); |
241 | + QString INCLUDE_PATTERN2("http://www.bbc.*/*"); |
242 | + |
243 | + QTest::newRow("no switch") << (QStringList() << BINARY) << QStringList(); |
244 | + |
245 | + QTest::newRow("switch only") << (QStringList() << BINARY << "--webappUrlPatterns") << QStringList(); |
246 | + QTest::newRow("empty switch") << (QStringList() << BINARY << "--webappUrlPatterns=") << QStringList(); |
247 | + |
248 | + QTest::newRow("switch and one pattern") |
249 | + << (QStringList() << BINARY << (QString("--webappUrlPatterns=") + INCLUDE_PATTERN)) |
250 | + << (QStringList() << INCLUDE_PATTERN); |
251 | + |
252 | + QTest::newRow("switch and multiple trimmed pattern") |
253 | + << (QStringList() << BINARY << (QString("--webappUrlPatterns=") + INCLUDE_PATTERN + " , " + INCLUDE_PATTERN2 + " , ")) |
254 | + << (QStringList() << INCLUDE_PATTERN << INCLUDE_PATTERN2); |
255 | + } |
256 | + |
257 | + void shouldUseIncludes() |
258 | + { |
259 | + QFETCH(QStringList, args); |
260 | + QFETCH(QStringList, patterns); |
261 | + QCOMPARE(CommandLineParser(args).webappUrlPatterns(), patterns); |
262 | + } |
263 | + |
264 | void shouldUseChrome_data() |
265 | { |
266 | QTest::addColumn<QStringList>("args"); |
267 | QTest::addColumn<uint>("chrome"); |
268 | |
269 | QString BINARY("webbrowser-app"); |
270 | - |
271 | QString CHROME_BACK_FORWARD("--enable-back-forward"); |
272 | QString CHROME_ACTIVIY("--enable-activity"); |
273 | QString CHROME_ADDRESS_BAR("--enable-addressbar"); |
FAILED: Continuous integration, rev:291 jenkins. qa.ubuntu. com/job/ webbrowser- app-ci/ 293/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/2936/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/503/ console jenkins. qa.ubuntu. com/job/ webbrowser- app-saucy- amd64-ci/ 176 jenkins. qa.ubuntu. com/job/ webbrowser- app-saucy- armhf-ci/ 176 jenkins. qa.ubuntu. com/job/ webbrowser- app-saucy- armhf-ci/ 176/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ webbrowser- app-saucy- i386-ci/ 176 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 2942 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 2942/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- saucy/2499/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 505 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 505/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- maguro/ 451/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/459/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ webbrowser- app-ci/ 293/rebuild
http://