Cannot access file:/// urls from content script or background

3,639 views
Skip to first unread message

crizCraig

unread,
Feb 13, 2011, 6:50:10 PM2/13/11
to Chromium-extensions
Everything works fine on http and https pages.

The error I get is:
Error during tabs.executeScript: Cannot access contents of url
"file:///C:/asdf.htm". Extension manifest must request permission to
access this host. ... chrome/ExtensionProcessBindings:87

I copied the content_script.matches directly from Chrome Speed
Tracer's manifest.json. That extension works fine on the same asdf.htm
page that my extension gets the error on. I've also tried "<all_urls>"
for matches with no luck. I see the "Allow file access to URLs" check
box next to my extension in extension manager and it is checked.

Here's my manifest:
{
"name": "cqstyle CSS editor",

"version": "3.2",

"description": "Perform live CSS edits and use a slider to quickly
change values.",

"browser_action": {
"default_icon": "icon128.png"
},

"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},

"permissions": [
"tabs",
"http://*/*",
"https://*/*",
"file:///*",
"unlimitedStorage"
],

"background_page": "background.html",

"content_scripts": [{
"matches": [ "http://*/*", "https://*/*", "file:///*" ],
"js": [
"jquery-1.4.4.min.js",
"jquery_plugins.js",
"cqstyle.js",
"cqstyle_client.js"
],
"run_at": "document_start"
}]
}

Thanks for any help you guys can offer!

Craig
Message has been deleted

crizCraig

unread,
Feb 15, 2011, 12:30:28 PM2/15/11
to Chromium-extensions
It appears as if there's some approval process for gaining access to
file:/// urls. I say this because when I tried to publish my extension
with file:///* in the content_script matches, it came up with an error
needing approval. Can anyone point me in the right direction on this?

Thanks,

Craig

Scott Fujan

unread,
Feb 15, 2011, 12:41:56 PM2/15/11
to crizCraig, Chromium-extensions
There used to be an approval process for file://, but there shouldn't be now.

My experience is that if your extension requires approval you need to contact this mailing list soon and ask why because they don't seem to follow up otherwise.

Are you checking the box labelled "Allow file://" in the extensions page?


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


crizCraig

unread,
Feb 15, 2011, 12:50:48 PM2/15/11
to Chromium-extensions
Hi Scott,

Thanks for your reply. Where exactly do you think I should post in
order to get approval?

> Are you checking the box labelled "Allow file://" in the extensions page?
Yes, I see the box and have it checked in the unpacked, development
version of the extension. I can't publish with the same manifest.json
with the file:/// however.

Thanks,

Craig
> > To post to this group, send email to chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org.

Arne Roomann-Kurrik

unread,
Feb 15, 2011, 1:44:04 PM2/15/11
to Scott Fujan, crizCraig, Chromium-extensions
We do follow up with developers in the review queue.  Please give at least 2 business days before posting to the list, and check your spam folder before you do. 

If you've done both of these and your extension still says pending review, please follow up with me directly and include the URL of your unpublished extension detail page or the extension ID.

~Arne

crizCraig

unread,
Feb 15, 2011, 3:44:16 PM2/15/11
to Chromium-extensions
Hi Arne,

Thanks for your response. How do I get into the review queue? When I
upload a version with the manifest.json above, I get the following
error:

"An error occurred: Cannot contain file access permission."

When I upload a version without "file:///*" in the permissions array,
but still in the content_scripts matches array, the error goes away.
However when I deploy to and install from

https://chrome.google.com/extensions/detail/kgjoohfhbbdcbnecemfodgoofpohgbee?hl=en

and check "Allow access to file URLs", the extension is still blocked
from accessing file:/// urls. I get the error:

"Extension manifest must request permission to access this host"

I am never notified about a review queue during the deploy process.

Thanks very much for any help you can offer.

Regards,

Craig

On Feb 15, 11:44 am, Arne Roomann-Kurrik <kur...@chromium.org> wrote:
> We do follow up with developers in the review queue.  Please give at least 2
> business days before posting to the list, and check your spam folder before
> you do.
>
> If you've done both of these and your extension still says pending review,
> please follow up with me directly and include the URL of your unpublished
> extension detail page or the extension ID.
>
> ~Arne
>
>
>
>
>
>
>
> On Tue, Feb 15, 2011 at 9:41 AM, Scott Fujan <sc...@fujan.name> wrote:
> > There used to be an approval process for file://, but there shouldn't be
> > now.
>
> > My experience is that if your extension requires approval you need to
> > contact this mailing list soon and ask why because they don't seem to follow
> > up otherwise.
>
> > Are you checking the box labelled "Allow file://" in the extensions page?
>
> >> To post to this group, send email to chromium-extensi...@chromium.org.
> >> To unsubscribe from this group, send email to
> >> chromium-extensions+unsubscr...@chromium.org.
> >> For more options, visit this group at
> >>http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-extensions" group.
> > To post to this group, send email to chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org.

Scott Fujan

unread,
Feb 15, 2011, 3:54:12 PM2/15/11
to crizCraig, Chromium-extensions
Try file://* instead of file:///*

To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.

crizCraig

unread,
Feb 15, 2011, 4:16:41 PM2/15/11
to Chromium-extensions
Thanks for the suggestion. Yeah, I've tried file://*, file://*/*,
file:///*/*, file:///*, and <all_urls>. file:///* is what Speed Tracer
uses, which seems to work for them.

On Feb 15, 1:54 pm, Scott Fujan <sc...@fujan.name> wrote:
> Try file://* instead of file:///*
>
>
>
>
>
>
>
> On Tue, Feb 15, 2011 at 2:44 PM, crizCraig <craig.qui...@gmail.com> wrote:
> > Hi Arne,
>
> > Thanks for your response. How do I get into the review queue? When I
> > upload a version with the manifest.json above, I get the following
> > error:
>
> > "An error occurred: Cannot contain file access permission."
>
> > When I upload a version without "file:///*" in the permissions array,
> > but still in the content_scripts matches array, the error goes away.
> > However when I deploy to and install from
>
> >https://chrome.google.com/extensions/detail/kgjoohfhbbdcbnecemfodgoof...

Arne Roomann-Kurrik

unread,
Mar 8, 2011, 7:43:54 PM3/8/11
to crizCraig, Chromium-extensions
Hey sorry for not following up for a while.  Looks like the gallery is throwing the error on the permissions entry, but not the match patterns.  So you can do something like this:

{
  "name" : "Check file:// permissions",
  "version" : "1.0.0",
  "permissions" : [
    "<all_urls>"
  ],
  "icons" : {
    "128" : "sample-128.png"
  },
  "content_scripts" : [{
    "matches" : [ "file://*" ],
    "js" : [ "contentscript.js" ]
  }]
}

Which I was able to successfully upload to the gallery.

Hope that helps,
~Arne


To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
Reply all
Reply to author
Forward
0 new messages