How html flag persistent_storage worked?

I add flag persistent_storage false to params. But engine try to worked with index db.
But i get warnings in console.

var extra_params = {
		archive_location_filter: function( path ) {
			return ("{{DEFOLD_ARCHIVE_LOCATION_PREFIX}}" + path + "{{DEFOLD_ARCHIVE_LOCATION_SUFFIX}}");
		},
		engine_arguments: ["--verify-graphics-calls=false",{{#DEFOLD_ENGINE_ARGUMENTS}}"{{.}}",{{/DEFOLD_ENGINE_ARGUMENTS}}],
		custom_heap_size: {{DEFOLD_HEAP_SIZE}},
		persistent_storage: false,
		disable_context_menu: true
	}

But in console i have warning

dmloader.js:568 FS syncfs error: SecurityError: Failed to execute 'open' on 'IDBFactory': access to the Indexed Database API is denied in this context.
(anonymous) @ dmloader.js:568
doCallback @ speechgame_wasm.js:1
done @ speechgame_wasm.js:1
(anonymous) @ speechgame_wasm.js:1
(anonymous) @ speechgame_wasm.js:1
getDB @ speechgame_wasm.js:1
getRemoteSet @ speechgame_wasm.js:1
(anonymous) @ speechgame_wasm.js:1
getLocalSet @ speechgame_wasm.js:1
syncfs @ speechgame_wasm.js:1
(anonymous) @ speechgame_wasm.js:1
syncfs @ speechgame_wasm.js:1
preSync @ dmloader.js:565
Module.preInit @ dmloader.js:627
(anonymous) @ speechgame_wasm.js:1

Hmm, @sven do you know anything about this?

1 Like

Hm, not sure, it was quite a while since I fiddled with persistent storage on HTML5 but iirc this used to work. Maybe something changed when we updated the template etc? ping @AGulev

1 Like

No, there is nothing new related to persistent storage in the new template.

I’ve tried to debug a bit, and I think this is a bug: the method preInit() where we use this parameter persistent_storage is called earlier than RunApp() method when we set this parameter.
(This logic is available in dmloader.js)

@d954mas The simplest workaround, for now, is to set this option manually:

//we are able to set this parameter manually before `preInit()` call:
Module.persistentStorage = false;  //in `Module` it is `persistentStorage` not `persistent_storage`
var extra_params = {
...
4 Likes

Thanks)

1 Like