worker-dom icon indicating copy to clipboard operation
worker-dom copied to clipboard

Bug: strings.getString() sometimes returns non-strings

Open dreamofabear opened this issue 6 years ago • 0 comments

I noticed this surprising type error when testing todomvc in amp-script. After tapping a checkbox, the worker sends the following mutation:

{
  nodeName: "INPUT",
  attribute: "checked",
  value: true,
}

Then, the value will be true (actual) instead of "true" (expected):

https://github.com/ampproject/worker-dom/blob/184e42560f8a40fcbe36d7d28ef5e9b9d1eb378b/src/main-thread/mutator.ts#L77-L84

Then, DOMPurify assumes attempts to call String.replace on a boolean and an exception is thrown.

dreamofabear avatar Oct 12 '18 14:10 dreamofabear