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: mp+183671@code.launchpad.net |
Commit message
Navigation support
Description of the change
Navigation support
PS Jenkins bot (ps-jenkins) wrote : | # |
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://
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.
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?
Olivier Tilloy (osomon) wrote : | # |
73 + var url = request.url + ' ';
Why is this needed?
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.
Olivier Tilloy (osomon) wrote : | # |
82 + var matched = false;
Instead of using an intermediate boolean var, how about initially setting action to WebView.
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.
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://
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/
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,
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,
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.
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
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
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://
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.
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.
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?
Alexandre Abreu (abreu-alexandre) wrote : | # |
>
> Thanks. Could you also rename the command-line argument and the property of
> the CommandLineParser class, for consistency?
done
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
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
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://
Olivier Tilloy (osomon) wrote : | # |
124 +#include <QtCore/
It looks like this is unused. Can it be removed?
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 124 +#include <QtCore/
>
> It looks like this is unused. Can it be removed?
done
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?
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
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://
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://
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.
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~
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://
Olivier Tilloy (osomon) wrote : | # |
It appears there are conflicts when merging into the latest trunk.
PS Jenkins bot (ps-jenkins) : | # |
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://
Alexandre Abreu (abreu-alexandre) : | # |
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 | 17 | */ | 17 | */ |
6 | 18 | 18 | ||
7 | 19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 |
9 | 20 | import QtWebKit 3.0 | 20 | import QtWebKit 3.1 |
10 | 21 | import QtWebKit.experimental 1.0 | 21 | import QtWebKit.experimental 1.0 |
11 | 22 | import Ubuntu.Components 0.1 | 22 | import Ubuntu.Components 0.1 |
12 | 23 | import Ubuntu.Components.Extras.Browser 0.1 | 23 | import Ubuntu.Components.Extras.Browser 0.1 |
13 | @@ -41,13 +41,26 @@ | |||
14 | 41 | 41 | ||
15 | 42 | property real scale: experimental.test.contentsScale * experimental.test.devicePixelRatio | 42 | property real scale: experimental.test.contentsScale * experimental.test.devicePixelRatio |
16 | 43 | 43 | ||
17 | 44 | /** | ||
18 | 45 | * Client overridable function called before the default treatment of a | ||
19 | 46 | * valid navigation request. This function can stop the navigation request | ||
20 | 47 | * if it sets the 'action' field of the request to IgnoreRequest. | ||
21 | 48 | * | ||
22 | 49 | */ | ||
23 | 50 | function navigationRequestedDelegate(request) { } | ||
24 | 51 | |||
25 | 44 | UserAgent { | 52 | UserAgent { |
26 | 45 | id: userAgent | 53 | id: userAgent |
27 | 46 | } | 54 | } |
28 | 47 | experimental.userAgent: userAgent.defaultUA | 55 | experimental.userAgent: userAgent.defaultUA |
29 | 48 | onNavigationRequested: { | 56 | onNavigationRequested: { |
30 | 57 | request.action = WebView.AcceptRequest; | ||
31 | 58 | |||
32 | 59 | navigationRequestedDelegate (request); | ||
33 | 60 | if (request.action === WebView.IgnoreRequest) | ||
34 | 61 | return; | ||
35 | 62 | |||
36 | 49 | _webview.experimental.userAgent = userAgent.getUAString(request.url) | 63 | _webview.experimental.userAgent = userAgent.getUAString(request.url) |
37 | 50 | request.action = WebView.AcceptRequest | ||
38 | 51 | } | 64 | } |
39 | 52 | 65 | ||
40 | 53 | experimental.preferences.navigatorQtObjectEnabled: true | 66 | experimental.preferences.navigatorQtObjectEnabled: true |
41 | 54 | 67 | ||
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 | 17 | */ | 17 | */ |
47 | 18 | 18 | ||
48 | 19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 |
50 | 20 | import QtWebKit 3.0 | 20 | import QtWebKit 3.1 |
51 | 21 | import QtWebKit.experimental 1.0 | 21 | import QtWebKit.experimental 1.0 |
52 | 22 | import Ubuntu.Components 0.1 | 22 | import Ubuntu.Components 0.1 |
53 | 23 | import Ubuntu.Components.Extras.Browser 0.1 | 23 | import Ubuntu.Components.Extras.Browser 0.1 |
54 | @@ -32,6 +32,8 @@ | |||
55 | 32 | property real qtwebkitdpr | 32 | property real qtwebkitdpr |
56 | 33 | property bool developerExtrasEnabled: false | 33 | property bool developerExtrasEnabled: false |
57 | 34 | 34 | ||
58 | 35 | property var webappUrlPatterns: null | ||
59 | 36 | |||
60 | 35 | property bool webapp: false | 37 | property bool webapp: false |
61 | 36 | property string webappName: "" | 38 | property string webappName: "" |
62 | 37 | 39 | ||
63 | @@ -305,6 +307,7 @@ | |||
64 | 305 | id: webappsComponent | 307 | id: webappsComponent |
65 | 306 | 308 | ||
66 | 307 | UnityWebApps.UnityWebApps { | 309 | UnityWebApps.UnityWebApps { |
67 | 310 | id: webapps | ||
68 | 308 | name: browser.webappName | 311 | name: browser.webappName |
69 | 309 | bindee: tabsModel.currentWebview | 312 | bindee: tabsModel.currentWebview |
70 | 310 | actionsContext: browser.actionManager.globalContext | 313 | actionsContext: browser.actionManager.globalContext |
71 | @@ -369,6 +372,38 @@ | |||
72 | 369 | } | 372 | } |
73 | 370 | } | 373 | } |
74 | 371 | 374 | ||
75 | 375 | function navigationRequestedDelegate(request) { | ||
76 | 376 | if (! request.isMainFrame) { | ||
77 | 377 | request.action = WebView.AcceptRequest; | ||
78 | 378 | return; | ||
79 | 379 | } | ||
80 | 380 | |||
81 | 381 | var action = WebView.AcceptRequest; | ||
82 | 382 | var url = request.url.toString(); | ||
83 | 383 | |||
84 | 384 | // The list of url patterns defined by the webapp takes precedence over command line | ||
85 | 385 | if (webapp && isRunningAsANamedWebapp() && webapps.model && webapps.model.exists(webapps.name)) { | ||
86 | 386 | if ( ! webapps.model.doesUrlMatchesWebapp(webapps.name, url)) { | ||
87 | 387 | action = WebView.IgnoreRequest; | ||
88 | 388 | } | ||
89 | 389 | } | ||
90 | 390 | else if (browser.webappUrlPatterns && browser.webappUrlPatterns.length !== 0) { | ||
91 | 391 | action = WebView.IgnoreRequest; | ||
92 | 392 | for (var i = 0; i < browser.webappUrlPatterns.length; ++i) { | ||
93 | 393 | var pattern = browser.webappUrlPatterns[i]; | ||
94 | 394 | if (url.match(pattern)) { | ||
95 | 395 | action = WebView.AcceptRequest; | ||
96 | 396 | break; | ||
97 | 397 | } | ||
98 | 398 | } | ||
99 | 399 | } | ||
100 | 400 | |||
101 | 401 | request.action = action; | ||
102 | 402 | if (action === WebView.IgnoreRequest) { | ||
103 | 403 | Qt.openUrlExternally(url); | ||
104 | 404 | } | ||
105 | 405 | } | ||
106 | 406 | |||
107 | 372 | onNewTabRequested: browser.newTab(url, true) | 407 | onNewTabRequested: browser.newTab(url, true) |
108 | 373 | 408 | ||
109 | 374 | // Small shim needed when running as a webapp to wire-up connections | 409 | // Small shim needed when running as a webapp to wire-up connections |
110 | @@ -377,7 +412,8 @@ | |||
111 | 377 | // component as a way to bind to a webview lookalike without | 412 | // component as a way to bind to a webview lookalike without |
112 | 378 | // reaching out directly to its internals (see it as an interface). | 413 | // reaching out directly to its internals (see it as an interface). |
113 | 379 | function getUnityWebappsProxies() { | 414 | function getUnityWebappsProxies() { |
115 | 380 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview) | 415 | var handlers = {}; |
116 | 416 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview, handlers) | ||
117 | 381 | } | 417 | } |
118 | 382 | } | 418 | } |
119 | 383 | } | 419 | } |
120 | 384 | 420 | ||
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 | 54 | m_fullscreen = true; | 54 | m_fullscreen = true; |
126 | 55 | } else if (argument == "--inspector") { | 55 | } else if (argument == "--inspector") { |
127 | 56 | m_remoteInspector = true; | 56 | m_remoteInspector = true; |
128 | 57 | } else if (argument.startsWith("--webappUrlPatterns=")) { | ||
129 | 58 | QString tail = argument.split("--webappUrlPatterns=")[1]; | ||
130 | 59 | if (!tail.isEmpty()) { | ||
131 | 60 | QStringList includePatterns = tail.split(","); | ||
132 | 61 | Q_FOREACH(const QString & includePattern, includePatterns) | ||
133 | 62 | { | ||
134 | 63 | QString url = includePattern.trimmed(); | ||
135 | 64 | if ( ! url.isEmpty()) | ||
136 | 65 | { | ||
137 | 66 | m_webappUrlPatterns.append(url); | ||
138 | 67 | } | ||
139 | 68 | } | ||
140 | 69 | } | ||
141 | 57 | } else if (argument == "--enable-back-forward") { | 70 | } else if (argument == "--enable-back-forward") { |
142 | 58 | m_chromeFlags |= BACK_FORWARD_BUTTONS; | 71 | m_chromeFlags |= BACK_FORWARD_BUTTONS; |
143 | 59 | } else if (argument == "--enable-activity") { | 72 | } else if (argument == "--enable-activity") { |
144 | @@ -121,6 +134,7 @@ | |||
145 | 121 | out << " --inspector run a remote inspector on port " << REMOTE_INSPECTOR_PORT << endl; | 134 | out << " --inspector run a remote inspector on port " << REMOTE_INSPECTOR_PORT << endl; |
146 | 122 | out << " --webapp[=name] launch the browser as a webapp trying to match it by name with an installed webapp integration script (if any)" << endl; | 135 | 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 | 123 | out << " --app-id=APP_ID run the application with a specific APP_ID" << endl; | 136 | out << " --app-id=APP_ID run the application with a specific APP_ID" << endl; |
148 | 137 | 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 | 124 | out << "Chrome options (if none specified, the whole chrome is enabled by default):" << endl; | 138 | out << "Chrome options (if none specified, the whole chrome is enabled by default):" << endl; |
150 | 125 | out << " --chromeless do not display any chrome (web application mode), if set it overrides the other chrome options" << endl; | 139 | out << " --chromeless do not display any chrome (web application mode), if set it overrides the other chrome options" << endl; |
151 | 126 | out << " --enable-back-forward enable the display of the back and forward buttons" << endl; | 140 | out << " --enable-back-forward enable the display of the back and forward buttons" << endl; |
152 | @@ -172,3 +186,8 @@ | |||
153 | 172 | { | 186 | { |
154 | 173 | return m_webappName; | 187 | return m_webappName; |
155 | 174 | } | 188 | } |
156 | 189 | |||
157 | 190 | QStringList CommandLineParser::webappUrlPatterns() const | ||
158 | 191 | { | ||
159 | 192 | return m_webappUrlPatterns; | ||
160 | 193 | } | ||
161 | 175 | 194 | ||
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 | 22 | // Qt | 22 | // Qt |
167 | 23 | #include <QtCore/QObject> | 23 | #include <QtCore/QObject> |
168 | 24 | #include <QtCore/QString> | 24 | #include <QtCore/QString> |
169 | 25 | #include <QtCore/QStringList> | ||
170 | 25 | #include <QtCore/QUrl> | 26 | #include <QtCore/QUrl> |
171 | 26 | 27 | ||
172 | 27 | class CommandLineParser : public QObject | 28 | class CommandLineParser : public QObject |
173 | @@ -60,9 +61,9 @@ | |||
174 | 60 | 61 | ||
175 | 61 | QString appId() const; | 62 | QString appId() const; |
176 | 62 | 63 | ||
177 | 64 | QStringList webappUrlPatterns() const; | ||
178 | 63 | ChromeElementFlags chromeFlags() const; | 65 | ChromeElementFlags chromeFlags() const; |
179 | 64 | 66 | ||
180 | 65 | |||
181 | 66 | private: | 67 | private: |
182 | 67 | bool m_help; | 68 | bool m_help; |
183 | 68 | bool m_fullscreen; | 69 | bool m_fullscreen; |
184 | @@ -71,6 +72,7 @@ | |||
185 | 71 | bool m_webapp; | 72 | bool m_webapp; |
186 | 72 | QString m_webappName; | 73 | QString m_webappName; |
187 | 73 | QString m_appid; | 74 | QString m_appid; |
188 | 75 | QStringList m_webappUrlPatterns; | ||
189 | 74 | ChromeElementFlags m_chromeFlags; | 76 | ChromeElementFlags m_chromeFlags; |
190 | 75 | }; | 77 | }; |
191 | 76 | 78 | ||
192 | 77 | 79 | ||
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 | 120 | browser->setProperty("activityButtonVisible", activityButtonVisible); | 120 | browser->setProperty("activityButtonVisible", activityButtonVisible); |
198 | 121 | } | 121 | } |
199 | 122 | 122 | ||
200 | 123 | QStringList urlPatterns = m_arguments->webappUrlPatterns(); | ||
201 | 124 | if ( ! urlPatterns.isEmpty()) | ||
202 | 125 | { | ||
203 | 126 | for (int i = 0; i < urlPatterns.count(); ++i) | ||
204 | 127 | { | ||
205 | 128 | urlPatterns[i].replace("*", "[^ ]*"); | ||
206 | 129 | } | ||
207 | 130 | browser->setProperty("webappUrlPatterns", urlPatterns); | ||
208 | 131 | } | ||
209 | 132 | |||
210 | 123 | // Set the desired pixel ratio (not needed once we use Qt's way of calculating | 133 | // Set the desired pixel ratio (not needed once we use Qt's way of calculating |
211 | 124 | // the proper pixel ratio by device/screen) | 134 | // the proper pixel ratio by device/screen) |
212 | 125 | float webkitDpr = getQtWebkitDpr(); | 135 | float webkitDpr = getQtWebkitDpr(); |
213 | 126 | 136 | ||
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 | 25 | property alias qtwebkitdpr: browser.qtwebkitdpr | 25 | property alias qtwebkitdpr: browser.qtwebkitdpr |
219 | 26 | property alias developerExtrasEnabled: browser.developerExtrasEnabled | 26 | property alias developerExtrasEnabled: browser.developerExtrasEnabled |
220 | 27 | 27 | ||
221 | 28 | property alias webappUrlPatterns: browser.webappUrlPatterns | ||
222 | 29 | |||
223 | 28 | property alias backForwardButtonsVisible: browser.backForwardButtonsVisible | 30 | property alias backForwardButtonsVisible: browser.backForwardButtonsVisible |
224 | 29 | property alias activityButtonVisible: browser.activityButtonVisible | 31 | property alias activityButtonVisible: browser.activityButtonVisible |
225 | 30 | property alias addressBarVisible: browser.addressBarVisible | 32 | property alias addressBarVisible: browser.addressBarVisible |
226 | 31 | 33 | ||
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 | 205 | QCOMPARE(CommandLineParser(args).webappName(), webappName); | 205 | QCOMPARE(CommandLineParser(args).webappName(), webappName); |
232 | 206 | } | 206 | } |
233 | 207 | 207 | ||
234 | 208 | void shouldUseIncludes_data() | ||
235 | 209 | { | ||
236 | 210 | QTest::addColumn<QStringList>("args"); | ||
237 | 211 | QTest::addColumn<QStringList>("patterns"); | ||
238 | 212 | |||
239 | 213 | QString BINARY("webbrowser-app"); | ||
240 | 214 | QString INCLUDE_PATTERN("http://www.ubuntu.*/*"); | ||
241 | 215 | QString INCLUDE_PATTERN2("http://www.bbc.*/*"); | ||
242 | 216 | |||
243 | 217 | QTest::newRow("no switch") << (QStringList() << BINARY) << QStringList(); | ||
244 | 218 | |||
245 | 219 | QTest::newRow("switch only") << (QStringList() << BINARY << "--webappUrlPatterns") << QStringList(); | ||
246 | 220 | QTest::newRow("empty switch") << (QStringList() << BINARY << "--webappUrlPatterns=") << QStringList(); | ||
247 | 221 | |||
248 | 222 | QTest::newRow("switch and one pattern") | ||
249 | 223 | << (QStringList() << BINARY << (QString("--webappUrlPatterns=") + INCLUDE_PATTERN)) | ||
250 | 224 | << (QStringList() << INCLUDE_PATTERN); | ||
251 | 225 | |||
252 | 226 | QTest::newRow("switch and multiple trimmed pattern") | ||
253 | 227 | << (QStringList() << BINARY << (QString("--webappUrlPatterns=") + INCLUDE_PATTERN + " , " + INCLUDE_PATTERN2 + " , ")) | ||
254 | 228 | << (QStringList() << INCLUDE_PATTERN << INCLUDE_PATTERN2); | ||
255 | 229 | } | ||
256 | 230 | |||
257 | 231 | void shouldUseIncludes() | ||
258 | 232 | { | ||
259 | 233 | QFETCH(QStringList, args); | ||
260 | 234 | QFETCH(QStringList, patterns); | ||
261 | 235 | QCOMPARE(CommandLineParser(args).webappUrlPatterns(), patterns); | ||
262 | 236 | } | ||
263 | 237 | |||
264 | 208 | void shouldUseChrome_data() | 238 | void shouldUseChrome_data() |
265 | 209 | { | 239 | { |
266 | 210 | QTest::addColumn<QStringList>("args"); | 240 | QTest::addColumn<QStringList>("args"); |
267 | 211 | QTest::addColumn<uint>("chrome"); | 241 | QTest::addColumn<uint>("chrome"); |
268 | 212 | 242 | ||
269 | 213 | QString BINARY("webbrowser-app"); | 243 | QString BINARY("webbrowser-app"); |
270 | 214 | |||
271 | 215 | QString CHROME_BACK_FORWARD("--enable-back-forward"); | 244 | QString CHROME_BACK_FORWARD("--enable-back-forward"); |
272 | 216 | QString CHROME_ACTIVIY("--enable-activity"); | 245 | QString CHROME_ACTIVIY("--enable-activity"); |
273 | 217 | QString CHROME_ADDRESS_BAR("--enable-addressbar"); | 246 | 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://