Revision eb9f8a917a751b5bd2e4ed86840eac8b5c4445f2 authored by Brian Birtles on 15 March 2018, 06:57:09 UTC, committed by Brian Birtles on 15 March 2018, 06:57:09 UTC
This patch also drops the test that an AnimationEffectTiming object is
created in the appropriate realm since it is no longer the case that
a separate timing object is created.
1 parent df2153f
Raw File
document_getAll_multiple.tentative.html
<!doctype html>
<meta charset="utf-8">
<title>Async Cookies: cookieStore.getAll() sees cookieStore.set() cookie</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<link rel="author" href="pwnall@chromium.org" title="Victor Costan">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';

// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/w3c/web-platform-tests/issues/6075
async function async_cleanup(cleanup_function) {
  try {
    await cleanup_function();
  } catch (e) {
    // Errors in cleanup functions shouldn't result in test failures.
  }
}

promise_test(async testCase => {
  await cookieStore.set('cookie-name', 'cookie-value');
  await cookieStore.set('cookie-name-2', 'cookie-value-2');
  await cookieStore.set('cookie-name-3', 'cookie-value-3');

  const cookies = await cookieStore.getAll();
  cookies.sort((a, b) => a.name.localeCompare(b.name));
  assert_equals(cookies.length, 3);
  assert_equals(cookies[0].name, 'cookie-name');
  assert_equals(cookies[0].value, 'cookie-value');
  assert_equals(cookies[1].name, 'cookie-name-2');
  assert_equals(cookies[1].value, 'cookie-value-2');
  assert_equals(cookies[2].name, 'cookie-name-3');
  assert_equals(cookies[2].value, 'cookie-value-3');

  await async_cleanup(() => cookieStore.delete('cookie-name'));
  await async_cleanup(() => cookieStore.delete('cookie-name-2'));
  await async_cleanup(() => cookieStore.delete('cookie-name-3'));
}, 'cookieStore.getAll returns multiple cookies written by cookieStore.set');

</script>
back to top