Skip to content

[css-typed-om] Recursion in CSSUnparsedValue isn't handled in serialization algorithm #1158

Open

Description

@AtkinsSJ

Blink issue: https://issues.chromium.org/issues/371292572

This is tested by WPT (test) but I couldn't see an existing issue here about it.

When constructing CSSUnparsedValues from JS, it's possible to create one that contains itself, such as this from the above WPT test:

  var unparsed_value = new CSSUnparsedValue([]);
  var var_ref = new CSSVariableReferenceValue('--A', unparsed_value);
  unparsed_value[0] = var_ref;

The serialization algorithms for CSSUnparsedValue and CSSVariableReferenceValue don't handle this case, and following the spec directly will result in infinite recursion. Blink reportedly solves this by serializing as the empty string if a cycle is detected. I think I would prefer throwing an exception of some kind (which is what DOMMatrix does when it can't be serialized), but that's up to you folks to decide. :^)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions