Bug 1471088 [wpt PR 11665] - immediate repeated calls to .complete(), a=testonly

Automatic update from web-platform-testsimmediate repeated calls to .complete() (#11665)

--

wpt-commits: e50750ae78cd80a01d6968337318612ee7451cf2
wpt-pr: 11665
This commit is contained in:
Marcos Cáceres 2018-07-06 22:51:48 +00:00 коммит произвёл James Graham
Родитель 2809714c06
Коммит a8858ad49f
2 изменённых файлов: 6 добавлений и 12 удалений

Просмотреть файл

@ -603858,7 +603858,7 @@
"testharness"
],
"payment-request/payment-response/complete-method-manual.https.html": [
"3a3e57155d5267e515f7d1711e99fb6a7d170eb7",
"366751b4fed2b18c08ce4daa7f77e4d557af5039",
"manual"
],
"payment-request/payment-response/helpers.js": [

Просмотреть файл

@ -16,6 +16,9 @@ async function runManualTest({ completeWith: result }, button) {
// We .complete() as normal, using the passed test value
const promise = response.complete(result);
assert_true(promise instanceof Promise, "returns a promise");
// Immediately calling complete() again yields a rejected promise.
await promise_rejects(t, "InvalidStateError", response.complete(result));
// but the original promise is unaffected
const returnedValue = await promise;
assert_equals(
returnedValue,
@ -23,17 +26,8 @@ async function runManualTest({ completeWith: result }, button) {
"Returned value must always be undefined"
);
// We now call .complete() again, to force an exception
// because [[completeCalled]] is true.
try {
await response.complete(result);
assert_unreached("Expected InvalidStateError to be thrown");
} catch (err) {
assert_equals(
err.code,
DOMException.INVALID_STATE_ERR,
"Must throw an InvalidStateError"
);
}
// because [[complete]] is true.
await promise_rejects(t, "InvalidStateError", response.complete(result));
button.innerHTML = `✅ ${button.textContent}`;
} catch (err) {
button.innerHTML = `❌ ${button.textContent}`;