summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-10-27 11:10:27 +1100
committerGitHub <noreply@github.com>2021-10-27 11:10:27 +1100
commit1c739470b590ea13dc0aa67c0ecc7ea6f49b5746 (patch)
treea7e6cb862cde74cc7861bc7124c540e62fa951b0 /ext
parent6268703487da02d66552d1e1a42858aa273def90 (diff)
feat(ext/webstorage): use implied origin when --location not set (#12548)
Closes #11882 BREAKING CHANGE: Previously when `--location` was set, the unique storage key was derived from the the URL of the location instead of just the origin. This change correctly uses just the origin. This may cause previously persisted storage to change its key and data to not be available with the same location as before.
Diffstat (limited to 'ext')
-rw-r--r--ext/webstorage/01_webstorage.js5
-rw-r--r--ext/webstorage/lib.rs4
2 files changed, 4 insertions, 5 deletions
diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js
index 558522a3c..4abb64bfc 100644
--- a/ext/webstorage/01_webstorage.js
+++ b/ext/webstorage/01_webstorage.js
@@ -91,8 +91,6 @@
}
function createStorage(persistent) {
- if (persistent) window.location;
-
const storage = webidl.createBranded(Storage);
storage[_persistent] = persistent;
@@ -133,7 +131,8 @@
return true;
},
has(target, p) {
- return (typeof target.getItem(p)) === "string";
+ return p === SymbolFor("Deno.customInspect") ||
+ (typeof target.getItem(p)) === "string";
},
ownKeys() {
return core.opSync("op_webstorage_iterate_keys", persistent);
diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs
index e7e53d983..9894c265d 100644
--- a/ext/webstorage/lib.rs
+++ b/ext/webstorage/lib.rs
@@ -38,8 +38,8 @@ pub fn init(origin_storage_dir: Option<PathBuf>) -> Extension {
),
])
.state(move |state| {
- if let Some(origin_storage_dir) = origin_storage_dir.clone() {
- state.put(OriginStorageDir(origin_storage_dir));
+ if let Some(origin_storage_dir) = &origin_storage_dir {
+ state.put(OriginStorageDir(origin_storage_dir.clone()));
}
Ok(())
})