Merge lp:~abreu-alexandre/webbrowser-app/command-line-option-external-urls-in-overlay into lp:webbrowser-app
- command-line-option-external-urls-in-overlay
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Alexandre Abreu |
Approved revision: | 1389 |
Merged at revision: | 1393 |
Proposed branch: | lp:~abreu-alexandre/webbrowser-app/command-line-option-external-urls-in-overlay |
Merge into: | lp:webbrowser-app |
Diff against target: |
272 lines (+82/-17) 9 files modified
src/app/webcontainer/PopupWindowController.qml (+2/-2) src/app/webcontainer/PopupWindowOverlay.qml (+7/-4) src/app/webcontainer/WebApp.qml (+1/-0) src/app/webcontainer/WebViewImplOxide.qml (+19/-9) src/app/webcontainer/WebappContainerWebview.qml (+3/-1) src/app/webcontainer/webapp-container.cpp (+5/-0) src/app/webcontainer/webapp-container.h (+1/-0) src/app/webcontainer/webapp-container.qml (+2/-0) tests/autopilot/webapp_container/tests/test_url_patterns.py (+42/-1) |
To merge this branch: | bzr merge lp:~abreu-alexandre/webbrowser-app/command-line-option-external-urls-in-overlay |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Mardegan (community) | Approve | ||
David Barth (community) | Approve | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email:
|
Commit message
Add --open-
Description of the change
Add --open-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1368. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Terry (mterry) wrote : | # |
Oooh, thanks for this! I'm not qualified to review this, but I did notice this copy/paste error:
+ out << " --open-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> Oooh, thanks for this! I'm not qualified to review this, but I did notice
> this copy/paste error:
>
> + out << " --open-
> playback" << endl;
absolutely, thanks for spotting that :)
updated
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1369
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: 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:1370
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1369. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 1370. By Olivier Tilloy
-
Refer to @{XDG_DOWNLOAD_DIR} in the browser’s apparmor profile instead of hardcoding "Downloads" in English. Fixes: #1535666
Approved by: Jamie Strandboge - 1371. By Olivier Tilloy
-
Visual tweaks per designers’ review.
- 1372. By Olivier Tilloy
-
Store entries in the history database on load committed, not load succeeded.
This ensures that content-initiated navigations are also stored. Fixes: #1455858, #1549780
Approved by: Riccardo Padovani - 1373. By CI Train Bot Account
-
Releasing 0.23+16.
04.20160303- 0ubuntu1 - 1374. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 1375. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 1376. By Alexandre Abreu
-
Handle context menu in overlay webviews. Fixes: #1533727
Approved by: David Barth, Alberto Mardegan, Olivier Tilloy - 1377. By CI Train Bot Account
-
Releasing 0.23+16.
04.20160307- 0ubuntu1 - 1378. By CI Train Bot Account
-
Resync trunk.
- 1379. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 1380. By Olivier Tilloy
-
Add a touch selection controller. Fixes: #1376268, #1551494
Approved by: Alexandre Abreu - 1381. By CI Train Bot Account
-
Releasing 0.23+16.
04.20160310- 0ubuntu1 - 1382. By Alberto Mardegan
-
Activate the Webapp only when we are ready to navigate to the webapp URL
Fixes: #1507995
Approved by: Alexandre Abreu - 1383. By CI Train Bot Account
-
Releasing 0.23+16.
04.20160311- 0ubuntu1 - 1384. By CI Train Bot Account
-
Resync trunk.
- 1385. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 1386. By Alexandre Abreu
-
Handle media access request from webcontainer main view and overlay views Fixes: #1554202
Approved by: Olivier Tilloy - 1387. By CI Train Bot Account
-
Releasing 0.23+16.
04.20160318- 0ubuntu1
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alberto Mardegan (mardy) wrote : | # |
Looks good, just one question inline.
- 1388. By Alexandre Abreu
-
Open outside links open in overlay with command line
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
> Looks good, just one question inline.
replied to your comment
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandre Abreu (abreu-alexandre) wrote : | # |
Replied to your comment @mardy
- 1389. By Alexandre Abreu
-
Improve openUrlExternally documentation
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alberto Mardegan (mardy) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
David Barth (dbarth) wrote : | # |
Testing the silo, it appears that once the option is active, there should be no smart SAML detection, but all external urls should go to the overlay. Otherwise, you get half of the authentication process in the main window, and then it continues in an overlay.
Preview Diff
1 | === modified file 'src/app/webcontainer/PopupWindowController.qml' |
2 | --- src/app/webcontainer/PopupWindowController.qml 2016-03-10 14:21:43 +0000 |
3 | +++ src/app/webcontainer/PopupWindowController.qml 2016-03-24 14:57:23 +0000 |
4 | @@ -259,8 +259,8 @@ |
5 | console.log("Maximum number of popup overlay opened, opening: " |
6 | + url |
7 | + " in the browser") |
8 | - return |
9 | + return false |
10 | } |
11 | - request.action = Oxide.NavigationRequest.ActionAccept |
12 | + return true |
13 | } |
14 | } |
15 | |
16 | === modified file 'src/app/webcontainer/PopupWindowOverlay.qml' |
17 | --- src/app/webcontainer/PopupWindowOverlay.qml 2016-03-16 15:03:44 +0000 |
18 | +++ src/app/webcontainer/PopupWindowOverlay.qml 2016-03-24 14:57:23 +0000 |
19 | @@ -208,12 +208,15 @@ |
20 | |
21 | onNavigationRequested: { |
22 | var url = request.url.toString() |
23 | + request.action = Oxide.NavigationRequest.ActionAccept |
24 | if (isNewForegroundWebViewDisposition(request.disposition)) { |
25 | - popupWindowController.handleNewForegroundNavigationRequest( |
26 | - url, request, false) |
27 | - return |
28 | + var shouldAcceptRequest = |
29 | + popupWindowController.handleNewForegroundNavigationRequest( |
30 | + url, request, false); |
31 | + if (!shouldAcceptRequest) { |
32 | + request.action = Oxide.NavigationRequest.ActionReject |
33 | + } |
34 | } |
35 | - request.action = Oxide.NavigationRequest.ActionAccept |
36 | } |
37 | |
38 | onCloseRequested: { |
39 | |
40 | === modified file 'src/app/webcontainer/WebApp.qml' |
41 | --- src/app/webcontainer/WebApp.qml 2016-02-09 17:04:23 +0000 |
42 | +++ src/app/webcontainer/WebApp.qml 2016-03-24 14:57:23 +0000 |
43 | @@ -44,6 +44,7 @@ |
44 | property alias localUserAgentOverride: containerWebView.localUserAgentOverride |
45 | property alias dataPath: containerWebView.dataPath |
46 | property alias runningLocalApplication: containerWebView.runningLocalApplication |
47 | + property alias openExternalUrlInOverlay: containerWebView.openExternalUrlInOverlay |
48 | |
49 | property string webappName: "" |
50 | |
51 | |
52 | === modified file 'src/app/webcontainer/WebViewImplOxide.qml' |
53 | --- src/app/webcontainer/WebViewImplOxide.qml 2016-03-16 15:03:44 +0000 |
54 | +++ src/app/webcontainer/WebViewImplOxide.qml 2016-03-24 14:57:23 +0000 |
55 | @@ -37,6 +37,7 @@ |
56 | property var popupController |
57 | property var overlayViewsParent: webview.parent |
58 | property var mediaAccessDialogComponent |
59 | + property bool openExternalUrlInOverlay: false |
60 | |
61 | // Mostly used for testing & avoid external urls to |
62 | // "leak" in the default browser. External URLs corresponds |
63 | @@ -94,7 +95,7 @@ |
64 | Oxide.ScriptMessageHandler { } |
65 | } |
66 | |
67 | - onOpenUrlExternallyRequested: openUrlExternally(url) |
68 | + onOpenUrlExternallyRequested: openUrlExternally(url, false) |
69 | |
70 | preferences.allowFileAccessFromFileUrls: runningLocalApplication |
71 | preferences.allowUniversalAccessFromFileUrls: runningLocalApplication |
72 | @@ -139,10 +140,15 @@ |
73 | disposition === Oxide.NavigationRequest.DispositionNewForegroundTab; |
74 | } |
75 | |
76 | - function openUrlExternally(url) { |
77 | - webview.openExternalUrlTriggered(url) |
78 | - if (! webview.blockOpenExternalUrls) { |
79 | - Qt.openUrlExternally(url) |
80 | + function openUrlExternally(url, isTriggeredByUserNavigation) { |
81 | + if (openExternalUrlInOverlay && isTriggeredByUserNavigation) { |
82 | + popupController.createPopupViewForUrl(overlayViewsParent, url, true, context) |
83 | + return |
84 | + } else { |
85 | + webview.openExternalUrlTriggered(url) |
86 | + if (! webview.blockOpenExternalUrls) { |
87 | + Qt.openUrlExternally(url) |
88 | + } |
89 | } |
90 | } |
91 | |
92 | @@ -174,15 +180,19 @@ |
93 | var url = request.url.toString() |
94 | if (runningLocalApplication && url.indexOf("file://") !== 0) { |
95 | request.action = Oxide.NavigationRequest.ActionReject |
96 | - openUrlExternally(url) |
97 | + openUrlExternally(url, true) |
98 | return |
99 | } |
100 | |
101 | request.action = Oxide.NavigationRequest.ActionReject |
102 | if (isNewForegroundWebViewDisposition(request.disposition)) { |
103 | request.action = Oxide.NavigationRequest.ActionAccept |
104 | - popupController.handleNewForegroundNavigationRequest(url, request, true) |
105 | - return |
106 | + var shouldAcceptRequest = |
107 | + popupWindowController.handleNewForegroundNavigationRequest( |
108 | + url, request, true); |
109 | + if (shouldAcceptRequest) { |
110 | + request.action = Oxide.NavigationRequest.ActionAccept |
111 | + } |
112 | } |
113 | |
114 | // Pass-through if we are not running as a named webapp (--webapp='Gmail') |
115 | @@ -218,7 +228,7 @@ |
116 | |
117 | if (request.action === Oxide.NavigationRequest.ActionReject) { |
118 | console.debug('Opening: ' + url + ' in the browser window.') |
119 | - openUrlExternally(url) |
120 | + openUrlExternally(url, true) |
121 | } |
122 | } |
123 | |
124 | |
125 | === modified file 'src/app/webcontainer/WebappContainerWebview.qml' |
126 | --- src/app/webcontainer/WebappContainerWebview.qml 2016-03-10 14:21:43 +0000 |
127 | +++ src/app/webcontainer/WebappContainerWebview.qml 2016-03-24 14:57:23 +0000 |
128 | @@ -40,6 +40,7 @@ |
129 | property bool blockOpenExternalUrls: false |
130 | property bool runningLocalApplication: false |
131 | property bool wide: false |
132 | + property bool openExternalUrlInOverlay: false |
133 | |
134 | signal samlRequestUrlPatternReceived(string urlPattern) |
135 | signal themeColorMetaInformationDetected(string theme_color) |
136 | @@ -124,7 +125,8 @@ |
137 | , popupController: popupController |
138 | , overlayViewsParent: containerWebview.parent |
139 | , wide: containerWebview.wide |
140 | - , mediaAccessDialogComponent: mediaAccessDialogComponent}) |
141 | + , mediaAccessDialogComponent: mediaAccessDialogComponent |
142 | + , openExternalUrlInOverlay: containerWebview.openExternalUrlInOverlay}) |
143 | } |
144 | } |
145 | |
146 | |
147 | === modified file 'src/app/webcontainer/webapp-container.cpp' |
148 | --- src/app/webcontainer/webapp-container.cpp 2016-01-15 09:29:22 +0000 |
149 | +++ src/app/webcontainer/webapp-container.cpp 2016-03-24 14:57:23 +0000 |
150 | @@ -87,6 +87,7 @@ |
151 | m_backForwardButtonsVisible(false), |
152 | m_addressBarVisible(false), |
153 | m_localWebappManifest(false), |
154 | + m_openExternalUrlInOverlay(false), |
155 | m_webappContainerHelper(new WebappContainerHelper()) |
156 | { |
157 | } |
158 | @@ -126,6 +127,7 @@ |
159 | m_window->setProperty("chromeVisible", m_addressBarVisible); |
160 | m_window->setProperty("accountProvider", m_accountProvider); |
161 | m_window->setProperty("accountSwitcher", m_accountSwitcher); |
162 | + m_window->setProperty("openExternalUrlInOverlay", m_openExternalUrlInOverlay); |
163 | |
164 | m_window->setProperty("webappUrlPatterns", m_webappUrlPatterns); |
165 | QQmlContext* context = m_engine->rootContext(); |
166 | @@ -290,6 +292,7 @@ |
167 | out << " --store-session-cookies store session cookies on disk" << endl; |
168 | out << " --enable-media-hub-audio enable media-hub for audio playback" << endl; |
169 | out << " --user-agent-string=USER_AGENT overrides the default User Agent with the provided one." << endl; |
170 | + out << " --open-external-url-in-overlay if url patterns are defined, all external urls are opened in overlay instead of browser" << endl; |
171 | out << "Chrome options (if none specified, no chrome is shown by default):" << endl; |
172 | out << " --enable-back-forward enable the display of the back and forward buttons (implies --enable-addressbar)" << endl; |
173 | out << " --enable-addressbar enable the display of a minimal chrome (favicon and title)" << endl; |
174 | @@ -345,6 +348,8 @@ |
175 | m_localCookieStoreDbPath = argument.split("--local-cookie-db-path=")[1]; |
176 | } else if (argument.startsWith("--user-agent-string=")) { |
177 | m_userAgentOverride = argument.split("--user-agent-string=")[1]; |
178 | + } else if (argument == "--open-external-url-in-overlay") { |
179 | + m_openExternalUrlInOverlay = true; |
180 | } |
181 | } |
182 | } |
183 | |
184 | === modified file 'src/app/webcontainer/webapp-container.h' |
185 | --- src/app/webcontainer/webapp-container.h 2016-01-18 15:27:46 +0000 |
186 | +++ src/app/webcontainer/webapp-container.h 2016-03-24 14:57:23 +0000 |
187 | @@ -66,6 +66,7 @@ |
188 | bool m_backForwardButtonsVisible; |
189 | bool m_addressBarVisible; |
190 | bool m_localWebappManifest; |
191 | + bool m_openExternalUrlInOverlay; |
192 | QString m_popupRedirectionUrlPrefixPattern; |
193 | QString m_localCookieStoreDbPath; |
194 | QString m_userAgentOverride; |
195 | |
196 | === modified file 'src/app/webcontainer/webapp-container.qml' |
197 | --- src/app/webcontainer/webapp-container.qml 2016-03-11 12:56:55 +0000 |
198 | +++ src/app/webcontainer/webapp-container.qml 2016-03-24 14:57:23 +0000 |
199 | @@ -45,6 +45,7 @@ |
200 | property alias webContextSessionCookieMode: webappViewLoader.webContextSessionCookieMode |
201 | property string localUserAgentOverride: "" |
202 | property bool blockOpenExternalUrls: false |
203 | + property bool openExternalUrlInOverlay: false |
204 | |
205 | currentWebview: webappViewLoader.item ? webappViewLoader.item.currentWebview : null |
206 | |
207 | @@ -87,6 +88,7 @@ |
208 | webappModelSearchPath: root.webappModelSearchPath |
209 | webappUrlPatterns: root.webappUrlPatterns |
210 | blockOpenExternalUrls: root.blockOpenExternalUrls |
211 | + openExternalUrlInOverlay: root.openExternalUrlInOverlay |
212 | |
213 | popupRedirectionUrlPrefixPattern: root.popupRedirectionUrlPrefixPattern |
214 | |
215 | |
216 | === modified file 'tests/autopilot/webapp_container/tests/test_url_patterns.py' |
217 | --- tests/autopilot/webapp_container/tests/test_url_patterns.py 2015-03-23 19:58:08 +0000 |
218 | +++ tests/autopilot/webapp_container/tests/test_url_patterns.py 2016-03-24 14:57:23 +0000 |
219 | @@ -13,7 +13,7 @@ |
220 | # You should have received a copy of the GNU General Public License |
221 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
222 | |
223 | -from testtools.matchers import Equals |
224 | +from testtools.matchers import Equals, Contains |
225 | from autopilot.matchers import Eventually |
226 | |
227 | from webapp_container.tests import WebappContainerTestCaseWithLocalContentBase |
228 | @@ -43,3 +43,44 @@ |
229 | self.assertThat( |
230 | lambda: external_open_watcher.was_emitted, |
231 | Eventually(Equals(True))) |
232 | + |
233 | + def test_pattern_with_external_url_in_overlay(self): |
234 | + args = ["--webappUrlPatterns=http://www.test.com/*", |
235 | + "--open-external-url-in-overlay"] |
236 | + rule = 'MAP *.test.com:80 ' + self.get_base_url_hostname() |
237 | + self.launch_webcontainer_app_with_local_http_server( |
238 | + args, |
239 | + '', |
240 | + {'WEBAPP_CONTAINER_BLOCK_OPEN_URL_EXTERNALLY': '1', |
241 | + 'UBUNTU_WEBVIEW_HOST_MAPPING_RULES': rule}, |
242 | + "http://www.test.com/with-external-link") |
243 | + self.get_webcontainer_window().visible.wait_for(True) |
244 | + |
245 | + popup_controller = self.get_popup_controller() |
246 | + new_view_watcher = popup_controller.watch_signal( |
247 | + 'newViewCreated(QString)') |
248 | + |
249 | + views = self.get_popup_overlay_views() |
250 | + self.assertThat(len(views), Equals(0)) |
251 | + |
252 | + webview = self.get_oxide_webview() |
253 | + external_open_watcher = webview.watch_signal( |
254 | + 'openExternalUrlTriggered(QString)') |
255 | + |
256 | + self.pointing_device.click_object(webview) |
257 | + |
258 | + self.assertThat( |
259 | + lambda: new_view_watcher.was_emitted, |
260 | + Eventually(Equals(True))) |
261 | + self.assertThat( |
262 | + lambda: len(self.get_popup_overlay_views()), |
263 | + Eventually(Equals(1))) |
264 | + views = self.get_popup_overlay_views() |
265 | + overlay = views[0] |
266 | + self.assertThat( |
267 | + overlay.select_single(objectName="overlayWebview").url, |
268 | + Contains('ubuntu')) |
269 | + |
270 | + self.assertThat( |
271 | + external_open_watcher.was_emitted, |
272 | + Equals(False)) |
FAILED: Continuous integration, rev:1368 jenkins. qa.ubuntu. com/job/ webbrowser- app-ci/ 2643/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 6673/console jenkins. qa.ubuntu. com/job/ webbrowser- app-vivid- amd64-ci/ 1396/console jenkins. qa.ubuntu. com/job/ webbrowser- app-vivid- armhf-ci/ 1396/console jenkins. qa.ubuntu. com/job/ webbrowser- app-vivid- i386-ci/ 1396/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 6684/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/webbrowser- app-ci/ 2643/rebuild
http://