ampproject / ampproject/worker-dom

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

Open
#109 0 comments 0 reactions 1 assignee Claimed by @kristoferbaxter View on GitHub
mutation
Dominant language
TypeScript
Stars
3.3k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

I noticed this surprising type error when testing todomvc in amp-script. After tapping a checkbox, the worker sends the following mutation:
```js
{
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.