Reading local files without user interaction, chrome.tabs.create('file:///'), bug or feature?
Reported by
willmake...@gmail.com,
Jun 27 2016
|
||
Issue description
UserAgent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
Steps to reproduce the problem:
1. Create a background.js with following content: setTimeout(() => { chrome.tabs.create({ "url": "file:///etc"}, () => { console.log('done'); } ); }, 10000);
2. Create manifest.json:
{
"name": "myExtension",
"version": "0.1",
"description": "Description",
"permissions": [ "tabs" ],
"background": {"scripts": ["background.js"]},
"manifest_version": 2
}
3. Install extension in "Developer mode".
What is the expected behavior?
Exception (error) something like - "Error: URL not allowed: file:///etc"
What went wrong?
Reading the file without user interaction.
The browser should read only those files (directories) that are specified directly by the user, for example, through opening dialogue.
WebStore page:
Did this work before? N/A
Chrome version: 50.0.2661.94 Channel: stable
OS Version:
Flash Version:
The same code in Firefox will produce the following error - Unchecked lastError value: Error: URL not allowed: file:///etc
,
Jul 1 2016
Like I wrote in the discussion - you cannot read the data from that file, you can only make the browser show it (or download it). If you check that checkbox for file access on chrome:extensions, you can read it. Otherwise, it is opaque to the extension.
,
Jul 6 2016
The user has to opt in to allowing file:// urls for each extension on the chrome://extensions page. |
||
►
Sign in to add a comment |
||
Comment 1 by mmenke@chromium.org
, Jun 27 2016