Skip to content

Commit f7974c6

Browse files
committed
[scramjet] fix has and getOwnProperty traps of Storage proxy (fixes misskey)
1 parent 676886d commit f7974c6

File tree

1 file changed

+11
-0
lines changed
  • packages/scramjet/packages/core/src/client/dom

1 file changed

+11
-0
lines changed

packages/scramjet/packages/core/src/client/dom/storage.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export default function (client: ScramjetClient, self: typeof window) {
5757
return true;
5858
},
5959

60+
has(target, prop) {
61+
return target.getItem(client.url.host + "@" + (prop as string)) !== null;
62+
},
63+
6064
ownKeys(target) {
6165
return Reflect.ownKeys(target)
6266
.filter((f) => typeof f === "string" && f.startsWith(client.url.host))
@@ -66,6 +70,13 @@ export default function (client: ScramjetClient, self: typeof window) {
6670
},
6771

6872
getOwnPropertyDescriptor(target, property) {
73+
// TODO: probably not right
74+
if (
75+
target.getItem(client.url.host + "@" + (property as string)) === null
76+
) {
77+
return undefined;
78+
}
79+
6980
return {
7081
value: target.getItem(client.url.host + "@" + (property as string)),
7182
enumerable: true,

0 commit comments

Comments
 (0)