diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2024-10-07 07:59:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-07 07:59:27 -0700 |
commit | 9a92603a142f8bc8bfe36d2eec3d1dd86722651b (patch) | |
tree | 3532d1c05b2facb5632dccde63cfaf8f173ab4dc | |
parent | 39a2034967207b89069cf64a76308e1446b1ad26 (diff) |
fix(ext/webstorage): make `getOwnPropertyDescriptor` with symbol return `undefined` (#13348)
Closes #13347
-rw-r--r-- | ext/webstorage/01_webstorage.js | 3 | ||||
-rw-r--r-- | tests/unit/webstorage_test.ts | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js index 3cbdd708d..9e8636656 100644 --- a/ext/webstorage/01_webstorage.js +++ b/ext/webstorage/01_webstorage.js @@ -143,6 +143,9 @@ function createStorage(persistent) { if (ReflectHas(target, key)) { return undefined; } + if (typeof key === "symbol") { + return undefined; + } const value = target.getItem(key); if (value === null) { return undefined; diff --git a/tests/unit/webstorage_test.ts b/tests/unit/webstorage_test.ts index 9dc560af1..aa832b1c4 100644 --- a/tests/unit/webstorage_test.ts +++ b/tests/unit/webstorage_test.ts @@ -50,3 +50,8 @@ Deno.test(function webstorageProxy() { assertEquals(localStorage[symbol as any], "bar"); assertEquals(symbol in localStorage, true); }); + +Deno.test(function webstorageGetOwnPropertyDescriptorSymbol() { + localStorage.clear(); + Object.getOwnPropertyDescriptor(localStorage, Symbol("foo")); +}); |