filer.js icon indicating copy to clipboard operation
filer.js copied to clipboard

self.requestFileSystem returns SecurityError when running as a Chrome App.

Open benawarez opened this issue 6 years ago • 2 comments

filer.js works awesome in Chrome. However, when loaded as a Chrome App, I get SecurityError with the message "It was determined that certain files are unsafe for access within a Web Application, or that too many calls are being made on file resources." when invoking self.requestFileSystem in the following lines for both Temporary and Persistent.

image

Line 453 and 457 is the one throwing an error.

I have Chrome browser version 74+ which works great on Windows and Chromebook.

Issue is when running it as a Chrome App on the same Chromebook where it works fine on Chrome browser.

From debugging, self.requestFileSystem is undefined so it uses self.webkitRequestFileSystem instead.

I've been trying to figure this out for days and I can't get rid of that SecurityError.

Please help.

Below is my Chrome App manifest.json:

{ "name": "Signage Player", "version": "0.1", "manifest_version": 2, "minimum_chrome_version": "37.0.0.0", "permissions": [ "webview", "power", "storage", "videoCapture", "geolocation", "pointerLock", "system.display", "syncFileSystem", "webNavigation", "fileSystem", "fileSystem.write", "fileSystem.requestFileSystem", "fileSystem.retainEntries", "fileSystem.directory", "accessibilityFeatures.read", "accessibilityFeatures.modify" ], "app": { "background": { "scripts": [ "js/foam.js", "js/cab.js", "config.js", "background_main.js" ] } }, "kiosk_enabled": true, "default_locale": "en", "icons": { "128": "img/Signage-128.png" } }

benawarez avatar Jun 17 '19 04:06 benawarez

I think you need to use the chrome specific filesystem apis in a chrome app.

https://developer.chrome.com/apps/fileSystem

On Mon, Jun 17, 2019, 6:49 AM benawarez [email protected] wrote:

filer.js works awesome in Chrome. However, when loaded as a Chrome App, I get SecurityError with the message "It was determined that certain files are unsafe for access within a Web Application, or that too many calls are being made on file resources." when invoking self.requestFileSystem in the following lines for both Temporary and Persistent.

[image: image] https://user-images.githubusercontent.com/14115278/59578845-c4eb7880-908f-11e9-9233-7beafb9beac8.png

Line 453 and 457 is the one throwing an error.

I have Chrome browser version 74+ which works great on Windows and Chromebook.

Issue is when running it as a Chrome App on the same Chromebook where it works fine on Chrome browser.

From debugging, self.requestFileSystem is undefined so it uses self.webkitRequestFileSystem instead.

I've been trying to figure this out for days and I can't get rid of that SecurityError.

Please help.

Below is my Chrome App manifest.json:

{ "name": "Signage Player", "version": "0.1", "manifest_version": 2, "minimum_chrome_version": "37.0.0.0", "permissions": [ "webview", "power", "storage", "videoCapture", "geolocation", "pointerLock", "system.display", "syncFileSystem", "webNavigation", "fileSystem", "fileSystem.write", "fileSystem.requestFileSystem", "fileSystem.retainEntries", "fileSystem.directory", "accessibilityFeatures.read", "accessibilityFeatures.modify" ], "app": { "background": { "scripts": [ "js/foam.js", "js/cab.js", "config.js", "background_main.js" ] } }, "kiosk_enabled": true, "default_locale": "en", "icons": { "128": "img/Signage-128.png" } }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ebidel/filer.js/issues/71?email_source=notifications&email_token=AAB2FAHCNM3MIAXRUZKSZTLP24JWXA5CNFSM4HYTEIEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GZZKGGA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB2FAB25L732N7TNOANCZDP24JWXANCNFSM4HYTEIEA .

ebidel avatar Jun 18 '19 11:06 ebidel

I was thinking and trying to figure that out by reading the documentation but it wasn't very clear. I do know the requestFileSystem parameters are different but when I used the Chrome App Builder wizard to create the manifest and all other dependencies, one of the file is called foam.js and it had the following line of codes: image

which essentially looked exactly like line 29 from filer.js image

back to the foam.js, requestFileSystem takes the same type of parameters as filer.js is taking: image

and foam.js and I can confirm that the foam.js gets executed because it is in the manifest.json and I'm able to see it in developers console when the app launches.

Just last night... I'm beginning to suspect that I'm getting a SecurityError because a remote website that is executing the requestFileSystem instead of the source executing is from within the app like the one in the foam.js.

I'll test.

benawarez avatar Jun 18 '19 16:06 benawarez