wpt / css / css-images / object-fit-stale-image-while-revalidating.html

Status: PASS | Duration: 8ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-images/object-fit-stale-image-while-revalidating.html

<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<title>CSS Images: object-fit applies to stale image while revalidating</title>
<link rel="author" title="jj" href="mailto:jj@imput.net">
<link rel="help" href="https://drafts.csswg.org/css-images-3/#the-object-fit">
<link rel="help" href="https://issues.chromium.org/issues/40757070">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<script src="/common/reftest-wait.js"></script>
<script src="/common/utils.js"></script>
<style>
#target, img { height: 100px; width: 100px }
#target { background: green }
img { display: block; object-fit: cover }
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="target"></div>
<script>
const params = new URLSearchParams(location.search);
const id = params.get("id") || token();
const revalidated = location.search.includes("revalidate");

window.onload = () => {
  const image = document.createElement("img");
  image.onload = () => revalidated || (location.search = `?id=${id}&revalidate`);
  image.src = `support/object-fit-stale-image.py?id=${id}`;

  if (!revalidated) {
    return;
  }

  document.getElementById("target").append(image);
  takeScreenshot();
}
</script>
</html>

/css/reference/ref-filled-green-100px-square.xht

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>CSS Reftest Reference</title>
  <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
  <style type="text/css"><![CDATA[
  div
  {
  background-color: green;
  height: 100px;
  width: 100px;
  }
  ]]></style>
 </head>
 <body>
  <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
  <div></div>
 </body>
</html>