chromium/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/currentSrc-blob-cache.html

<!doctype html>
<meta charset="utf-8">
<title>currentSrc is right even if underlying image is a shared blob</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1625786">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<img id="first">
<img id="second">
<script>
promise_test(async t => {
  let canvas = document.createElement("canvas");
  canvas.width = 100;
  canvas.height = 100;
  let ctx = canvas.getContext("2d");
  ctx.fillStyle = "green";
  ctx.rect(0, 0, 100, 100);
  ctx.fill();

  let blob = await new Promise(resolve => canvas.toBlob(resolve));

  let first = document.querySelector("#first");
  let second = document.querySelector("#second");

  let firstLoad = new Promise(resolve => {
    first.addEventListener("load", resolve, { once: true });
  });

  let secondLoad = new Promise(resolve => {
    second.addEventListener("load", resolve, { once: true });
  });

  let uri1 = URL.createObjectURL(blob);
  let uri2 = URL.createObjectURL(blob);
  first.src = uri1;
  second.src = uri2;

  await firstLoad;
  await secondLoad;

  assert_equals(first.src, first.currentSrc);
  assert_equals(second.src, second.currentSrc);
});
</script>