Merge lp:~mardy/webbrowser-app/per-account-dir2 into lp:webbrowser-app
- per-account-dir2
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Olivier Tilloy |
Approved revision: | 785 |
Merged at revision: | 824 |
Proposed branch: | lp:~mardy/webbrowser-app/per-account-dir2 |
Merge into: | lp:webbrowser-app |
Prerequisite: | lp:~abreu-alexandre/webbrowser-app/fix-webapp-properties-ua-override |
Diff against target: |
603 lines (+159/-157) 11 files modified
src/app/webcontainer/AccountsPage.qml (+5/-29) src/app/webcontainer/WebApp.qml (+1/-0) src/app/webcontainer/WebViewImplOxide.qml (+5/-0) src/app/webcontainer/WebViewImplWebkit.qml (+1/-0) src/app/webcontainer/WebappContainerWebview.qml (+4/-1) src/app/webcontainer/chrome-cookie-store.cpp (+0/-13) src/app/webcontainer/chrome-cookie-store.h (+0/-7) src/app/webcontainer/cookie-store.cpp (+12/-20) src/app/webcontainer/online-accounts-cookie-store.cpp (+4/-5) src/app/webcontainer/oxide-cookie-helper.cpp (+5/-4) src/app/webcontainer/webapp-container.qml (+122/-78) |
To merge this branch: | bzr merge lp:~mardy/webbrowser-app/per-account-dir2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Tilloy | Approve | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email: mp+239263@code.launchpad.net |
Commit message
Use a different data location for different accounts
Move the webview behind a Loader, and set the dataPath according to the account number.
Description of the change
Use a different data location for different accounts
Move the webview behind a Loader, and set the dataPath according to the account number.
This fixes the bug described in the linked bug report, and also another potential issue (which IIRC we never saw happening): merging all cookies from different accounts can lock the webapp into an invalid state. Usually the set of cookie keys is the same even among different accounts, so this problem does not happen because all the old keys are overwritten by the newly copied cookies. But if the sets of keys are not the same (that is, if one account has one cookie more than another one), the remote website could enter a wrong state.
Testing instructions: have multiple GMail or Twitter accounts configured, but make sure that only one (for each provider) has the webapp application enabled. Then use the GMail or the twitter webapp, and verify that they work properly.
Close the webapps, go to the Accounts in System Settings, and disable the webapps from the accounts where they are enabled, and enabled them in the other account. Open the webapps again, verify that you are logged in with the proper (new) account.
Then check that the cookies.db files have been created under <dataLocation>
- 773. By Alberto Mardegan
-
cleanups
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:773
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 774. By Alberto Mardegan
-
Restore line removed by accident
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:774
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 775. By Alberto Mardegan
-
from trunk
[ CI bot ]
* Resync trunk
* Fix the override mechanism for navigator.userAgent, and add UA
override rules for HSBC’s Brazilian mobile site and ESPN’s mobile
site. (LP: #1316259)
[ Riccardo Padovani ]
* Fixed #1378975 - Fast double click on menu button opens menu twice
(LP: #1378975)
* Updated the README
[ Jean-Francois Moy ]
* Twitter User Script - Hide the prompt to download the Android
application. (LP: #1352789)
[ Ubuntu daily release ]
* New rebuild forced
[ Olivier Tilloy ]
* Prevent the browser from trying to download embedded flash
applications. (LP: #1379806)
* Fix a harmless compilation warning found by clang (non-literal-null-
conversion).
* Update UITK autopilot test imports. (LP: #1386276)
[ CI bot ]
* Resync trunk
[ Ubuntu daily release ]
* New rebuild forced
[ Olivier Tilloy ]
* Fix the override mechanism for navigator.userAgent, and add UA
override rules for HSBC’s Brazilian mobile site and ESPN’s mobile
site. (LP: #1316259) - 776. By Alberto Mardegan
-
Revert pot changes
Olivier Tilloy (osomon) wrote : | # |
All the webapp_container autopilot tests now fail: you need to replace "toolkit_emulators" by "uitk" in tests/autopilot
- 777. By Alberto Mardegan
-
Fix autopilot tests
Olivier Tilloy (osomon) wrote : | # |
In src/app/
16 + context: WebContext {
17 + dataPath: webview.dataPath
18 + }
This replaces the use of the custom shared context with a bare one that doesn’t have the functionality of the shared one (UA override mechanism, session cookie mode selection, user scripts). This won’t work.
Olivier Tilloy (osomon) wrote : | # |
Scratch the above comment, I hadn’t noticed that WebContext was resolving to UbuntuWebContex
However this change will break the browser, because it means we instantiate several contexts with the same datapath (which is the reason why the shared context is a singleton in the first place).
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:776
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:777
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 778. By Alberto Mardegan
-
Move context initialization to WebViewImplOxid
e.qml - 779. By Alberto Mardegan
-
From trunk
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* A Webapp has the option to either specify a command line option to
have a specific UA overriding the default or hgave a local webapp-
properties.json file that defines the UA override such as:
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:779
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 780. By Alberto Mardegan
-
from trunk
[ Ubuntu daily release ]
* New rebuild forced
[ Riccardo Padovani ]
* Added new upstream components to fit with design requests: multiple
selection in History, standard swipe-to-delete. (LP: #1351167)
[ Olivier Tilloy ]
* Do not use a custom scheme to trigger the error page, this won’t
work any longer as soon as oxide learns how to delegate unhandled
schemes (see https://launchpad. net/bugs/ 1384460). (LP: #1384460)
* Ensure that the 'dataLocation' context property is updated when the
application name changes. (LP: #1387754)
* Really honour the --fullscreen command-line switch. (LP: #1379766)
Olivier Tilloy (osomon) wrote : | # |
In webapp-
- 781. By Alberto Mardegan
-
Don't use invalid browser.
currentWebview - 782. By Alberto Mardegan
-
Remove updateBrowserUrl function
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:780
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:782
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Olivier Tilloy (osomon) wrote : | # |
118 - asynchronous: true
Why did you remove this attribute from the Loader?
Olivier Tilloy (osomon) wrote : | # |
A minor style suggestion, in WebViewImplOxid
property url dataPath
…
context: WebContext {
dataPath: webview.dataPath
}
could have been written:
property alias dataPath: context.dataPath
…
context: WebContext {}
Olivier Tilloy (osomon) wrote : | # |
In webapp-
Component.
should probably be moved to the top-level BrowserWindow component (although it works as is today, it might break in the future if we need translated strings before instantiating the WebApp component).
Olivier Tilloy (osomon) wrote : | # |
In webapp-
console.
you might want to use console.warn(…) instead.
Olivier Tilloy (osomon) wrote : | # |
It looks like the updateCurrentView() function is called in one place only, maybe its implementation can be moved to the Component.
Olivier Tilloy (osomon) wrote : | # |
463 + if (successful && credentialsId) {
Isn’t 'credentialsId' guaranteed to be non-null if 'successful' is true? Or are you checking that it’s ≠ 0 as well? If not, I would say that the 'successful' parameter is redundant.
- 783. By Alberto Mardegan
-
Address review comments
Alberto Mardegan (mardy) wrote : | # |
> 118 - asynchronous: true
>
> Why did you remove this attribute from the Loader?
I'm not sure; this was in the branch by Alex, on which I based my work. Let's ask him later.
> In webapp-
> console.
> you might want to use console.warn(…) instead.
It can be that cookies are not moved because the OA cookies are older then those in the webapp; actually, this is what will happen most of the times. So, the cookies not being moved is not really an error condition.
All your other suggestions have now been implemented.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:783
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:783
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Chris Coulson (chrisccoulson) wrote : | # |
> Scratch the above comment, I hadn’t noticed that WebContext was resolving to
> UbuntuWebContex
>
> However this change will break the browser, because it means we instantiate
> several contexts with the same datapath (which is the reason why the shared
> context is a singleton in the first place).
We should really enforce this clearly in Oxide (currently, instantiating more than one WebContext with the same data path will result in obscure aborts like bug 1278315, but we could do an explicit abort with a more helpful error message)
- 784. By Alberto Mardegan
-
From trunk
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Fix facebook content hub share, the proper share API was not enabled
to access from the webapp-container. (LP: #1386682)
[ Riccardo Padovani ]
* Enabled swipe gesture to delete a bookmark from the new tab view
(LP: #1351165)
* Fixed #1351149 - Opening a page from the history view should do it
in a new tab (LP: #1351149)
[ Alexandre Abreu ]
* Fix AP tests for webapp-container (LP: #1389194)
* Fix an inconsistent property binding that is mostly more than
annoying when the override mechanism is used in certain cases (e.g.
when the override does not directly implement the webview),
[ Olivier Tilloy ]
* Adjust the new tab view’s background colour to match the visual
spec. (LP: #1389610)
* Clean up the AddressBar component, and convert a number of related
autopilot tests to QML tests.
* Update dependency names for QML modules (but keep the old name as
well for backward compatibility).
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:784
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Olivier Tilloy (osomon) wrote : | # |
The following autopilot test is broken:
webapp_
(it wasn’t caught by the CI job because it doesn’t run the webapp_container test suite yet, but I’ve asked CI to add it).
- 785. By Alberto Mardegan
-
Revert alias on dataPath
Aliases work only on ids, not on property names.
Import Ubuntu.Web so that dataLocation is defined.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:785
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Olivier Tilloy (osomon) wrote : | # |
This looks good now, thanks!
- 786. By Alberto Mardegan
-
OA: never set cookie mode to persistent
Olivier Tilloy (osomon) wrote : | # |
In this last change, is the "webContextSess
If so, the change looks ok to me, but a comment to explain that would be welcome, as it might seem like black magic to an external developer trying to understand the code.
- 787. By Alberto Mardegan
-
Add comment
- 788. By Alberto Mardegan
-
merge from trunk
[ CI bot ]
* Resync trunk
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Make use of the hostMappingRules in oxide and expose it in the
webcontext Improve container url AP tests with newly introduced
hostmapping in oxide 1.3
* HTML5 apps are currently using a specific container/launcher as
their runtime. They should use the webapp container instead. (LP:
#1392281, #1388988)
[ Olivier Tilloy ]
* Update translation template.
[ Michael Sheldon ]
* Add mimetype and file extension mappings for the new EBooks
ContentType. (LP: #1383732)
[ Olivier Tilloy ]
* Update runtime dependencies of -autopilot packages. Now that
autopilot has been removed from touch images, autopilot-touch is
what we should depend on to ensure all dependencies are correctly
installed prior to running tests using phablet-test-run.
* Factor the security certificate details popover out of the
AddressBar component, for improved maintainability.
* Simplify quite a bit the machinery needed to set up the QML tests.
* Always load the webview for a new tab right away. (LP: #1391609)
* Set a stroke color on toolbar buttons. (LP: #1351200)
* Add a sanity unit test that runs flake8 on the autopilot tests code.
* No-change rebuild against Qt 5.3.2.
Preview Diff
1 | === modified file 'src/app/webcontainer/AccountsPage.qml' | |||
2 | --- src/app/webcontainer/AccountsPage.qml 2014-08-21 15:15:21 +0000 | |||
3 | +++ src/app/webcontainer/AccountsPage.qml 2014-11-25 15:01:18 +0000 | |||
4 | @@ -25,12 +25,10 @@ | |||
5 | 25 | 25 | ||
6 | 26 | property alias accountProvider: accountsLogin.accountProvider | 26 | property alias accountProvider: accountsLogin.accountProvider |
7 | 27 | property alias applicationName: accountsLogin.applicationName | 27 | property alias applicationName: accountsLogin.applicationName |
14 | 28 | property var webappCookieStore: null | 28 | |
15 | 29 | property var onlineAccountStoreComponent: null | 29 | signal done(bool successful, var credentialsId) |
16 | 30 | 30 | ||
17 | 31 | signal done() | 31 | visible: true |
12 | 32 | |||
13 | 33 | visible: false | ||
18 | 34 | anchors.fill: parent | 32 | anchors.fill: parent |
19 | 35 | 33 | ||
20 | 36 | AccountsLoginPage { | 34 | AccountsLoginPage { |
21 | @@ -38,32 +36,10 @@ | |||
22 | 38 | 36 | ||
23 | 39 | anchors.fill: parent | 37 | anchors.fill: parent |
24 | 40 | 38 | ||
25 | 41 | QtObject { | ||
26 | 42 | id: internal | ||
27 | 43 | function onMoved(result) { | ||
28 | 44 | webappCookieStore.moved.disconnect(internal.onMoved) | ||
29 | 45 | if (!result) { | ||
30 | 46 | console.error("Unable to move cookies") | ||
31 | 47 | } | ||
32 | 48 | accountsPage.done() | ||
33 | 49 | } | ||
34 | 50 | } | ||
35 | 51 | |||
36 | 52 | onDone: { | 39 | onDone: { |
37 | 53 | if (!accountsPage.visible) | 40 | if (!accountsPage.visible) |
38 | 54 | return | 41 | return |
51 | 55 | if (!credentialsId) { | 42 | accountsPage.done(credentialsId != null, credentialsId) |
40 | 56 | accountsPage.done() | ||
41 | 57 | return | ||
42 | 58 | } | ||
43 | 59 | |||
44 | 60 | if (webappCookieStore) { | ||
45 | 61 | var instance = onlineAccountStoreComponent.createObject(accountsLogin, { "accountId": credentialsId }) | ||
46 | 62 | webappCookieStore.moved.connect(internal.onMoved) | ||
47 | 63 | webappCookieStore.moveFrom(instance) | ||
48 | 64 | } else { | ||
49 | 65 | accountsPage.done() | ||
50 | 66 | } | ||
52 | 67 | } | 43 | } |
53 | 68 | } | 44 | } |
54 | 69 | } | 45 | } |
55 | 70 | 46 | ||
56 | === modified file 'src/app/webcontainer/WebApp.qml' | |||
57 | --- src/app/webcontainer/WebApp.qml 2014-11-19 17:16:38 +0000 | |||
58 | +++ src/app/webcontainer/WebApp.qml 2014-11-25 15:01:18 +0000 | |||
59 | @@ -40,6 +40,7 @@ | |||
60 | 40 | property alias webviewOverrideFile: webview.webviewOverrideFile | 40 | property alias webviewOverrideFile: webview.webviewOverrideFile |
61 | 41 | property alias blockOpenExternalUrls: webview.blockOpenExternalUrls | 41 | property alias blockOpenExternalUrls: webview.blockOpenExternalUrls |
62 | 42 | property alias localUserAgentOverride: webview.localUserAgentOverride | 42 | property alias localUserAgentOverride: webview.localUserAgentOverride |
63 | 43 | property alias dataPath: webview.dataPath | ||
64 | 43 | property alias runningLocalApplication: webview.runningLocalApplication | 44 | property alias runningLocalApplication: webview.runningLocalApplication |
65 | 44 | 45 | ||
66 | 45 | property bool backForwardButtonsVisible: false | 46 | property bool backForwardButtonsVisible: false |
67 | 46 | 47 | ||
68 | === modified file 'src/app/webcontainer/WebViewImplOxide.qml' | |||
69 | --- src/app/webcontainer/WebViewImplOxide.qml 2014-11-20 16:46:17 +0000 | |||
70 | +++ src/app/webcontainer/WebViewImplOxide.qml 2014-11-25 15:01:18 +0000 | |||
71 | @@ -34,6 +34,7 @@ | |||
72 | 34 | property string localUserAgentOverride: "" | 34 | property string localUserAgentOverride: "" |
73 | 35 | property var webappUrlPatterns: null | 35 | property var webappUrlPatterns: null |
74 | 36 | property string popupRedirectionUrlPrefixPattern: "" | 36 | property string popupRedirectionUrlPrefixPattern: "" |
75 | 37 | property url dataPath | ||
76 | 37 | 38 | ||
77 | 38 | // Mostly used for testing & avoid external urls to | 39 | // Mostly used for testing & avoid external urls to |
78 | 39 | // "leak" in the default browser | 40 | // "leak" in the default browser |
79 | @@ -47,6 +48,10 @@ | |||
80 | 47 | 48 | ||
81 | 48 | currentWebview: webview | 49 | currentWebview: webview |
82 | 49 | 50 | ||
83 | 51 | context: WebContext { | ||
84 | 52 | dataPath: webview.dataPath | ||
85 | 53 | } | ||
86 | 54 | |||
87 | 50 | preferences.allowFileAccessFromFileUrls: runningLocalApplication | 55 | preferences.allowFileAccessFromFileUrls: runningLocalApplication |
88 | 51 | preferences.allowUniversalAccessFromFileUrls: runningLocalApplication | 56 | preferences.allowUniversalAccessFromFileUrls: runningLocalApplication |
89 | 52 | 57 | ||
90 | 53 | 58 | ||
91 | === modified file 'src/app/webcontainer/WebViewImplWebkit.qml' | |||
92 | --- src/app/webcontainer/WebViewImplWebkit.qml 2014-11-12 21:24:10 +0000 | |||
93 | +++ src/app/webcontainer/WebViewImplWebkit.qml 2014-11-25 15:01:18 +0000 | |||
94 | @@ -35,6 +35,7 @@ | |||
95 | 35 | property var webappUrlPatterns: null | 35 | property var webappUrlPatterns: null |
96 | 36 | property string localUserAgentOverride: "" | 36 | property string localUserAgentOverride: "" |
97 | 37 | property string popupRedirectionUrlPrefixPattern: "" | 37 | property string popupRedirectionUrlPrefixPattern: "" |
98 | 38 | property url dataPath // unused | ||
99 | 38 | property bool runningLocalApplication: false | 39 | property bool runningLocalApplication: false |
100 | 39 | 40 | ||
101 | 40 | function getUAString() { | 41 | function getUAString() { |
102 | 41 | 42 | ||
103 | === modified file 'src/app/webcontainer/WebappContainerWebview.qml' | |||
104 | --- src/app/webcontainer/WebappContainerWebview.qml 2014-11-13 00:05:18 +0000 | |||
105 | +++ src/app/webcontainer/WebappContainerWebview.qml 2014-11-25 15:01:18 +0000 | |||
106 | @@ -30,6 +30,7 @@ | |||
107 | 30 | property bool withOxide: false | 30 | property bool withOxide: false |
108 | 31 | property bool developerExtrasEnabled: false | 31 | property bool developerExtrasEnabled: false |
109 | 32 | property string webappName: "" | 32 | property string webappName: "" |
110 | 33 | property url dataPath | ||
111 | 33 | property var currentWebview: webappContainerWebViewLoader.item ? | 34 | property var currentWebview: webappContainerWebViewLoader.item ? |
112 | 34 | webappContainerWebViewLoader.item.currentWebview | 35 | webappContainerWebViewLoader.item.currentWebview |
113 | 35 | : null | 36 | : null |
114 | @@ -44,9 +45,10 @@ | |||
115 | 44 | id: webappContainerWebViewLoader | 45 | id: webappContainerWebViewLoader |
116 | 45 | objectName: "containerWebviewLoader" | 46 | objectName: "containerWebviewLoader" |
117 | 46 | anchors.fill: parent | 47 | anchors.fill: parent |
118 | 47 | asynchronous: true | ||
119 | 48 | } | 48 | } |
120 | 49 | 49 | ||
121 | 50 | onUrlChanged: if (webappContainerWebViewLoader.item) webappContainerWebViewLoader.item.url = url | ||
122 | 51 | |||
123 | 50 | Component.onCompleted: { | 52 | Component.onCompleted: { |
124 | 51 | var webappEngineSource = | 53 | var webappEngineSource = |
125 | 52 | withOxide ? | 54 | withOxide ? |
126 | @@ -65,6 +67,7 @@ | |||
127 | 65 | { localUserAgentOverride: containerWebview.localUserAgentOverride | 67 | { localUserAgentOverride: containerWebview.localUserAgentOverride |
128 | 66 | , url: containerWebview.url | 68 | , url: containerWebview.url |
129 | 67 | , webappName: containerWebview.webappName | 69 | , webappName: containerWebview.webappName |
130 | 70 | , dataPath: dataPath | ||
131 | 68 | , webappUrlPatterns: containerWebview.webappUrlPatterns | 71 | , webappUrlPatterns: containerWebview.webappUrlPatterns |
132 | 69 | , developerExtrasEnabled: containerWebview.developerExtrasEnabled | 72 | , developerExtrasEnabled: containerWebview.developerExtrasEnabled |
133 | 70 | , popupRedirectionUrlPrefixPattern: containerWebview.popupRedirectionUrlPrefixPattern | 73 | , popupRedirectionUrlPrefixPattern: containerWebview.popupRedirectionUrlPrefixPattern |
134 | 71 | 74 | ||
135 | === modified file 'src/app/webcontainer/chrome-cookie-store.cpp' | |||
136 | --- src/app/webcontainer/chrome-cookie-store.cpp 2014-09-18 13:37:07 +0000 | |||
137 | +++ src/app/webcontainer/chrome-cookie-store.cpp 2014-11-25 15:01:18 +0000 | |||
138 | @@ -33,19 +33,6 @@ | |||
139 | 33 | this, SLOT(oxideCookiesUpdated(const QList<QNetworkCookie>&))); | 33 | this, SLOT(oxideCookiesUpdated(const QList<QNetworkCookie>&))); |
140 | 34 | } | 34 | } |
141 | 35 | 35 | ||
142 | 36 | void ChromeCookieStore::setHomepage(const QUrl& homepage) { | ||
143 | 37 | if (homepage == m_homepage) | ||
144 | 38 | return; | ||
145 | 39 | |||
146 | 40 | m_homepage = homepage; | ||
147 | 41 | |||
148 | 42 | emit homepageChanged(); | ||
149 | 43 | } | ||
150 | 44 | |||
151 | 45 | QUrl ChromeCookieStore::homepage() const { | ||
152 | 46 | return m_homepage; | ||
153 | 47 | } | ||
154 | 48 | |||
155 | 49 | void ChromeCookieStore::setOxideStoreBackend(QObject* backend) | 36 | void ChromeCookieStore::setOxideStoreBackend(QObject* backend) |
156 | 50 | { | 37 | { |
157 | 51 | m_cookieHelper->setOxideStoreBackend(backend); | 38 | m_cookieHelper->setOxideStoreBackend(backend); |
158 | 52 | 39 | ||
159 | === modified file 'src/app/webcontainer/chrome-cookie-store.h' | |||
160 | --- src/app/webcontainer/chrome-cookie-store.h 2014-09-18 13:37:07 +0000 | |||
161 | +++ src/app/webcontainer/chrome-cookie-store.h 2014-11-25 15:01:18 +0000 | |||
162 | @@ -30,7 +30,6 @@ | |||
163 | 30 | { | 30 | { |
164 | 31 | Q_OBJECT | 31 | Q_OBJECT |
165 | 32 | 32 | ||
166 | 33 | Q_PROPERTY(QUrl homepage READ homepage WRITE setHomepage NOTIFY homepageChanged) | ||
167 | 34 | Q_PROPERTY(QString dbPath READ dbPath WRITE setDbPath NOTIFY dbPathChanged) | 33 | Q_PROPERTY(QString dbPath READ dbPath WRITE setDbPath NOTIFY dbPathChanged) |
168 | 35 | Q_PROPERTY(QObject* oxideStoreBackend READ oxideStoreBackend WRITE setOxideStoreBackend NOTIFY oxideStoreBackendChanged) | 34 | Q_PROPERTY(QObject* oxideStoreBackend READ oxideStoreBackend WRITE setOxideStoreBackend NOTIFY oxideStoreBackendChanged) |
169 | 36 | 35 | ||
170 | @@ -41,10 +40,6 @@ | |||
171 | 41 | void setDbPath(const QString& path); | 40 | void setDbPath(const QString& path); |
172 | 42 | QString dbPath() const; | 41 | QString dbPath() const; |
173 | 43 | 42 | ||
174 | 44 | // dbpaths | ||
175 | 45 | void setHomepage(const QUrl& path); | ||
176 | 46 | QUrl homepage() const; | ||
177 | 47 | |||
178 | 48 | // oxideStoreBackend | 43 | // oxideStoreBackend |
179 | 49 | void setOxideStoreBackend(QObject* backend); | 44 | void setOxideStoreBackend(QObject* backend); |
180 | 50 | QObject* oxideStoreBackend() const; | 45 | QObject* oxideStoreBackend() const; |
181 | @@ -55,7 +50,6 @@ | |||
182 | 55 | Q_SIGNALS: | 50 | Q_SIGNALS: |
183 | 56 | void dbPathChanged(); | 51 | void dbPathChanged(); |
184 | 57 | void oxideStoreBackendChanged(); | 52 | void oxideStoreBackendChanged(); |
185 | 58 | void homepageChanged(); | ||
186 | 59 | 53 | ||
187 | 60 | private Q_SLOTS: | 54 | private Q_SLOTS: |
188 | 61 | void oxideCookiesReceived(int requestId, const QVariant& cookies); | 55 | void oxideCookiesReceived(int requestId, const QVariant& cookies); |
189 | @@ -67,7 +61,6 @@ | |||
190 | 67 | 61 | ||
191 | 68 | private: | 62 | private: |
192 | 69 | OxideCookieHelper* m_cookieHelper; | 63 | OxideCookieHelper* m_cookieHelper; |
193 | 70 | QUrl m_homepage; | ||
194 | 71 | QString m_dbPath; | 64 | QString m_dbPath; |
195 | 72 | }; | 65 | }; |
196 | 73 | 66 | ||
197 | 74 | 67 | ||
198 | === modified file 'src/app/webcontainer/cookie-store.cpp' | |||
199 | --- src/app/webcontainer/cookie-store.cpp 2014-08-26 09:49:32 +0000 | |||
200 | +++ src/app/webcontainer/cookie-store.cpp 2014-11-25 15:01:18 +0000 | |||
201 | @@ -91,8 +91,20 @@ | |||
202 | 91 | if (Q_UNLIKELY(!request)) | 91 | if (Q_UNLIKELY(!request)) |
203 | 92 | return; | 92 | return; |
204 | 93 | 93 | ||
205 | 94 | QDateTime lastRemoteCookieUpdate = | ||
206 | 95 | request->_cookieStore->lastUpdateTimeStamp(); | ||
207 | 96 | QDateTime lastLocalCookieUpdate = lastUpdateTimeStamp(); | ||
208 | 97 | |||
209 | 94 | delete request; | 98 | delete request; |
210 | 95 | 99 | ||
211 | 100 | if (lastRemoteCookieUpdate.isValid() && | ||
212 | 101 | lastLocalCookieUpdate.isValid() && | ||
213 | 102 | (lastRemoteCookieUpdate < lastLocalCookieUpdate)) | ||
214 | 103 | { | ||
215 | 104 | Q_EMIT moved(false); | ||
216 | 105 | return; | ||
217 | 106 | } | ||
218 | 107 | |||
219 | 96 | connect(this, &CookieStore::cookiesSet, | 108 | connect(this, &CookieStore::cookiesSet, |
220 | 97 | this, &CookieStore::moved); | 109 | this, &CookieStore::moved); |
221 | 98 | 110 | ||
222 | @@ -104,26 +116,6 @@ | |||
223 | 104 | if (Q_UNLIKELY(!store)) | 116 | if (Q_UNLIKELY(!store)) |
224 | 105 | return; | 117 | return; |
225 | 106 | 118 | ||
226 | 107 | QDateTime lastRemoteCookieUpdate = store->lastUpdateTimeStamp(); | ||
227 | 108 | QDateTime lastLocalCookieUpdate = lastUpdateTimeStamp(); | ||
228 | 109 | |||
229 | 110 | // Disabled for now since. | ||
230 | 111 | // There is an obvious race if the WebView is instanciated | ||
231 | 112 | // (since it creates a cookies db file at creation time). | ||
232 | 113 | // But when delaying the creation, only using the WebContext to | ||
233 | 114 | // access the cookieManager, and manually creating a cookies db file | ||
234 | 115 | // if none is found (since the cookie manager does not create one | ||
235 | 116 | // when setting its cookies), something fails. | ||
236 | 117 | #if 0 | ||
237 | 118 | if (lastRemoteCookieUpdate.isValid() && | ||
238 | 119 | lastLocalCookieUpdate.isValid() && | ||
239 | 120 | (lastRemoteCookieUpdate < lastLocalCookieUpdate)) | ||
240 | 121 | { | ||
241 | 122 | Q_EMIT moved(false); | ||
242 | 123 | return; | ||
243 | 124 | } | ||
244 | 125 | #endif | ||
245 | 126 | |||
246 | 127 | CookieStoreRequest* storeRequest = new CookieStoreRequest(store); | 119 | CookieStoreRequest* storeRequest = new CookieStoreRequest(store); |
247 | 128 | _currentStoreRequests.insert(storeRequest, true); | 120 | _currentStoreRequests.insert(storeRequest, true); |
248 | 129 | 121 | ||
249 | 130 | 122 | ||
250 | === modified file 'src/app/webcontainer/online-accounts-cookie-store.cpp' | |||
251 | --- src/app/webcontainer/online-accounts-cookie-store.cpp 2014-08-05 00:25:20 +0000 | |||
252 | +++ src/app/webcontainer/online-accounts-cookie-store.cpp 2014-11-25 15:01:18 +0000 | |||
253 | @@ -116,15 +116,14 @@ | |||
254 | 116 | 116 | ||
255 | 117 | if (arguments.count() > 1) | 117 | if (arguments.count() > 1) |
256 | 118 | { | 118 | { |
260 | 119 | QDateTime t; | 119 | qint64 timeStamp = arguments.at(1).toLongLong(); |
261 | 120 | QVariant timeStampVariant(arguments.at(1)); | 120 | if (timeStamp != 0) |
259 | 121 | if (timeStampVariant.canConvert(QMetaType::LongLong)) | ||
262 | 122 | { | 121 | { |
263 | 123 | qDebug() << "Got a cookie timestamp of" | 122 | qDebug() << "Got a cookie timestamp of" |
265 | 124 | << arguments.at(1).toLongLong() | 123 | << timeStamp |
266 | 125 | << "from Online Accounts DBUS cookiesForIdentity() call."; | 124 | << "from Online Accounts DBUS cookiesForIdentity() call."; |
267 | 126 | 125 | ||
269 | 127 | t.fromMSecsSinceEpoch(arguments.at(1).toLongLong() * 1000); | 126 | QDateTime t = QDateTime::fromMSecsSinceEpoch(timeStamp * 1000); |
270 | 128 | updateLastUpdateTimestamp(t); | 127 | updateLastUpdateTimestamp(t); |
271 | 129 | } | 128 | } |
272 | 130 | } | 129 | } |
273 | 131 | 130 | ||
274 | === modified file 'src/app/webcontainer/oxide-cookie-helper.cpp' | |||
275 | --- src/app/webcontainer/oxide-cookie-helper.cpp 2014-10-03 11:47:36 +0000 | |||
276 | +++ src/app/webcontainer/oxide-cookie-helper.cpp 2014-11-25 15:01:18 +0000 | |||
277 | @@ -53,6 +53,7 @@ | |||
278 | 53 | m_backend(0), | 53 | m_backend(0), |
279 | 54 | q_ptr(q) | 54 | q_ptr(q) |
280 | 55 | { | 55 | { |
281 | 56 | qRegisterMetaType<QList<QNetworkCookie> >(); | ||
282 | 56 | } | 57 | } |
283 | 57 | 58 | ||
284 | 58 | void OxideCookieHelperPrivate::setCookies(const QList<QNetworkCookie>& cookies) | 59 | void OxideCookieHelperPrivate::setCookies(const QList<QNetworkCookie>& cookies) |
285 | @@ -75,7 +76,7 @@ | |||
286 | 75 | /* We don't simply use Q_EMIT because we want the signal to be emitted | 76 | /* We don't simply use Q_EMIT because we want the signal to be emitted |
287 | 76 | * asynchronously */ | 77 | * asynchronously */ |
288 | 77 | QMetaObject::invokeMethod(q, "cookiesSet", Qt::QueuedConnection, | 78 | QMetaObject::invokeMethod(q, "cookiesSet", Qt::QueuedConnection, |
290 | 78 | Q_ARG(const QList<QNetworkCookie>&, cookies)); | 79 | Q_ARG(QList<QNetworkCookie>, cookies)); |
291 | 79 | return; | 80 | return; |
292 | 80 | } | 81 | } |
293 | 81 | 82 | ||
294 | @@ -119,8 +120,8 @@ | |||
295 | 119 | QMetaObject::invokeMethod(m_backend, "setNetworkCookies", | 120 | QMetaObject::invokeMethod(m_backend, "setNetworkCookies", |
296 | 120 | Qt::DirectConnection, | 121 | Qt::DirectConnection, |
297 | 121 | Q_RETURN_ARG(int, requestId), | 122 | Q_RETURN_ARG(int, requestId), |
300 | 122 | Q_ARG(const QUrl&, url), | 123 | Q_ARG(QUrl, url), |
301 | 123 | Q_ARG(const QList<QNetworkCookie>&, it.value())); | 124 | Q_ARG(QList<QNetworkCookie>, it.value())); |
302 | 124 | if (Q_UNLIKELY(requestId == -1)) { | 125 | if (Q_UNLIKELY(requestId == -1)) { |
303 | 125 | m_failedCookies.append(cookiesWithDomain(it.value(), url.host())); | 126 | m_failedCookies.append(cookiesWithDomain(it.value(), url.host())); |
304 | 126 | } else { | 127 | } else { |
305 | @@ -133,7 +134,7 @@ | |||
306 | 133 | /* We don't simply use Q_EMIT because we want the signal to be emitted | 134 | /* We don't simply use Q_EMIT because we want the signal to be emitted |
307 | 134 | * asynchronously */ | 135 | * asynchronously */ |
308 | 135 | QMetaObject::invokeMethod(q, "cookiesSet", Qt::QueuedConnection, | 136 | QMetaObject::invokeMethod(q, "cookiesSet", Qt::QueuedConnection, |
310 | 136 | Q_ARG(const QList<QNetworkCookie>&, m_failedCookies)); | 137 | Q_ARG(QList<QNetworkCookie>, m_failedCookies)); |
311 | 137 | } | 138 | } |
312 | 138 | } | 139 | } |
313 | 139 | 140 | ||
314 | 140 | 141 | ||
315 | === modified file 'src/app/webcontainer/webapp-container.qml' | |||
316 | --- src/app/webcontainer/webapp-container.qml 2014-11-12 21:24:10 +0000 | |||
317 | +++ src/app/webcontainer/webapp-container.qml 2014-11-25 15:01:18 +0000 | |||
318 | @@ -19,6 +19,7 @@ | |||
319 | 19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 |
320 | 20 | import Ubuntu.Components 1.1 | 20 | import Ubuntu.Components 1.1 |
321 | 21 | import Ubuntu.UnityWebApps 0.1 as UnityWebApps | 21 | import Ubuntu.UnityWebApps 0.1 as UnityWebApps |
322 | 22 | import Ubuntu.Web 0.2 | ||
323 | 22 | import webcontainer.private 0.1 | 23 | import webcontainer.private 0.1 |
324 | 23 | import ".." | 24 | import ".." |
325 | 24 | 25 | ||
326 | @@ -43,64 +44,60 @@ | |||
327 | 43 | property string localUserAgentOverride: "" | 44 | property string localUserAgentOverride: "" |
328 | 44 | property bool blockOpenExternalUrls: false | 45 | property bool blockOpenExternalUrls: false |
329 | 45 | 46 | ||
331 | 46 | currentWebview: browser.currentWebview | 47 | currentWebview: webappViewLoader.item ? webappViewLoader.item.currentWebview : null |
332 | 47 | 48 | ||
333 | 48 | property bool runningLocalApplication: false | 49 | property bool runningLocalApplication: false |
334 | 49 | 50 | ||
335 | 50 | title: getWindowTitle() | 51 | title: getWindowTitle() |
336 | 51 | 52 | ||
337 | 52 | function getWindowTitle() { | 53 | function getWindowTitle() { |
338 | 54 | var webappViewTitle = webappViewLoader.item ? webappViewLoader.item.title : "" | ||
339 | 53 | if (typeof(webappName) === 'string' && webappName.length !== 0) { | 55 | if (typeof(webappName) === 'string' && webappName.length !== 0) { |
340 | 54 | return webappName | 56 | return webappName |
342 | 55 | } else if (browser.title) { | 57 | } else if (webappViewTitle) { |
343 | 56 | // TRANSLATORS: %1 refers to the current page’s title | 58 | // TRANSLATORS: %1 refers to the current page’s title |
345 | 57 | return i18n.tr("%1 - Ubuntu Web Browser").arg(browser.title) | 59 | return i18n.tr("%1 - Ubuntu Web Browser").arg(webappViewTitle) |
346 | 58 | } else { | 60 | } else { |
347 | 59 | return i18n.tr("Ubuntu Web Browser") | 61 | return i18n.tr("Ubuntu Web Browser") |
348 | 60 | } | 62 | } |
349 | 61 | } | 63 | } |
350 | 62 | 64 | ||
383 | 63 | WebApp { | 65 | Component { |
384 | 64 | id: browser | 66 | id: webappViewComponent |
385 | 65 | 67 | ||
386 | 66 | // Initially set as non visible to leave a chance | 68 | WebApp { |
387 | 67 | // for the OA dialog to appear | 69 | id: browser |
388 | 68 | visible: false | 70 | |
389 | 69 | 71 | url: accountProvider.length !== 0 ? "" : root.url | |
390 | 70 | url: accountProvider.length === 0 ? root.url : "" | 72 | |
391 | 71 | 73 | dataPath: webappDataLocation | |
392 | 72 | chromeVisible: root.chromeVisible | 74 | webappName: root.webappName |
393 | 73 | backForwardButtonsVisible: root.backForwardButtonsVisible | 75 | chromeVisible: root.chromeVisible |
394 | 74 | developerExtrasEnabled: root.developerExtrasEnabled | 76 | backForwardButtonsVisible: root.backForwardButtonsVisible |
395 | 75 | oxide: root.oxide | 77 | developerExtrasEnabled: root.developerExtrasEnabled |
396 | 76 | webappModelSearchPath: root.webappModelSearchPath | 78 | oxide: root.oxide |
397 | 77 | webappUrlPatterns: root.webappUrlPatterns | 79 | webappModelSearchPath: root.webappModelSearchPath |
398 | 78 | blockOpenExternalUrls: root.blockOpenExternalUrls | 80 | webappUrlPatterns: root.webappUrlPatterns |
399 | 79 | 81 | blockOpenExternalUrls: root.blockOpenExternalUrls | |
400 | 80 | popupRedirectionUrlPrefixPattern: root.popupRedirectionUrlPrefixPattern | 82 | |
401 | 81 | 83 | popupRedirectionUrlPrefixPattern: root.popupRedirectionUrlPrefixPattern | |
402 | 82 | localUserAgentOverride: getLocalUserAgentOverrideIfAny() | 84 | |
403 | 83 | 85 | localUserAgentOverride: getLocalUserAgentOverrideIfAny() | |
404 | 84 | runningLocalApplication: root.runningLocalApplication | 86 | |
405 | 85 | webviewOverrideFile: root.webviewOverrideFile | 87 | runningLocalApplication: root.runningLocalApplication |
406 | 86 | 88 | webviewOverrideFile: root.webviewOverrideFile | |
407 | 87 | anchors.fill: parent | 89 | |
408 | 88 | 90 | anchors.fill: parent | |
409 | 89 | webbrowserWindow: webbrowserWindowProxy | 91 | |
410 | 90 | 92 | webbrowserWindow: webbrowserWindowProxy | |
411 | 91 | onWebappNameChanged: { | 93 | |
412 | 92 | if (root.webappName !== browser.webappName) { | 94 | onWebappNameChanged: { |
413 | 93 | root.webappName = browser.webappName; | 95 | if (root.webappName !== browser.webappName) { |
414 | 94 | root.title = getWindowTitle(); | 96 | root.webappName = browser.webappName; |
415 | 97 | root.title = getWindowTitle(); | ||
416 | 98 | } | ||
417 | 95 | } | 99 | } |
418 | 96 | } | 100 | } |
419 | 97 | |||
420 | 98 | onCurrentWebviewChanged: { | ||
421 | 99 | if (currentWebview) | ||
422 | 100 | root.updateCurrentView() | ||
423 | 101 | } | ||
424 | 102 | |||
425 | 103 | Component.onCompleted: i18n.domain = "webbrowser-app" | ||
426 | 104 | } | 101 | } |
427 | 105 | 102 | ||
428 | 106 | function getLocalUserAgentOverrideIfAny() { | 103 | function getLocalUserAgentOverrideIfAny() { |
429 | @@ -139,17 +136,72 @@ | |||
430 | 139 | } | 136 | } |
431 | 140 | } | 137 | } |
432 | 141 | 138 | ||
433 | 139 | Loader { | ||
434 | 140 | id: webappViewLoader | ||
435 | 141 | anchors.fill: parent | ||
436 | 142 | |||
437 | 143 | property var credentialsId: null | ||
438 | 144 | property var webContextSessionCookieMode: null | ||
439 | 145 | property var webappDataLocation: credentialsId != null ? dataLocation + "/id-" + credentialsId : dataLocation | ||
440 | 146 | } | ||
441 | 147 | |||
442 | 148 | function onCookiesMoved(result) { | ||
443 | 149 | if (__webappCookieStore) { | ||
444 | 150 | __webappCookieStore.moved.disconnect(onCookiesMoved) | ||
445 | 151 | } | ||
446 | 152 | if (!result) { | ||
447 | 153 | console.log("Cookies were not moved") | ||
448 | 154 | } | ||
449 | 155 | webappViewLoader.item.url = root.url | ||
450 | 156 | } | ||
451 | 157 | |||
452 | 158 | function moveCookies(credentialsId) { | ||
453 | 159 | if (!__webappCookieStore) { | ||
454 | 160 | var context = webappViewLoader.item.currentWebview.context | ||
455 | 161 | __webappCookieStore = oxideCookieStoreComponent.createObject(this, { | ||
456 | 162 | "oxideStoreBackend": context.cookieManager, | ||
457 | 163 | "dbPath": context.dataPath + "/cookies.sqlite" | ||
458 | 164 | }) | ||
459 | 165 | } | ||
460 | 166 | |||
461 | 167 | var storeComponent = localCookieStoreDbPath.length !== 0 ? | ||
462 | 168 | localCookieStoreComponent : onlineAccountStoreComponent | ||
463 | 169 | |||
464 | 170 | var instance = storeComponent.createObject(root, { "accountId": credentialsId }) | ||
465 | 171 | __webappCookieStore.moved.connect(onCookiesMoved) | ||
466 | 172 | __webappCookieStore.moveFrom(instance) | ||
467 | 173 | } | ||
468 | 174 | |||
469 | 142 | Connections { | 175 | Connections { |
470 | 143 | target: accountsPageComponentLoader.item | 176 | target: accountsPageComponentLoader.item |
472 | 144 | onDone: loadWebAppView() | 177 | onDone: { |
473 | 178 | if (successful) { | ||
474 | 179 | webappViewLoader.loaded.connect(function () { | ||
475 | 180 | if (webappViewLoader.status == Loader.Ready) { | ||
476 | 181 | moveCookies(webappViewLoader.credentialsId) | ||
477 | 182 | } | ||
478 | 183 | }); | ||
479 | 184 | webappViewLoader.credentialsId = credentialsId | ||
480 | 185 | // If we need to preserve session cookies, make sure that the | ||
481 | 186 | // mode is "restored" and not "persistent", or the cookies | ||
482 | 187 | // transferred from OA would be lost. | ||
483 | 188 | // We check if the webContextSessionCookieMode is defined and, if so, | ||
484 | 189 | // we override it in the webapp loader. | ||
485 | 190 | if (typeof webContextSessionCookieMode === "string") { | ||
486 | 191 | webappViewLoader.webContextSessionCookieMode = "restored" | ||
487 | 192 | } | ||
488 | 193 | |||
489 | 194 | webappViewLoader.sourceComponent = webappViewComponent | ||
490 | 195 | } | ||
491 | 196 | else { | ||
492 | 197 | loadWebAppView() | ||
493 | 198 | } | ||
494 | 199 | } | ||
495 | 145 | } | 200 | } |
496 | 146 | 201 | ||
497 | 147 | Component { | 202 | Component { |
498 | 148 | id: oxideCookieStoreComponent | 203 | id: oxideCookieStoreComponent |
499 | 149 | ChromeCookieStore { | 204 | ChromeCookieStore { |
500 | 150 | dbPath: dataLocation + "/cookies.sqlite" | ||
501 | 151 | homepage: root.url | ||
502 | 152 | oxideStoreBackend: browser.currentWebview ? browser.currentWebview.context.cookieManager : null | ||
503 | 153 | } | 205 | } |
504 | 154 | } | 206 | } |
505 | 155 | 207 | ||
506 | @@ -160,57 +212,47 @@ | |||
507 | 160 | } | 212 | } |
508 | 161 | } | 213 | } |
509 | 162 | 214 | ||
514 | 163 | Component { | 215 | Component.onCompleted: { |
515 | 164 | id: onlineAccountStoreComponent | 216 | i18n.domain = "webbrowser-app" |
512 | 165 | OnlineAccountsCookieStore { } | ||
513 | 166 | } | ||
516 | 167 | 217 | ||
517 | 168 | function updateCurrentView() { | ||
518 | 169 | // check if we are to display the login view | 218 | // check if we are to display the login view |
519 | 170 | // or directly switch to the webapp view | 219 | // or directly switch to the webapp view |
521 | 171 | if (accountProvider.length !== 0 && !__webappCookieStore && oxide) { | 220 | if (accountProvider.length !== 0 && oxide) { |
522 | 172 | loadLoginView(); | 221 | loadLoginView(); |
523 | 173 | } else { | 222 | } else { |
524 | 174 | loadWebAppView(); | 223 | loadWebAppView(); |
525 | 175 | } | 224 | } |
526 | 176 | } | 225 | } |
527 | 177 | 226 | ||
528 | 227 | Component { | ||
529 | 228 | id: onlineAccountStoreComponent | ||
530 | 229 | OnlineAccountsCookieStore { } | ||
531 | 230 | } | ||
532 | 231 | |||
533 | 178 | function loadLoginView() { | 232 | function loadLoginView() { |
534 | 179 | if (!__webappCookieStore) { | ||
535 | 180 | __webappCookieStore = oxideCookieStoreComponent.createObject(this) | ||
536 | 181 | } | ||
537 | 182 | accountsPageComponentLoader.setSource("AccountsPage.qml", { | 233 | accountsPageComponentLoader.setSource("AccountsPage.qml", { |
538 | 183 | "accountProvider": accountProvider, | 234 | "accountProvider": accountProvider, |
539 | 184 | "applicationName": unversionedAppId, | 235 | "applicationName": unversionedAppId, |
540 | 185 | "webappCookieStore": __webappCookieStore, | ||
541 | 186 | "onlineAccountStoreComponent": localCookieStoreDbPath.length !== 0 ? | ||
542 | 187 | localCookieStoreComponent : onlineAccountStoreComponent | ||
543 | 188 | }) | 236 | }) |
544 | 189 | } | 237 | } |
545 | 190 | 238 | ||
546 | 191 | function loadWebAppView() { | 239 | function loadWebAppView() { |
547 | 192 | if (accountsPageComponentLoader.item) | 240 | if (accountsPageComponentLoader.item) |
548 | 193 | accountsPageComponentLoader.item.visible = false | 241 | accountsPageComponentLoader.item.visible = false |
549 | 194 | browser.visible = true; | ||
550 | 195 | if (browser.currentWebview) { | ||
551 | 196 | browser.currentWebview.visible = true; | ||
552 | 197 | browser.webappName = root.webappName; | ||
553 | 198 | 242 | ||
560 | 199 | // As we use StateSaver to restore the URL, we need to check first if | 243 | webappViewLoader.loaded.connect(function () { |
561 | 200 | // it has not been set previously before setting the URL to the default property | 244 | if (webappViewLoader.status === Loader.Ready) { |
562 | 201 | // homepage. | 245 | // As we use StateSaver to restore the URL, we need to check first if |
563 | 202 | var current_url = browser.currentWebview.url.toString(); | 246 | // it has not been set previously before setting the URL to the default property |
564 | 203 | if (!current_url || current_url.length === 0) { | 247 | // homepage. |
565 | 204 | browser.currentWebview.url = root.url; | 248 | var webView = webappViewLoader.item.currentWebview |
566 | 249 | var current_url = webView.url.toString(); | ||
567 | 250 | if (!current_url || current_url.length === 0) { | ||
568 | 251 | webView.url = root.url | ||
569 | 252 | } | ||
570 | 205 | } | 253 | } |
579 | 206 | } | 254 | }); |
580 | 207 | } | 255 | webappViewLoader.sourceComponent = webappViewComponent |
573 | 208 | |||
574 | 209 | function updateBrowserUrl(url) { | ||
575 | 210 | root.url = url; | ||
576 | 211 | if (browser.currentWebview) { | ||
577 | 212 | browser.currentWebview.url = url; | ||
578 | 213 | } | ||
581 | 214 | } | 256 | } |
582 | 215 | 257 | ||
583 | 216 | // Handle runtime requests to open urls as defined | 258 | // Handle runtime requests to open urls as defined |
584 | @@ -223,7 +265,7 @@ | |||
585 | 223 | target: UriHandler | 265 | target: UriHandler |
586 | 224 | onOpened: { | 266 | onOpened: { |
587 | 225 | // only consider the first one (if multiple) | 267 | // only consider the first one (if multiple) |
589 | 226 | if (uris.length === 0 || !browser.currentWebview) { | 268 | if (uris.length === 0 || !root.currentWebview) { |
590 | 227 | return; | 269 | return; |
591 | 228 | } | 270 | } |
592 | 229 | var requestedUrl = uris[0].toString(); | 271 | var requestedUrl = uris[0].toString(); |
593 | @@ -232,7 +274,9 @@ | |||
594 | 232 | && requestedUrl.match(popupRedirectionUrlPrefixPattern)) { | 274 | && requestedUrl.match(popupRedirectionUrlPrefixPattern)) { |
595 | 233 | return; | 275 | return; |
596 | 234 | } | 276 | } |
598 | 235 | updateBrowserUrl(requestedUrl); | 277 | |
599 | 278 | root.url = requestedUrl | ||
600 | 279 | root.currentWebview.url = requestedUrl | ||
601 | 236 | } | 280 | } |
602 | 237 | } | 281 | } |
603 | 238 | } | 282 | } |
FAILED: Continuous integration, rev:772 jenkins. qa.ubuntu. com/job/ webbrowser- app-ci/ 1207/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/6142 jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 4175 jenkins. qa.ubuntu. com/job/ webbrowser- app-utopic- amd64-ci/ 406 jenkins. qa.ubuntu. com/job/ webbrowser- app-utopic- armhf-ci/ 406 jenkins. qa.ubuntu. com/job/ webbrowser- app-utopic- armhf-ci/ 406/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ webbrowser- app-utopic- i386-ci/ 406 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/5769 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/7394 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/7394/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 14972 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic/ 3536 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/4526 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/4526/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/webbrowser- app-ci/ 1207/rebuild
http://