SafariExtensions icon indicating copy to clipboard operation
SafariExtensions copied to clipboard

FB11427769 - Missing result from chrome storage get with empty string

Open lapcat opened this issue 2 years ago • 1 comments

If you call chrome.storage.local.get with an empty string, it returns an empty object, even if the empty string is used as a key in the storage. This is contrary to the behavior in Chrome itself, and contrary to the behavior in Firefox too. This bug exists on iOS and macOS in Safari.

Attached is a sample project that demonstrates the bug. You can use the same web extension with Safari Mac, Safari Mobile, Google Chrome, and Firefox. Just build and run the extension on any web page, press OK to select the "chrome" storage API, and open the web inspector console.

Expected results (from Chrome and Firefox):

foobar result: bar undefined
empty result: undefined empty
null result: bar empty

Actual results (from Safari):

empty result: undefined undefined
foobar result: bar undefined
null result: bar empty

The results in Safari when using the "browser" storage API are also strange, and different from Firefox:

foobar result: bar empty
empty result: bar empty
null result: bar empty

See also another web extension storage bug: FB11426949 Web Extension storage callbacks in the wrong order

StorageBug.zip

lapcat avatar Dec 26 '22 19:12 lapcat