From d1aa4e044d5b29e60ff10ac26ad66eae71ec914c Mon Sep 17 00:00:00 2001 From: Florian Simon Date: Wed, 14 Jun 2017 18:12:05 +0200 Subject: [PATCH] refresherController: do not assume that user-supplied promises have a finally() method Fallback to transparent then() instead --- js/angular/controller/refresherController.js | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/angular/controller/refresherController.js b/js/angular/controller/refresherController.js index c1a0d5fa4..710b215c3 100644 --- a/js/angular/controller/refresherController.js +++ b/js/angular/controller/refresherController.js @@ -354,9 +354,24 @@ IonicModule var q = $scope.$onRefresh(); if (q && q.then) { - q['finally'](function() { - $scope.$broadcast('scroll.refreshComplete'); - }); + if (q['finally']) { + q['finally'](broadcastRefreshEnd); + } else { + q.then( + function(payload) { + broadcastRefreshEnd(); + return payload; + }, + function(error) { + broadcastRefreshEnd(); + throw error; + } + ); + } + } + + function broadcastRefreshEnd() { + $scope.$broadcast('scroll.refreshComplete'); } }