feat(ext/webstorage): use implied origin when --location not set #12548
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #11882
This differs a little bit from the proposal, in that there is no
window.location
set at all when--location
is not supplied. That behaviour stays the same. Instead though, the storage origin is determined fully on the Rust side and not exposed at all in the runtime. The algorithm is:--location
if a--location
is passed (unless the--location
has an opaque origin, and in this caselocalStorage
will be disabled)--location
is passed, but there is a config file, use the absolute path to the config file as the "origin", meaning that programs that share the same config file, will share the same localStorage.I need to write tests for it. Also noticed that inspecting
window.localStorage
orwindow.sessionStorage
isn't working, because the proxy doesn't properly deal with the inspect symbol.I will also add documentation to the manual once we have merged this PR.
This is going to be a little bit of a breaking change, because we were setting the storage path based on the full
--location
and not the origin of the--location
, meaning that--location https://deno.land/x/a.ts
and--location https://deno.land/x/b.ts
would not share the same storage, but to be well aligned to the web platform, they should. Between the config path and the main module implied storage origins, there should be sufficient alternatives to allow flexibility so that we can better align to the web platform.