Merge lp://qastaging/~artmello/webbrowser-app/webbrowser-app-statesaver into lp://qastaging/webbrowser-app

Proposed by Arthur Mello
Status: Rejected
Rejected by: Olivier Tilloy
Proposed branch: lp://qastaging/~artmello/webbrowser-app/webbrowser-app-statesaver
Merge into: lp://qastaging/webbrowser-app
Diff against target: 180 lines (+31/-1)
9 files modified
src/app/webbrowser/Browser.qml (+7/-0)
src/app/webbrowser/webbrowser-app.cpp (+3/-0)
src/app/webbrowser/webbrowser-app.qml (+2/-0)
src/app/webcontainer/WebApp.qml (+2/-0)
src/app/webcontainer/WebViewImplOxide.qml (+4/-0)
src/app/webcontainer/WebViewImplWebkit.qml (+4/-0)
src/app/webcontainer/WebappContainerWebview.qml (+3/-1)
src/app/webcontainer/webapp-container.cpp (+4/-0)
src/app/webcontainer/webapp-container.qml (+2/-0)
To merge this branch: bzr merge lp://qastaging/~artmello/webbrowser-app/webbrowser-app-statesaver
Reviewer Review Type Date Requested Status
Olivier Tilloy Disapprove
PS Jenkins bot continuous-integration Approve
Bill Filler (community) Needs Fixing
Review via email: mp+227737@code.qastaging.launchpad.net

Commit message

Save the last visited url for a webapp

Description of the change

Save the last visited url for a webapp

To post a comment you must log in.
633. By Arthur Mello

Add state saver to the webbrowser last visited url

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
634. By Arthur Mello

If a specialized url was provided to the webapp it is used instead of the state saved one

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

tried this out and there is one problem:

- for webapps (tested amazon and gmail), the state save/restore works only once and does not work correctly the second time
To test:
- open amazon
- navigate to a page
- kill -2 on the pid
- relaunch amazon
- verify that the last url was restored
- then navigate to a different page
- kill -2 on the pid
- relaunch amazon
- the first url that was saved is restored, not the last visited page

This works fine for webbrowser-app, just not webapps

review: Needs Fixing
635. By Arthur Mello

Change the property saved to fix the issue of not saving the correct values

Revision history for this message
Arthur Mello (artmello) wrote :

> tried this out and there is one problem:
>
> - for webapps (tested amazon and gmail), the state save/restore works only
> once and does not work correctly the second time
> To test:
> - open amazon
> - navigate to a page
> - kill -2 on the pid
> - relaunch amazon
> - verify that the last url was restored
> - then navigate to a different page
> - kill -2 on the pid
> - relaunch amazon
> - the first url that was saved is restored, not the last visited page
>
> This works fine for webbrowser-app, just not webapps

Seems to work on r635

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

I’ve tested only the browser app on desktop so far, and the general use case seems to work fine, however I’m seeing a case that doesn’t:

    webbrowser-app http://example.org
    killall -9 webbrowser-app
    webbrowser-app http://ubuntu.com

I expect the second invokation of webbrowser-app to open ubuntu.com, however the previous state is restored and it browses to example.org instead.

Note that this issue is most likely affecting desktop only, not phone, where this kind of URL opening will go through the UriHandler, which will ignore the saved state, according to documentation.

To address this, you probably need a mechanism similar to what you did for the webapp-container, where you recognize whether a URL was explicitly requested on the command line.

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

As a side note, I wonder whether this kind of functionality can be tested with autopilot? Would you mind checking with someone from QA? Since the StateSaver works only if all the ancestors of a given item have an id explicitly set, it seems very prone to regressions (if someone accidentally removes a seemingly unused id), and having an integration test would prevent such regressions.

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

From the looks of the diff, it seems WebViewImplWebkit doesn’t actually implement state restore.
While we want to get rid of the webkit implementation ASAP, for the time being we have to support it, so there should be feature parity where possible. You can easily force the use of webkit instead of oxide by passing "--webkit" as a command line parameter when launching webapp-container.

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

What exactly is the use case that requires an extra 'specializedUrlProvided' property (I remember you mentioned it yesterday, but I don’t remember exactly what it was)?

636. By Arthur Mello

Merge with trunk

637. By Arthur Mello

Make sure that if a url is provided as a parameter to webbrowser it will override the state saved url

Revision history for this message
Arthur Mello (artmello) wrote :

> I’ve tested only the browser app on desktop so far, and the general use case
> seems to work fine, however I’m seeing a case that doesn’t:
>
> webbrowser-app http://example.org
> killall -9 webbrowser-app
> webbrowser-app http://ubuntu.com
>
> I expect the second invokation of webbrowser-app to open ubuntu.com, however
> the previous state is restored and it browses to example.org instead.
>
> Note that this issue is most likely affecting desktop only, not phone, where
> this kind of URL opening will go through the UriHandler, which will ignore the
> saved state, according to documentation.
>
> To address this, you probably need a mechanism similar to what you did for the
> webapp-container, where you recognize whether a URL was explicitly requested
> on the command line.

Fixed on r637

638. By Arthur Mello

Implement the same strategy used on Oxide to WebKit

Revision history for this message
Arthur Mello (artmello) wrote :

> From the looks of the diff, it seems WebViewImplWebkit doesn’t actually
> implement state restore.
> While we want to get rid of the webkit implementation ASAP, for the time being
> we have to support it, so there should be feature parity where possible. You
> can easily force the use of webkit instead of oxide by passing "--webkit" as a
> command line parameter when launching webapp-container.

Fixed on r638

Revision history for this message
Arthur Mello (artmello) wrote :

> As a side note, I wonder whether this kind of functionality can be tested with
> autopilot? Would you mind checking with someone from QA? Since the StateSaver
> works only if all the ancestors of a given item have an id explicitly set, it
> seems very prone to regressions (if someone accidentally removes a seemingly
> unused id), and having an integration test would prevent such regressions.

I will check with QA guys to check how that could be done.

639. By Arthur Mello

Change the WebApp implementation to work on the same way as webbrowser

Revision history for this message
Arthur Mello (artmello) wrote :

> What exactly is the use case that requires an extra 'specializedUrlProvided'
> property (I remember you mentioned it yesterday, but I don’t remember exactly
> what it was)?

specializedUrlProvided was used to store the provided url to a webapp and, if it was set, we should ignore the state saved url. But, I think I found a better way to do that, it was changed on r639. This property is not used anymore

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

This might be working (I haven’t actually tested this time round), but the implementation doesn’t look right: from a semantics point of view, it doesn’t make sense to add a 'restoreUrl' parameter to the newTab(…) function in webbrowser-app.qml and to the openUrlInNewTab(…) function in Browser.qml. openUrlInNewTab(…) is being called in several other places where this parameter is meaningless.

Since in this iteration we are saving only one URL (that of the current tab), we should probably add a 'currentUrl' property to the top-level Browser component (or maybe even to the top-level BrowserView component, so that it’s shared between the two apps) that will be updated whenever the URL of the current webview changes (but not be a direct binding to currentWebview.url to avoid it being set when we don’t want to), and upon restore can be used to selectively open a new tab with the saved URL depending on the situation.

I have not tested the above suggestion, so there may be caveats, but the approach looks sounder to me.

On a related note, did you get feedback from the QA team on the feasability of autopilot tests for the feature? We would need a test that launches the app, browses to a given URL, stops the app, then launches it again and verifies that the URL is restored.

640. By Arthur Mello

Make sure that a new tab is not restored when created

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
641. By Arthur Mello

Create a property on TabsModel to store all opened urls

642. By Arthur Mello

Restore all opened urls

Revision history for this message
Arthur Mello (artmello) wrote :

Removed the restoreUrl parameter from the newTab function, as mentioned. Using the currentUrl property to store the last visited url.

Added to support to restore all the open tabs. I am trying to use the StateSaver to do that, but since it does not seem to be able to restore a model I am saving a list of open urls and creating new tabs during the restore process.

I am not restoring any tab if a url/list of urls is passed as a command line parameter. Should we keep that or open the provided urls as new tabs?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

tested latest debs on device build 153
Things are not working correctly for webbrowser-app. First time I opened two tabs and did kill -2 and it worked correctly, restoring tabs. Now everytime after that it won't save restore any urls regardless if I have single or multiple tabs. So something is broken.

webapp-container seems to be working correctly

review: Needs Fixing
643. By Arthur Mello

Remove option to restore all tabs
Add option to restore the last visited url

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:643
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/983/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2622/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2104
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-amd64-ci/182
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-armhf-ci/182
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-armhf-ci/182/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-utopic-i386-ci/182
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2754/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3865
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3865/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10581
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1758
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2359
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2359/artifact/work/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Arthur Mello (artmello) wrote :

I removed the support for restoring all the tabs and return the code to restore only the last current url. I tested the support for only the last current url on desktop and on last device image and it seems to be working as expected.

Took me some time debugging the error reported by Bill about restoring tabs. So basically I had added a "urls" property to the TabsModel component that stored a list of all urls opened on tabs. Since when restoring this list I need to create all webviews and populate the model correctly I was using a property on the Browser component with the value of this list. This Browser's property was the one stored by StateSaver. When this property was restored I call the properly function to create the tabs.

This seems to work correctly on desktop but on device the Browser property seems not to be updated as frequently as the TabsModel one. With this the wrong data was stored by StateSaver. If we try to print the value of the property (for debug purposes) the value is the same as the TabModel one. But if we call something like this console.log(browser["tabsUrls"]) the values was not always updated with the one from TabModels. Not sure why this is happening and I was not able to reproduce that on a simple qml code.

While we think on a better way to do that. I keep only the last current url code

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Superseded by https://code.launchpad.net/~osomon/webbrowser-app/persist-open-tabs/+merge/229920.
Thanks for your initial work on this Arthur!

review: Disapprove

Unmerged revisions

643. By Arthur Mello

Remove option to restore all tabs
Add option to restore the last visited url

642. By Arthur Mello

Restore all opened urls

641. By Arthur Mello

Create a property on TabsModel to store all opened urls

640. By Arthur Mello

Make sure that a new tab is not restored when created

639. By Arthur Mello

Change the WebApp implementation to work on the same way as webbrowser

638. By Arthur Mello

Implement the same strategy used on Oxide to WebKit

637. By Arthur Mello

Make sure that if a url is provided as a parameter to webbrowser it will override the state saved url

636. By Arthur Mello

Merge with trunk

635. By Arthur Mello

Change the property saved to fix the issue of not saving the correct values

634. By Arthur Mello

If a specialized url was provided to the webapp it is used instead of the state saved one

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: