tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

synchronous-callback-skipped-before-run.html (1383B)


      1 <!DOCTYPE html>
      2 <html>
      3 <title>View transitions: skipTransition() invoked before a synchronous updateDOM callback is invoked</title>
      4 <link rel="help" href="https://www.w3.org/TR/css-view-transitions-1/">
      5 <link rel="author" href="mailto:khushalsagar@chromium.org">
      6 
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 
     10 <style>
     11 #first {
     12  width: 100px;
     13  height: 100px;
     14  background: blue;
     15  contain: paint;
     16 }
     17 </style>
     18 
     19 <div id=first></div>
     20 
     21 <script>
     22 promise_test(async t => {
     23  assert_implements(document.startViewTransition, "Missing document.startViewTransition");
     24  return new Promise(async (resolve, reject) => {
     25    let transition = document.startViewTransition(() => {
     26      first.style.viewTransitionName = "target";
     27    });
     28    transition.skipTransition();
     29    // The phase of |transition| is not done, so skip the view transition with
     30    // an "AbortError" DOMException.
     31    // https://drafts.csswg.org/css-view-transitions-1/#ViewTransition-skipTransition
     32    await promise_rejects_dom(t, "AbortError", transition.ready);
     33    await transition.finished;
     34 
     35    if (window.getComputedStyle(first).viewTransitionName == "target")
     36      resolve();
     37    else
     38      reject();
     39  });
     40 }, "finished promise should be resolved if skipTransition() is invoked before a synchronous updateCallbackDone callback is dispatched");
     41 </script>