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

Exposing JS constructors with properties to content

2 views
Skip to first unread message

Mook

unread,
Nov 1, 2006, 12:02:41 AM11/1/06
to
Hi,

I'm trying to figure out how to expose a JS constructor with (non-const)
properties to content. That is, I want to expose something like:

function Class() {}
Class.foo = "something";
Class.prototype.bar = "other thing";

The problem being that | Class.foo | is not a constant, so I can't just
write an IDL to describe that...

nsSidebar uses "JavaScript global property" which seems to make it a
singleton (to the content script, anyway), which doesn't quite work for
me. I see that there's a "JavaScript global constructor" [1], but again
I have no idea how to express my non-const properties on the construtor
itself... And "JavaScript global dynamic nameset" appears to be not
scriptable :p

Anybody know? Or do I have to unsafely inject my constructor into content?

[1]
http://lxr.mozilla.org/mozilla/source/dom/public/nsIScriptNameSpaceManager.h#41

--
Mook
mook dot moz plus stuff at gmail dot complexity

0 new messages