We are trying to make our application using components that can be executed in any javascript environment regardless of page that it executes on or browser it is executing in. Any browser specific code is separated out into special components that can be swapped out depending on the execution environment. Message passing and handling is one of these components.
We can special case handling connections within the same page, but it adds unnecessary complexity to an already complex system. Especially, since this was working correctly before. On 11/16/09 2:06 PM, Matt Perry wrote: > Message passing should still work for passing and forwarding messages > between different parts of your extension. What I don't understand is > why you ever need to send a message from the background page to > itself, for example. Why not just invoke the code to handle the > message directly? > > On Mon, Nov 16, 2009 at 12:03 PM, richwklein <[email protected] > <mailto:[email protected]>> wrote: > > We want to be able to communicate seamlessly between different > parts of our application regardless if that part lives within the > background page, content script, action popup, etc. To do this we > had created an abstraction around ports. There is an object that > lives in the background page and listens to incoming port > connections. When a message is received it then retransmits it to > all the other ports. This allow us to send a message and any > other part that may be interested can listen for that message. > This doesn't work now. > > Take for an example the user changes the location they want to see > weather data for. The content script picks this up and sends out > a message. There maybe a part in the action popup that listens to > this message and changes the selected location UI to reflect the > change. There may also be several parts in the background that > listen for this message and update the weather feed, update the > datastore, etc... > > Rich > > On 11/16/09 1:32 PM, Antony Sargent wrote: >> The idea of the messaging API is for communication between >> different pieces of your extension such as between injected >> script in a web page and your background page, or between a >> browser action / page action popup and your background page. >> >> >> On Fri, Nov 13, 2009 at 7:24 PM, Rich <[email protected] >> <mailto:[email protected]>> wrote: >> >> I'm working on porting Forecastfox over to chrome. We've run >> across a >> bug within the last couple of weeks. It was working before that. >> >> We are not receiving connect events on the background page if the >> connect method is called in the same page. >> >> chrome.extension.onConnect.addListener(function (port) { >> console.log >> (port.portId_); }); >> chrome.extension.connect({"name": "test"}); >> >> We are doing this during page load so I'm not sure if this >> might be >> http://code.google.com/p/chromium/issues/detail?id=19287 >> >> Anyone know if this is the case? >> >> -- >> >> 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] >> <mailto:[email protected]>. >> To unsubscribe from this group, send email to >> [email protected] >> <mailto:chromium-extensions%[email protected]>. >> For more options, visit this group at >> http://groups.google.com/group/chromium-extensions?hl=. >> >> >> > -- > > 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] > <mailto:[email protected]>. > To unsubscribe from this group, send email to > [email protected] > <mailto:chromium-extensions%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/chromium-extensions?hl=. > > -- 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=.
