From b525b0f68ce538a10fceb9216ac5a96782a7a809 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 12 Jul 2019 23:42:00 +0200 Subject: [PATCH 1/4] Fix "wait for all" not resolving when given empty list of promises --- index.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/index.bs b/index.bs index 3b03fa7..54912c8 100644 --- a/index.bs +++ b/index.bs @@ -269,6 +269,7 @@ To wait for a 1. Let |index| be 0. 1. Let |total| be |promises|'s [=list/size=]. 1. Let |result| be a list containing |total| null values. +1. If |total| is 0, then perform |successSteps| given |result| and abort these steps. 1. [=list/For each=] |promise| of |promises|: 1. Let |promiseIndex| be |index|. 1. Let |fulfillmentHandler| be a built-in function that takes an argument |arg| performs the following steps: From 8ba9c9cdf827218419741f84dfcea2a09ba1e3a9 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 16 Jul 2019 23:31:30 +0200 Subject: [PATCH 2/4] Queue a microtask before performing successSteps --- index.bs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 54912c8..7ab89d7 100644 --- a/index.bs +++ b/index.bs @@ -13,7 +13,10 @@ Ignored Vars: O, f, args, x, cb
@@ -269,7 +272,9 @@ To wait for a
 1. Let |index| be 0.
 1. Let |total| be |promises|'s [=list/size=].
 1. Let |result| be a list containing |total| null values.
-1. If |total| is 0, then perform |successSteps| given |result| and abort these steps.
+1. If |total| is 0, then:
+    1. Queue a microtask to perform |successSteps| given |result|.
+    1. Return.
 1. [=list/For each=] |promise| of |promises|:
     1. Let |promiseIndex| be |index|.
     1. Let |fulfillmentHandler| be a built-in function that takes an argument |arg| performs the following steps:

From dc22a7121fd05abb976cecb55e1682317d756d37 Mon Sep 17 00:00:00 2001
From: Domenic Denicola 
Date: Tue, 16 Jul 2019 17:58:07 -0400
Subject: [PATCH 3/4] link-default not necessary; HTML is the only thing that
 defines "queue a microtask"

---
 index.bs | 2 --
 1 file changed, 2 deletions(-)

diff --git a/index.bs b/index.bs
index 7ab89d7..890a1da 100644
--- a/index.bs
+++ b/index.bs
@@ -15,8 +15,6 @@ Ignored Vars: O, f, args, x, cb
 
 
 

From 8cd6694248356d9e3eeaaebfd6d6e8d1635b3b1b Mon Sep 17 00:00:00 2001
From: Domenic Denicola 
Date: Tue, 16 Jul 2019 17:59:59 -0400
Subject: [PATCH 4/4] smaller diff

---
 index.bs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/index.bs b/index.bs
index 890a1da..a337e31 100644
--- a/index.bs
+++ b/index.bs
@@ -13,8 +13,7 @@ Ignored Vars: O, f, args, x, cb