Skip to content

localStorage.removeItem creates key with arbitrary value from state #37739

@AntonioGargaro

Description

@AntonioGargaro

Description

Using window.localStorage.removeItem within the amp-script worker using any value (even if it doesn’t exist) actually creates an item in local storage with that key and a value that is defined somewhere in AMP environment.

It can be reproduced by having the removeItem code within the amp-script JS that is guaranteed to be executed. The expected behaviour would be for this value to just be deleted.

cc @samouri

Reproduction Steps

Added an AMP playground link here. On line 27 I added window.localStorage.removeItem and you can see that the helloworld key to be removed is actually created in localstorage.

Relevant Logs

No response

Browser(s) Affected

Chrome, Firefox, Safari

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions