Closed Bug 1371253 Opened 5 years ago Closed 5 years ago

Serializing browser.storage.local values with a replacer is unnecessary

Categories

(WebExtensions :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1370752

People

(Reporter: ecfbugzilla, Unassigned)

References

(Blocks 2 open bugs)

Details

All data written to browser.storage.local will currently be serialized to JSON using a special replacer function: https://dxr.mozilla.org/mozilla-central/rev/a49112c7a5765802096b3fc298069b9495436107/toolkit/components/extensions/ExtensionStorage.jsm#34. The purpose of this replacer function is replacing Date and RegExp objects by their string representation. This functionality is pointless however, if these objects are messed up anyway then they could just as well not be saved at all. Also, while Chrome claims to be doing it like that under https://developer.chrome.com/extensions/storage#method-StorageArea-set - this is not what they are actually doing. Both Date and RegExp objects turn into {} in chrome.storage.local.
See Also: → 1370752
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1370752
Kris, this is only a duplicate if bug 1370752 is supposed to be resolved really soon - I guess that's the case? Otherwise, removing that replacer function is a quick way to improve performance.
(In reply to Wladimir Palant from comment #2)
> Kris, this is only a duplicate if bug 1370752 is supposed to be resolved
> really soon - I guess that's the case?

Yes. Within the next couple of days.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.