-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Web API: sessionStorage #4973
Web API: sessionStorage #4973
Conversation
-1 if this isn't actually persisting anything... certainly #1657 shouldn't be closed, and this is going to cause confusion as to whether or not this is properly implemented. |
Yes, I say we need something that persists, even session storage. Until that point, any sort of "in memory" compatibility should be in deno.land/x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I don't think we should consider something that doesn't actually persist... maybe session storage can be in memory, but if all we have is in memory, we shouldn't add it at the moment, and keep something like this in deno.land/x/
We really need to work out the semantics of the origin for the storage... a lot of those are discussed in #1657 but not addressed here yet.
@@ -234,6 +235,13 @@ export const windowOrWorkerGlobalScopeProperties = { | |||
Worker: nonEnumerable(workers.WorkerImpl), | |||
}; | |||
|
|||
export const windowGlobalScopeProperties = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While technically, web workers don't have access to local storage, I would not want to add another bag here. We already have things in worker global that shouldn't technically be there. @bartlomieju opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you @kitsonk - workers shouldn't have access to localStorage
I have updated the OP saying this PR doesn't actually implements |
Implements window.sessionStorage in-memory only. Refs: https://html.spec.whatwg.org/multipage/webstorage.html#storage-2
Thanks for opening the PR @aduh95 and sorry for slow review. I agree with @nayeemrmn and @kitsonk opinions - this module should start as a 3rd party module in |
Implements
window.sessionStorage
for Deno.This is mostly a wrapper around
Map
, that should be 100% compatible with the browser implementation.localStorage
is a bit tricky to achieve on Deno, as far as I know their is no obvious equivalent to an origin on Deno, I have chosen to make it throw aSecurityError
as the specs allows:Missing features:
window.localStorage
,StorageEvent
class andstorage
event.Refs: https://html.spec.whatwg.org/multipage/webstorage.html#storage-2
Refs: #1657