How does one figure out when to display the report? That is, how do
you detect when all content scripts for a tab have finished processing
and gotten back to the background page?
One approach is to continuously update the report as new findings come
in, but it would be best to display the complete version once, as soon
as all content scripts finish reporting.
I could scan the top-level document to get a list of all frames, and
then wait until all frames have reported in, but what if there are
frames within frames? Is there a more direct way?
--
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.
http://code.google.com/chrome/extensions/content_scripts.html:
"In the case of "document_start", the files are injected after any
files from "css", but before any other DOM is constructed or any other
script is run."
Or could the "document_start" for a slow-loading frame come after a
"document_idle"-triggered top-level document's content script. Then we
won't know how many scripts are out there to wait to receive info
from.
On Mar 1, 2:50 pm, Mohamed Mansour <m0.interact...@gmail.com> wrote:
> Perhaps you can keep track when the content script is loaded, by sending a
> ping event to the background page telling it that we have one available
> content script for that tab.
>
> The background page keeps track on how many content scripts been loaded,
> then within your content script, you will listen for events from the
> background page via extension messaginghttp://code.google.com/chrome/extensions/messaging.html
>
> Everytime the content script finishes fetching the data you need, it will "
> sendResponse<http://groups.google.com/a/chromium.org/group/chromium-extensions/bro...>"
> > 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<chromium-extensions%2Bunsubscr...@chromium.org>
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
When you say chrome.extension.onUpdate, do you mean
chrome.tabs.onUpdated? Is the idea here that if the "complete" event
always fires after all the frames have loaded, this is an easy way to
get a count of all frames/content scripts in a tab?
I am going to try recursively scanning for frames first and going from
there once all frames have been detected.
On Mar 1, 7:34 pm, Mohamed Mansour <m0.interact...@gmail.com> wrote:
> I thought the chrome.extension.onUpdate should fire the complete event when
> the whole page has been loaded while doing an example to show you.
>
> Basically, the "complete" tab status event is being fired numerous times in
> "random" order, sometimes 1, 2 or 3. I noticed that the last content script
> callback is being fired before the last status change.
>
> I filed the bug in the tracker:http://code.google.com/p/chromium/issues/detail?id=37149
>
> I will see what the extension guys say.
> <http://code.google.com/p/chromium/issues/detail?id=37149>
> > <chromium-extensions%2Bunsubscr...@chromium.org<chromium-extensions%252Bunsubscr...@chromium.org>