Merge lp:~osomon/webbrowser-app/on-close-requested into lp:webbrowser-app

Proposed by Olivier Tilloy on 2014-11-03
Status: Merged
Approved by: Olivier Tilloy on 2015-02-17
Approved revision: 787
Merged at revision: 903
Proposed branch: lp:~osomon/webbrowser-app/on-close-requested
Merge into: lp:webbrowser-app
Diff against target: 119 lines (+59/-3)
5 files modified
debian/control (+1/-1)
src/Ubuntu/Web/UbuntuWebView02.qml (+1/-1)
src/app/webbrowser/Browser.qml (+19/-0)
tests/autopilot/webbrowser_app/tests/http_server.py (+9/-0)
tests/autopilot/webbrowser_app/tests/test_tabs.py (+29/-1)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/on-close-requested
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2015-02-17
Ubuntu Phablet Team 2014-11-03 Pending
Review via email: mp+240437@code.launchpad.net

Commit Message

Honour Window.close() requests.

This is for the browser app only, not for the webapp container.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:780
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/1226/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/6405/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/4261/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-amd64-ci/425
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-armhf-ci/425
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-armhf-ci/425/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-i386-ci/425
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/6008/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/7657
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/7657/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/15348
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/3616/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/4654
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/4654/artifact/work/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
781. By Olivier Tilloy on 2014-12-16

Merge the latest changes from trunk.

782. By Olivier Tilloy on 2014-12-16

Use the new Tab.close() method.

783. By Olivier Tilloy on 2014-12-17

Merge the latest changes from trunk,
and resolve a conflict.

784. By Olivier Tilloy on 2014-12-17

Explicitly import oxide 1.4.

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:784
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/1353/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/610/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-vivid/344/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/webbrowser-app-vivid-amd64-ci/111/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-vivid-armhf-ci/111
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-vivid-armhf-ci/111/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-vivid-i386-ci/111
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-mako/523/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/608
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/608/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/16658
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-vivid/283/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-amd64/350
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-amd64/350/artifact/work/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
785. By Olivier Tilloy on 2015-02-05

Merge the latest changes from trunk.

PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
786. By Olivier Tilloy on 2015-02-16

Make the Ubuntu.Web module import Oxide 1.4 for the WebView component,
to enable using new APIs in the browser app.

787. By Olivier Tilloy on 2015-02-16

Fix autopilot tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-02-03 11:06:09 +0000
3+++ debian/control 2015-02-16 14:24:41 +0000
4@@ -97,7 +97,7 @@
5 Pre-Depends: ${misc:Pre-Depends}
6 Depends: ${misc:Depends},
7 ${shlibs:Depends},
8- liboxideqt-qmlplugin (>= 1.3),
9+ liboxideqt-qmlplugin (>= 1.4),
10 qml-module-qtquick2 | qtdeclarative5-qtquick2-plugin,
11 qml-module-qtquick-window2 | qtdeclarative5-window-plugin,
12 qtdeclarative5-ubuntu-ui-toolkit-plugin,
13
14=== modified file 'src/Ubuntu/Web/UbuntuWebView02.qml'
15--- src/Ubuntu/Web/UbuntuWebView02.qml 2014-12-12 10:30:22 +0000
16+++ src/Ubuntu/Web/UbuntuWebView02.qml 2015-02-16 14:24:41 +0000
17@@ -18,7 +18,7 @@
18
19 import QtQuick 2.0
20 import QtQuick.Window 2.0
21-import com.canonical.Oxide 1.0 as Oxide
22+import com.canonical.Oxide 1.4 as Oxide
23 import Ubuntu.Components 1.1
24 import Ubuntu.Components.Popups 1.0
25 import "." // QTBUG-34418
26
27=== modified file 'src/app/webbrowser/Browser.qml'
28--- src/app/webbrowser/Browser.qml 2015-02-03 11:06:09 +0000
29+++ src/app/webbrowser/Browser.qml 2015-02-16 14:24:41 +0000
30@@ -391,6 +391,25 @@
31 internal.addTab(tab, setCurrent)
32 }
33
34+ onCloseRequested: prepareToClose()
35+ onPrepareToCloseResponse: {
36+ if (proceed) {
37+ var tab = parent
38+ if (tab) {
39+ for (var i = 0; i < tabsModel.count; ++i) {
40+ if (tabsModel.get(i) === tab) {
41+ tabsModel.remove(i)
42+ break
43+ }
44+ }
45+ tab.close()
46+ }
47+ if (tabsModel.count === 0) {
48+ browser.openUrlInNewTab("", true, true)
49+ }
50+ }
51+ }
52+
53 onLoadingChanged: {
54 if (lastLoadSucceeded && browser.historyModel) {
55 browser.historyModel.add(url, title, icon)
56
57=== modified file 'tests/autopilot/webbrowser_app/tests/http_server.py'
58--- tests/autopilot/webbrowser_app/tests/http_server.py 2014-11-18 20:03:46 +0000
59+++ tests/autopilot/webbrowser_app/tests/http_server.py 2015-02-16 14:24:41 +0000
60@@ -117,6 +117,15 @@
61 html += '<div style="position: absolute; width: 50%; height: 50%; '
62 html += 'top: 25%; left: 25%"></div></body></html>'
63 self.send_html(html)
64+ elif self.path == "/closeself":
65+ # craft a page that accepts clicks anywhere inside its window
66+ # and that requests to be closed
67+ self.send_response(200)
68+ html = '<html><body style="margin: 0">'
69+ html += '<a onclick="window.close()">'
70+ html += '<div style="height: 100%"></div>'
71+ html += '</a></body></html>'
72+ self.send_html(html)
73 else:
74 self.send_error(404)
75
76
77=== modified file 'tests/autopilot/webbrowser_app/tests/test_tabs.py'
78--- tests/autopilot/webbrowser_app/tests/test_tabs.py 2014-12-13 02:46:27 +0000
79+++ tests/autopilot/webbrowser_app/tests/test_tabs.py 2015-02-16 14:24:41 +0000
80@@ -1,6 +1,6 @@
81 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
82 #
83-# Copyright 2013-2014 Canonical
84+# Copyright 2013-2015 Canonical
85 #
86 # This program is free software: you can redistribute it and/or modify it
87 # under the terms of the GNU General Public License version 3, as published
88@@ -155,3 +155,31 @@
89 self.assertThat(webview.activeFocus, Eventually(Equals(True)))
90 address_bar = self.main_window.address_bar
91 self.assertThat(address_bar.activeFocus, Eventually(Equals(False)))
92+
93+ def test_webview_requests_close(self):
94+ self.open_tabs_view()
95+ self.open_new_tab()
96+ url = self.base_url + "/closeself"
97+ self.main_window.go_to_url(url)
98+ self.main_window.wait_until_page_loaded(url)
99+ self.assert_number_webviews_eventually(2)
100+ webview = self.main_window.get_current_webview()
101+ self.pointing_device.click_object(webview)
102+ webview.wait_until_destroyed()
103+ self.assert_number_webviews_eventually(1)
104+
105+ def test_last_webview_requests_close(self):
106+ self.open_tabs_view()
107+ tabs_view = self.main_window.get_tabs_view()
108+ preview = tabs_view.get_ordered_previews()[0]
109+ close_button = preview.get_close_button()
110+ self.pointing_device.click_object(close_button)
111+ tabs_view.wait_until_destroyed()
112+ url = self.base_url + "/closeself"
113+ self.main_window.go_to_url(url)
114+ self.main_window.wait_until_page_loaded(url)
115+ webview = self.main_window.get_current_webview()
116+ self.pointing_device.click_object(webview)
117+ webview.wait_until_destroyed()
118+ self.assert_number_webviews_eventually(1)
119+ self.main_window.get_new_tab_view()

Subscribers

People subscribed via source and target branches

to status/vote changes: