Skip to content

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

@AtkinsSJ

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. :^)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions