Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/web): webstorage has trap for symbol #21090

Merged
merged 3 commits into from
Nov 14, 2023

Conversation

petamoriken
Copy link
Contributor

Fixed a bug that webstorage has trap that passed symbol to storage.getItem.

> Symbol() in localStorage
Uncaught TypeError: Failed to execute 'getItem' on 'Storage': Argument 1 is a symbol, which cannot be converted to a string
    at makeException (ext:deno_webidl/00_webidl.js:88:10)
    at Array.converters.DOMString (ext:deno_webidl/00_webidl.js:392:11)
    at Storage.getItem (ext:deno_webstorage/01_webstorage.js:58:29)
    at Object.has (ext:deno_webstorage/01_webstorage.js:122:24)
    at <anonymous>:2:10

if (typeof key == "symbol") {
ObjectDefineProperty(target, key, {
if (typeof key === "symbol") {
return ReflectDefineProperty(target, key, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defineProperty is used here, should it be Reflect.set?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if my memory serves me right, there were some very weird behavioural differences that caused issues, but I might be wrong.

@bartlomieju
Copy link
Member

@crowlKats please take a look

Copy link
Member

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@crowlKats crowlKats merged commit 8866521 into denoland:main Nov 14, 2023
13 checks passed
@petamoriken petamoriken deleted the fix/webstorage-has-trap branch November 14, 2023 07:15
zifeo pushed a commit to metatypedev/deno that referenced this pull request Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants