Hi,
I'm experimenting with a new extension that needs to read and modify
the DOM of arbitrary pages. I use a background page to keep track of
what pages need to be modified, and a content script that communicates
with the background page via ports.

The content script is set to match all URLs (http://*/*) and includes
a fairly large chunk of JS, over different files. But the first thing
it does when executed is ask the background page if it needs to do
anything for that particular page. It only calls additional JS
functions if it needs to.

Is this, in general, a bad idea, since it's executing for every single
page, even though it only needs to act on a few? As far as I can tell
from the docs, the only way to traverse or modify the DOM of a page is
through a content script. I can subscribe to events from the
background page that tell me when pages are loaded into the various
tabs, but I don't see a way from there to get access to their DOM, or
to inject a content script into those tabs at runtime (which would be
nice to do).

Perhaps this is all unnecessary and it's perfectly fine to always
inject content scripts into every page. But so far my extension seems
to break Gmail (it loads but doesn't do anything else), and I wonder
if the content script is what's killing it.

Thanks,
matias
--~--~---------~--~----~------------~-------~--~----~
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