Merge lp:~fboucault/webbrowser-app/workaround_new_tab_never_unloaded into lp:webbrowser-app/staging

Proposed by Florian Boucault
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1610
Merged at revision: 1615
Proposed branch: lp:~fboucault/webbrowser-app/workaround_new_tab_never_unloaded
Merge into: lp:webbrowser-app/staging
Diff against target: 92 lines (+29/-17)
2 files modified
src/app/webbrowser/Browser.qml (+28/-17)
src/app/webbrowser/BrowserTab.qml (+1/-0)
To merge this branch: bzr merge lp:~fboucault/webbrowser-app/workaround_new_tab_never_unloaded
Reviewer Review Type Date Requested Status
Olivier Tilloy Approve
Review via email: mp+317113@code.launchpad.net

Commit message

Fix issue with new tab page sometimes never being unloaded

Description of the change

Fix issue with new tab page sometimes never being unloaded

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

This breaks webbrowser_app.tests.test_new_tab_view.TestNewTabViewLifetime.test_new_tab_view_is_shared_between_tabs

review: Needs Fixing
1607. By Florian Boucault

Merged staging

1608. By Florian Boucault

Fix AP test webbrowser_app.tests.test_new_tab_view.TestNewTabViewLifetime.test_new_tab_view_is_shared_between_tabs

1609. By Florian Boucault

Clarified and centralised showing empty tab logic.

1610. By Florian Boucault

BrowserTab: made empty property readonly

Revision history for this message
Olivier Tilloy (osomon) wrote :

LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/Browser.qml'
2--- src/app/webbrowser/Browser.qml 2017-02-06 22:17:36 +0000
3+++ src/app/webbrowser/Browser.qml 2017-02-15 14:56:57 +0000
4@@ -264,14 +264,14 @@
5 }
6 clip: true // prevents component from overlapping bottom edge etc
7
8- // Avoid loading the new tab view if the webview is about to load
9- // content. Since WebView.restoreState is not a notifyable property,
10- // this can’t be achieved with a simple property binding.
11- Connections {
12- target: currentWebview
13- onUrlChanged: {
14- newTabViewLoader.active = false
15- }
16+ // Avoid loading the new tab view if the webview has or will have content
17+ Connections {
18+ target: tabsModel.currentTab
19+ onEmptyChanged: newTabViewLoader.setActive(tabsModel.currentTab.empty)
20+ }
21+ Connections {
22+ target: tabsModel
23+ onCurrentTabChanged: newTabViewLoader.setActive(tabsModel.currentTab && tabsModel.currentTab.empty)
24 }
25 active: false
26 focus: active
27@@ -279,16 +279,26 @@
28
29 Connections {
30 target: browser
31- onCurrentWebviewChanged: {
32- if (currentWebview) {
33- var tab = tabsModel.currentTab
34- newTabViewLoader.active = !tab.url.toString() && !tab.restoreState
35- }
36- }
37 onWideChanged: newTabViewLoader.selectTabView()
38 }
39 Component.onCompleted: newTabViewLoader.selectTabView()
40
41+ // FIXME: this is a workaround for bug #1659435 caused by QTBUG-54657.
42+ // New tab view was sometimes overlaid on top of other tabs because
43+ // it was not unloaded even though active was set to false.
44+ // Ref.: https://bugs.launchpad.net/ubuntu/+source/webbrowser-app/+bug/1659435
45+ // https://bugreports.qt.io/browse/QTBUG-54657
46+ function setActive(active) {
47+ if (active) {
48+ if (newTabViewLoader.source == "") {
49+ selectTabView();
50+ }
51+ } else {
52+ newTabViewLoader.setSource("", {});
53+ }
54+ newTabViewLoader.active = active;
55+ }
56+
57 function selectTabView() {
58 var source = browser.incognito ? "NewPrivateTabView.qml" :
59 (browser.wide ? "NewTabViewWide.qml" :
60@@ -1114,7 +1124,7 @@
61 if (recentView.visible) {
62 recentView.focus = true
63 } else if (tab) {
64- if (!tab.url.toString() && !tab.initialUrl.toString()) {
65+ if (tab.empty) {
66 maybeFocusAddressBar()
67 } else {
68 tabContainer.forceActiveFocus()
69@@ -1130,8 +1140,9 @@
70 }
71
72 function resetFocus() {
73- if (browser.currentWebview) {
74- if (!browser.currentWebview.url.toString()) {
75+ var currentTab = tabsModel.currentTab;
76+ if (currentTab) {
77+ if (currentTab.empty) {
78 internal.maybeFocusAddressBar()
79 } else {
80 contentsContainer.focus = true;
81
82=== modified file 'src/app/webbrowser/BrowserTab.qml'
83--- src/app/webbrowser/BrowserTab.qml 2016-11-08 14:19:52 +0000
84+++ src/app/webbrowser/BrowserTab.qml 2017-02-15 14:56:57 +0000
85@@ -42,6 +42,7 @@
86 property bool current: false
87 readonly property real lastCurrent: internal.lastCurrent
88 property bool incognito
89+ readonly property bool empty: !url.toString() && !initialUrl.toString() && !restoreState && !request
90 visible: false
91
92 // Used as a workaround for https://launchpad.net/bugs/1502675 :

Subscribers

People subscribed via source and target branches