Ah simple message passing is exactly what I was looking for. Much cleaner than the mess I had. Thanks!
Aaron Boodman wrote: > On Mon, Nov 9, 2009 at 6:24 PM, Colin Bleckner <co...@xmarks.com> wrote: > >> I'm having some issues with communication between content scripts and my >> extension. I can't tell if this is because I'm doing something wrong, >> if there's a bug, or if there's just a better way to do things. All of >> the examples I've seen have been one way communication, but I'm trying >> to get a response back from my request. Right now I'm doing that by >> establishing a connection from the content script using >> chrome.extension.connect. When the background page gets a message from >> the content script, it does a little bit of work and then creates a new >> connection using chrome.tabs.connect (with a different channel name). >> It then attempts to send a response back in this new channel. >> >> The content script has a listener for the response channel, but it >> doesn't seem to get called. Is this the correct way to be doing this or >> is there a better way to send messages back and forth? While debugging >> everything works correctly occasionally (if I hit break points and wait >> at certain times), which makes me think there might be some sort of race >> condition. But I've tried a bunch of things to ensure that both >> channels up set up correctly and nothing I do creates a stable >> connection between the two. >> >> Any ideas? >> > > I'm not sure what the issue is, but there is a really easy API to just > make a single request to the background page and get a response. See: > > http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/messaging.html#simple > > HTH, > > - a > -- 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...@googlegroups.com. To unsubscribe from this group, send email to chromium-extensions+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=.