[Project_owners] Communicating between browser instances
Eric H. Jung
grimholtz at yahoo.com
Sun Jan 15 07:15:52 EST 2006
I don't think he's asking how to fix SwitchProxy; he's asking more of a
general extension design question. And the correct answer, AFAIK, is
not to commmunicate changes between instances of your extension via
preference updates, but to prevent multiple instances of your extension
*in the first place*. Mook's XPCOM (can be done in JS, C++ not needed)
suggestion is the way to go.
This has been discussed ad naseum at forums.mozillazine.org. I did a
brief search to try to find some topics about it for you, but didn't
come up with *precisely* what you're looking for. Here's a thread which
discusses how to write and register a component in your extension.
There *are* definitely, however, threads specifically addressing your
question... do a little more thorough searching, or simply post there
and ask--someone is bound to have the links.
--- Philip Chee <philip.chee at gmail.com> wrote:
> On Sat, 14 Jan 2006 20:13:14 -0800 (PST), Steven D Tine wrote:
> > (proxy configured). The problem is that when you have
> > two browser windows open, the status bar is not in
> > sync between the two windows. By that I mean, when
> > you click the icon in one window, the other window is
> > not updated and the instance of the code in that
> > window does not know that a change happened, so one
> > window shows red and one shows green but obviously
> > there is only one proxy setting for both windows so
> > one window is wrong. Is there a way for the code in
> > the first instance to notify the code in the other
> > window instances that a change was requested and
> > completed?
> > And to clarify my question, I don't just want to
> > update the icon, but actually somehow notify my code
> > in the other instance to update some state and then
> > update the icon.
> You basically set up a pref observer to monitor a preference setting
> when that setting changes you change your icon and state. Look at how
> Flashblock does it. We have a toolbar button that changes image
> depending on
> whether Flashblock is enabled or not. Clicking on the button will
> toggle the
> enabled/disabled state. This change is propagated to all instances of
> toolbar button in each window.
> Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
> http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
> Guard us from the she-wolf and the wolf, and guard us from the thief,
> oh Night, and so be good for us to pass.
> [ ]People with glass heads shouldn't.. ummm.. I forgot..
> * TagZilla 0.059
> Project_owners mailing list
> Project_owners at mozdev.org
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Project_owners