chromium/third_party/blink/web_tests/fast/css/cssimagesetvalue-crash.html

<html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<div id="target"></div>

<script>
function testImageSetSerialization(isPrefixed) {
  const prefix = isPrefixed? "-webkit-" : "";

  target.style.backgroundImage = '';
  target.style.backgroundImage = `${prefix}image-set(url(test1.png) 1x, url(test2.png) 2x)`;

  const url = location.href;
  const path = url.substring(0, url.lastIndexOf('/')+1);

  // The '-webkit-' prefixed 'image-set' is expected to serialize to the same
  // value as standard 'image-set'.
  // https://drafts.csswg.org/css-images-4/#deprecated
  // "Implementations must accept -webkit-image-set() as a parse-time alias of
  // image-set(). (It’s a valid value, with identical arguments to image-set(),
  // and is turned into image-set() during parsing.)"
  // The resolution unit is expected to be converted to the canonical unit 'dppx'
  // for computed style.
  //   https://www.w3.org/TR/css-values-4/#resolution
  // "All <resolution> units are compatible, and dppx is their canonical unit."
  // https://www.w3.org/TR/css-values-4/#canonical-unit
  // "When serializing computed values [CSSOM], compatible units are converted
  // into a single canonical unit."
  // https://www.w3.org/TR/cssom-1/#serializing-css-values
  // "The resolution in dots per CSS pixel serialized as per <number> followed by
  // the literal string 'dppx'."
  const expected = `image-set(url("${path}test1.png") 1dppx, url("${path}test2.png") 2dppx)`;

  assert_equals(
    getComputedStyle(target).backgroundImage,
    expected
  );

  assert_equals(
    target.style.backgroundImage,
    `image-set(url("test1.png") 1x, url("test2.png") 2x)`
  );
}

test(function() {
  testImageSetSerialization(false);
}, 'Testing serialization of image-set');

test(function() {
  testImageSetSerialization(true);
}, 'Testing serialization of -webkit-image-set');
</script>
</html>