My extension is going to be saving data like this in a string using Chrome.Storage.Sync.Set
, which I will then interpret with regex/something similar:
<ID>TEXTBOX</ID><STYLE>BORDER:1PX SOLID BLACK; BACKGROUND-COLOR:YELLOW;
FONT-SIZE:18PX; FONT-FAMILY:ARIAL</STYLE><OTHER></OTHER>
I'm hoping to put all saved data in one storage item. ie:
<ID>TEXTBOX</ID><STYLE>BORDER:1PX SOLID BLACK; BACKGROUND-COLOR:YELLOW;
FONT-SIZE:18PX; FONT-FAMILY:ARIAL</STYLE><OTHER></OTHER>
<ID>TEXTBOX</ID><STYLE>BORDER:1PX SOLID BLACK; BACKGROUND-COLOR:YELLOW;
FONT-SIZE:18PX; FONT-FAMILY:ARIAL</STYLE><OTHER></OTHER>
<ID>TEXTBOX</ID><STYLE>BORDER:1PX SOLID BLACK; BACKGROUND-COLOR:YELLOW;
FONT-SIZE:18PX; FONT-FAMILY:ARIAL</STYLE><OTHER></OTHER>
<ID>TEXTBOX</ID><STYLE>BORDER:1PX SOLID BLACK; BACKGROUND-COLOR:YELLOW;
FONT-SIZE:18PX; FONT-FAMILY:ARIAL</STYLE><OTHER></OTHER>
This page here says for each "individual item in sync storage, as measured by the JSON stringification of its value plus its key length.", the size limit is 8,192 bytes. From anyone's knowledge, am I likely to go over the limit? Say if I had 40 IDs..
Yes. Yes, you are likely to go over the limit. Your current example, with 4 IDs, is approximately half a kilobyte. So you'll run out with 64 already.
Then your set
operation will fail, and in your callback chrome.runtime.lastError
will be set:
chrome.storage.sync.set(data, function() {
if(chrome.runtime.lastError) {
// Uh-oh..
}
});
Do note:
chrome.storage.local
. It has a much more generous quota of 5,242,880 bytes.."unlimitedStorage"
permission.As Google documentation puts it, in a somewhat tongue-in-cheek fashion:
chrome.storage
is not a big truck. It's a series of tubes. And if you don't understand, those tubes can be filled, and if they are filled when you put your message in, it gets in line, and it's going to be delayed by anyone that puts into that tube enormous amounts of material.
Sync storage requires support from Google's infrastructure - and they are not willing to give it out for free in unlimited amounts.
P.S. HTML is not a regular language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With