Nw.js: Error: QuotaExceededError: DOM Exception 22

Created on 5 Aug 2019  路  9Comments  路  Source: nwjs/nw.js

When using node-webkit (linux 64bit 0.40.0 sdk) to run an application that relies heavily on localStorage I get:

Error: QuotaExceededError: DOM Exception 22

Everything I've seen regarding this on node-webkit suggests that localStorage is expected to default to unlimited (as in however much available disk space there is), but the hard drive is far from full and I'm getting this error - the dataset is a little over 6MB.

I was sure the limit was removed for localStorage.

All 9 comments

Could you please provide a full sample so I can reproduce? Thanks.

I didn't see you answer. I sent you also e-mail, because my game uses localStorage... My next games are already using indexeddb. I hope you will help me.

Please run this example:
test.zip

NWJS, localStorage has a 5 MB limit. So, I can store only 5200000 characters. I tested on nwjs-0.43.4 64bit. Link: https://developer.chrome.com/apps/offline_storage

Thank you.

does --unlimited-storage in chromium-args of your package.json help?

Thank you for your response. But it doesn't work.

I think "--unlimited-storage" will work with navigator.webkitPersistentStorage ? I hope @rogerwang can help.

After running the test.html file test.zip:
1) wait for the script to perform the test
2) and then press F12 (developer console)
3) type localStorage and expand (triangle)
4) Copy localStorage.test values (click button "Copy")
5) and then type localStorage.asd = (paste values), press enter
6) You will see:

Error saving setting with name: consoleHistory, value length: 10400248. Error: Failed to set the 'consoleHistory' property on 'Storage': Setting the value of 'consoleHistory' exceeded the quota.
Ten largest settings:

Setting: 'consoleHistory', size: 5200222
Setting: 'experiments', size: 2
Setting: 'length', size: undefined
Setting: 'setItem', size: 2
Setting: 'key', size: 1
Setting: 'getItem', size: 1
Setting: 'removeItem', size: 1
Setting: 'clear', size: 0

and:

VM358:1 Uncaught DOMException: Failed to set the 'asd' property on 'Storage': Setting the value of 'asd' exceeded the quota.
at :1:18
(anonymous) @ VM358:1

It looks like the limit is 10 MB

Ahh yeah you are right I think that flag is for chrome.storage. Sorry.

In the worst case, I will replace localStorage with indexeddb. I asking about change limit, because I don't want interfere "save game".. 20,000 people have downloaded my game. Maybe @rogerwang will help.

Thanks for your help @bluthen .

It works! You are the best @rogerwang thanks!!!

{
"main": "index.html",
"name": "Your game name",
"dom_storage_quota": 40,
}

Was this page helpful?
0 / 5 - 0 ratings