[FIX] web: traceback when quickly clicking on back button

Before this rev., there might be a crash when the user quickly
clicked several times on the browser's back button. This crash
occurred in the code saving/restoring the scroll position of the
current action.

When clicking fast on the back button, several actions are
executed but don't wait for each other (those actions are triggered
by the hashchange event), so when it is fast, and mainly when the
appswitcher is involved, it may happen that we try to get the
scroll position of an action that isn't loaded yet.

opw~741814
This commit is contained in:
Aaron Bohy
2017-05-09 14:54:15 +02:00
parent e25563dca6
commit 7e98e32959
+7 -2
View File
@@ -175,13 +175,18 @@ var ViewManagerAction = WidgetAction.extend({
* @param {int} [scrollTop] the number of pixels to scroll
*/
set_scrollTop: function(scrollTop) {
this.widget.active_view.controller.set_scrollTop(scrollTop);
if (this.widget.active_view && this.widget.active_view.controller) {
this.widget.active_view.controller.set_scrollTop(scrollTop);
}
},
/**
* @return {int} the number of pixels the webclient is scrolled when leaving the action
*/
get_scrollTop: function() {
return this.widget.active_view.controller.get_scrollTop();
if (this.widget.active_view && this.widget.active_view.controller) {
return this.widget.active_view.controller.get_scrollTop();
}
return this._super.apply(this, arguments);
},
/**
* @return {Array} array of Objects that will be interpreted to display the breadcrumbs