Forum Moderators: open
I have a JS function called refresh() in my toolbar. I can trigger it with oncommand of a <button> in my XUL, and it's doing exactly what I need it to do. Essentially it grabs some data out of the Preferences Component and dispays it in a <description>. very nice.
when a new _content page is loaded, I want to get some data off of it and into my toolbar. First, I need to detect when a page is loaded; this is discussed here [developer.mozilla.org].
Next, when a page is loaded I want to get the data.
in summary, my toolbar creates a new element on the _content page, and defines some data attributes in it. Then it creates an Event on that attribute and "dispatches" it... that event bubbles up to the chrome, where I can retrieve the data. That technique is discussed here [developer.mozilla.org].
When all is done, I have the data stored in the Mozilla Preferences Service Component. Think of it as a Session for toolbars. It works!
Now my bug is this:
When the data is bubbled up from the document to the toolbar, I want that data to show up on the toolbar, immediately. Should be simple - I just call refresh(). not so!
MyListener() is hearing the data bubble up from the page event, and I can even alert() the data I want. I can even put it into the Preferences. But I can't refresh the toolbar XUL! I believe it's because the scope in which refresh() is called is within the _content; the event to which the Listener is listening.
So how do I get a function running in the _content scope to call a function which needs to run in the _chrome scope?
I know, this is a tricky one. if anyone is willing take a stab at this, I'd be very grateful... let me know if I should dump the JS code in here in case my description is insufficient
[edited by: tedster at 7:54 pm (utc) on Dec. 11, 2007]