From d5badf6a0267723702843306a0893a9260f13ec0 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 4 Oct 2019 21:07:58 +0000 Subject: [PATCH] Bug 1572270 [wpt PR 18329] - [payment-request] Fix uncaught rejections in payment-is-showing test, a=testonly Automatic update from web-platform-tests Catch all promise rejections so the test harness doesn't fail due to uncaught rejection -- wpt-commits: 5c3c67adc2cfce655b6ec0e65b3e4b785590e821 wpt-pr: 18329 UltraBlame original commit: bf3b03c7cc3447c07b6b6fffce3485de7f926ffa --- .../payment-is-showing.https.html | 314 +++++++++++++++++- 1 file changed, 298 insertions(+), 16 deletions(-) diff --git a/testing/web-platform/tests/payment-request/payment-is-showing.https.html b/testing/web-platform/tests/payment-request/payment-is-showing.https.html index ec10b558d8d05..e56a2bfa3a6b7 100644 --- a/testing/web-platform/tests/payment-request/payment-is-showing.https.html +++ b/testing/web-platform/tests/payment-request/payment-is-showing.https.html @@ -1079,6 +1079,7 @@ . const [ +windowShowPromise iframeShowPromise ] = @@ -1106,14 +1107,13 @@ = > { +return +[ windowRequest . show ( ) -; -return -[ iframeRequest . show @@ -1156,6 +1156,28 @@ ( ) ; +await +promise_rejects +( +t +" +AbortError +" +windowShowPromise +" +The +window +payment +request +should +be +aborted +by +test +. +" +) +; iframe . remove @@ -1340,19 +1362,6 @@ ) ; await -popupRequest -. -abort -( -) -; -popupWindow -. -close -( -) -; -await promise_rejects ( t @@ -1375,6 +1384,39 @@ " ) ; +await +popupRequest +. +abort +( +) +; +await +promise_rejects +( +t +" +AbortError +" +popupShowPromise +" +Expected +popupShowPromise +to +be +aborted +by +test +. +" +) +; +popupWindow +. +close +( +) +; } " Using @@ -1660,6 +1702,27 @@ ( ) ; +await +promise_rejects +( +t +" +AbortError +" +windowShowPromise +" +Expect +window +promise +to +be +aborted +by +test +. +" +) +; popupWindow . close @@ -1911,6 +1974,26 @@ ( ) ; +await +promise_rejects +( +t +" +AbortError +" +popupShowPromise +" +Expected +popupShowPromise +to +be +aborted +by +test +. +" +) +; popupWindow . close @@ -2223,6 +2306,26 @@ ( ) ; +await +promise_rejects +( +t +" +AbortError +" +iframeShowPromise +" +Expected +iframeShowPromise +to +be +aborted +by +test +. +" +) +; popupWindow . close @@ -2433,14 +2536,90 @@ ) ; const +[ showPromise +] = +await +test_driver +. +bless +( +" +start +a +new +payment +request +" +( +) += +> +{ +return +[ request . show ( ) +] +; +} +) ; +/ +/ +If +a +payment +sheet +fails +to +show +it +should +reject +immediately +. +If +it +/ +/ +hasn +' +t +rejected +in +1 +second +then +the +test +has +passed +. +t +. +step_timeout +( +async +( +) += +> +{ +/ +/ +We +' +re +done +. +Clean +up +. await request . @@ -2448,6 +2627,109 @@ ( ) ; +t +. +done +( +) +; +} +) +; +/ +/ +If +the +navigation +in +iframe +failed +to +close +the +original +payment +sheet +/ +/ +there +| +showPromise +| +should +reject +immediately +and +this +indicates +a +/ +/ +failure +of +this +test +. +await +showPromise +. +then +( +( +) += +> +{ +assert_true +( +false +" +Second +payment +sheet +should +be +pending +but +is +resolved +. +" +) +; +} +) +. +catch +( +e += +> +{ +assert_true +( +false +" +Second +payment +sheet +should +be +pending +but +is +rejected +. +" ++ +e +. +message +) +; +} +) +; } " Navigating