[Project_owners] Overlaying JS

Philip Chee philip.chee at gmail.com
Tue Oct 18 00:21:57 EDT 2005

On Mon, 17 Oct 2005 10:27:17 +0100, Neil wrote:

> I guess the best way is to find the JS file that defines doSomething, 
> find the XUL file that imports the JS file, overlay that XUL file, 
> import your JS file, and redefine the function. Function declarations 
> are equivalent to variables i.e. function foo(bar) {}; is equivalent to 
> var foo = function foo(bar) {};

?!? Shirley, you mean: var foo = function(bar) {};

So I can just do:

function doSomethingBetter() { betterfoo(); betterbar(); }
doSomething = doSomethingBetter;

>> Background: I'm thinking of backporting some of the additional functionality
>> in the aviary (firefox) version of doSomething() to Mozilla 1.7x as well as
>> the current SeaMonkey via an extension.

> What additional functionality, may I ask?

I wasn't going to say since it looks likely to blow up leaving me with egg
over my face, but several sidebar extensions for firefox aren't ported to
work with the xpfe suites due to the lack of XUL sidebar support and most of
the project developers don't know or don't care to reverse engineer the code
needed to register their extensions into the RDF based suite sidebar (There
is a note in the source for the DOMInspector sidebar cursing out the xpfe
drivers for WONTFIXing the relevant bug that prevents addPanel() from
accepting local/chrome URLs).

I'm looking at porting the infrastructure needed to support extension XUL
sidebars. My primary aims are:

1. Minimise the code changes needed for extension developers.
   They would just need to overlay navigator.xul with the same firefox
   extension overlay. This means porting toggleSidebar() over and adding
   a View->Sidebar menu item for them to hook into.

2. Don't change or interfere with the existing RDF sidebar functionality
   so that existing mozilla/seamonkey RDF sidebars continue to work.
   The new functionality will be transparent to the old code.

#1 would be trivial except for #2. It looks like I'll have to redefine
SidebarShowHide(), and possibly SidebarExpandCollapse(), and I'll need
to merge the differences in toggleAffectedChrome() between the xpfe and the
toolkit version. I'll probably make both toggleSidebar() and
SidebarShowHide() call another function toggleSidebarInternal() with
different parameters.

At the moment I'm totally blur about how the new UI will work. One way would
be to follow the firefox browser.xul and insert a <browser> element under
the xpfe <sidebarheader> but I hope somebody comes up with a better suggestion.

Aaack! Looking at what I just wrote, I may have bitten off more than I can
chew. Ah hubris.

p.s. Michael: remind me to ask you if I can steal^Wborrow the UI additions
that Multizilla makes to the suite sidebar.

Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
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.
[ ]This message was printed using recycled electrons
* TagZilla 0.059

More information about the Project_owners mailing list