[Project_owners] Scoping of Javascript identifiers

Nickolay Ponomarev asqueella at gmail.com
Fri Mar 17 14:21:31 EST 2006


On 3/17/06, Julian Reschke <julian.reschke at gmx.de> wrote:
> I recently noticed that my "openwebfolder" extension causes GreaseMonkey
> to fail loading user scripts (see
> <http://bugzilla.mozdev.org/show_bug.cgi?id=13476>).
>
> This is apparently caused by the fact that identifiers used by both
> extensions live in the same namespace, and "openwebfolder" happens to
> define a function "getContents", which is invoked by GM.
>
> Question: am I doing something wrong, that is, is there a way to avoid
> collisions like that?

This is a known issue, see
http://kb.mozillazine.org/Javascript_coding_guidelines#Avoiding_name_collisions

The reason for this is that all scripts, loaded into a particular
window, share the same scope (while different windows, even two
instances of the same kind, have different scope).

This is reported as a GM bug, but the developers apparently don't
think it is important enough.
http://bugzilla.mozdev.org/show_bug.cgi?id=10227

Nickolay


More information about the Project_owners mailing list