Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

library conflicts between extensions

0 views
Skip to first unread message

Alex Iskold

unread,
Nov 22, 2006, 2:13:48 PM11/22/06
to
Hi all,

Is it possible to have "library" conflicts between extensions?
For example, say our extension uses "MochiKit", a particular version.
What if some other extension uses another version of it? It seems like this
would cause issues, correct?

Is there a way around it other than creating our own copy of the library
and doing a namespace of the sort?

Thanks,

Alex

--
alex iskold
founder & cto
http://www.adaptiveblue.com

mark bokil

unread,
Nov 22, 2006, 2:37:38 PM11/22/06
to dev-ext...@lists.mozilla.org
Alex Iskold wrote:
> Hi all,
>
> Is it possible to have "library" conflicts between extensions?
> For example, say our extension uses "MochiKit", a particular version.
> What if some other extension uses another version of it? It seems like this
> would cause issues, correct?
>
Yes, there certainly are conflicts with different libraries installed.
This is the Achilles heel of extensions.
Believe it or not but there is no enforced separation between extension
methods. One extension can call another extension's methods by referring
to the name. In general you should set all your extension methods and
global variables prefixed by a namespace to avoid conflicts. So if you
copy mochikit and make changes then wrap all the functions in a unique
namespace. I usually use the project name. Example:
MyExtension.getMethod(). This will prevent collisions with other
libraries with methods with the same name.

var ExtensionName = {
onLoad: function() {
// initialization code
this.initialized = true;
},

onMenuItemCommand: function() {
window.open("chrome://helloworld/content/hello.xul", "", "chrome");
}
};


Philip Chee

unread,
Nov 23, 2006, 6:28:47 AM11/23/06
to
On Wed, 22 Nov 2006 14:13:48 -0500, Alex Iskold wrote:

> Is it possible to have "library" conflicts between extensions?
> For example, say our extension uses "MochiKit", a particular version.
> What if some other extension uses another version of it? It seems like this
> would cause issues, correct?

> Is there a way around it other than creating our own copy of the library
> and doing a namespace of the sort?

I don't know anything about Moochkitty but you could try creating a
singleton object and then using mozIJSSubscriptLoader to load your
library into the context of the object.

Phil
--
Philip Chee <phi...@aleytys.pc.my>, <phili...@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.
[ ]Break up a relationship - buy a computer!!
* TagZilla 0.059

0 new messages