From 74438d43ed88954c3be9da290df648ff6df1463c Mon Sep 17 00:00:00 2001 From: Jamie Wong Date: Tue, 27 Mar 2018 21:10:38 -0700 Subject: [PATCH] Fix methods of LazyPromise (#1059) --- src/builtins/bundle-loader.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/builtins/bundle-loader.js b/src/builtins/bundle-loader.js index d67b206999f..e60c0ae3119 100644 --- a/src/builtins/bundle-loader.js +++ b/src/builtins/bundle-loader.js @@ -73,9 +73,11 @@ function LazyPromise(executor) { } LazyPromise.prototype.then = function (onSuccess, onError) { - return this.promise || (this.promise = new Promise(this.executor).then(onSuccess, onError)); + if (this.promise === null) this.promise = new Promise(this.executor) + return this.promise.then(onSuccess, onError) }; LazyPromise.prototype.catch = function (onError) { - return this.promise || (this.promise = new Promise(this.executor).catch(onError)); + if (this.promise === null) this.promise = new Promise(this.executor) + return this.promise.catch(onError) };