Is it possible to use persistent storage of the HTML5 FileSystem API from within a webview element?
We built a simple Chromium app, that consists mainly of a HTML file containing a webview element:
<webview src="http://{Host}/index.html" style="width:640px; height:480px" partition="persist:test"></webview>
The manifest.json sets permissions for the webview and unlimitedstorage:
"permissions": [
"storage",
"unlimitedStorage",
"webview"
],
"webview": {
"partitions": [
{
"name":"test",
"accessible_resources":[""]
}
]
}
We also added an event handler for the permission request to the webview and proved that this code is hit:
webview.addEventListener('permissionrequest', handlePermissionRequest);
function handlePermissionRequest(event) {
if (event.permission === 'filesystem') {
// This is called on every request to requestQuota()
event.request.allow();
}
}
It's possible to allocate and use temporary storage from the HTML5 FileSystem API in index.html (loaded from http://{Host} into the webview), but we are not able to request any byte of persistent storage. We use this code to test it:
navigator.webkitPersistentStorage.requestQuota(1024, persistentStorageGranted, errorHandler);
function persistentStorageGranted(grantedBytes) {
// grantedBytes equals 0
window.requestFileSystem(window.PERSISTENT, requestedBytes, onInitPermanent, errorHandler);
}
Should it be possible to allocate persistent storage (HTML5 FileSystem API) from within the webview element?
Thank you for your help.