Your approach is correct. In fact it is very good of you to think of
performance and delay load the meat of your content script until you
need it.

Since your extension may in fact require interacting with webpages
anywhere on the internet, requiring permissions to http://*/* is
correct. The fact that you only need them intermittently doesn't
change that.

- a

On Mon, Dec 7, 2009 at 3:32 AM, Akira <[email protected]> wrote:
> Hello All.
>
>  Recently I decided to break my extension's content scripts into two
> parts, for performance and modularization. The first is a small
> "detect_target_content.js" script that is processed against all http
> and https pages to see if they contain the text that users want to
> study. (It's a language learning extension.)
>
>  If the page does match, a message/request is posted to the
> background page, which then performs chrome.pageActions.enableForTab()
> and chrome.tabs.executeScript() to display the page action icon in the
> tab and load the second, much larger DOM parsing-and-editing script
> ("parser.js").
>
>  A problem occurred when I found that I could not do
> chrome.tabs.executeScript() because injecting a content script against
> (for example) http://google.com/this.html or http://blah.blah.com/that.htm
> was not permitted due to not having permissions for those hosts. To
> get around this I added http://*/*";, "https://*/*"; to the
> "permissions" in the manifest (i.e. the same as what I used for the
> content scripts).
>
>  ....
>  "content_scripts": [ {
>    "js": ["detect_target_content.js"],
>    "matches": ["http://*/*";, "https://*/*";]
>  } ],
>  ....
>  ...
>  "permissions": ["http://*/*";, "https://*/*";, "tabs"]
>
>  This seems like overkill to me. I don't need other permissions such
> as cross-site XHR, I merely want to have an optional content script.
> Is there another way I could achieve this effect?
>
> Yours,
>
> Akira
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Chromium-extensions" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to