From 9a92603a142f8bc8bfe36d2eec3d1dd86722651b Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Mon, 7 Oct 2024 07:59:27 -0700 Subject: [PATCH] fix(ext/webstorage): make `getOwnPropertyDescriptor` with symbol return `undefined` (#13348) Closes #13347 --- ext/webstorage/01_webstorage.js | 3 +++ tests/unit/webstorage_test.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js index 3cbdd708dd..9e86366563 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 9dc560af1b..aa832b1c4b 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")); +});