We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I noticed a difference between Firefox and Chromium on the StorageArea.set() method.
StorageArea.set()
undefined
I propose a third solution where the value is saved in the storage.
This pseudo-code use assert.deepStrictEqual() from Node.js.
const data = { foo: undefined }; chrome.storage.local.set(data); chrome.storage.local.get(Object.keys(data), (d) => assert.deepStrictEqual(d, data));
{ "manifest_version": 2, "name": "Test case", "version": "1.0.0", "background": { "scripts": ["background.js"] }, "permissions": ["storage"] }
chrome.storage.local.clear(() => { chrome.storage.local.set({ foo: "bar" }); chrome.storage.local.get("foo", (v) => console.log(v)); chrome.storage.local.set({ foo: undefined }); chrome.storage.local.get("foo", (v) => console.log(v)); chrome.storage.local.set({ foo: "baz" }); chrome.storage.local.get("foo", (v) => console.log(v)); });
{ foo: "bar" } { } { foo: "baz" }
{ foo: "bar" } { foo: "bar" } { foo: "baz" }
The text was updated successfully, but these errors were encountered:
Relevant bug reports:
Sorry, something went wrong.
Safari matches Chrome here (the key is ignored and will not be set or changed). A null value can be used in Safari for doing this.
null
I have re-opened the closed bug in Firefox with some implementation details: https://bugzilla.mozilla.org/show_bug.cgi?id=1499842#c5
I don't expect any of us to work on it anytime soon, but patches are welcome.
No branches or pull requests
Hi,
I noticed a difference between Firefox and Chromium on the
StorageArea.set()
method.StorageArea.set()
removes item when value isundefined
.StorageArea.set()
ignore item when value isundefined
.Expected
I propose a third solution where the value is saved in the storage.
This pseudo-code use assert.deepStrictEqual() from Node.js.
Testcase
Results
Firefox
Chromium
The text was updated successfully, but these errors were encountered: