[Project_owners] Scoping of Javascript identifiers

Michael Johnston special.michael at gmail.com
Fri Mar 17 11:25:36 EST 2006


i try to name all methods with the prefix of the extension name to
avoid this confusion.

On 3/17/06, Nickolay Ponomarev <asqueella at gmail.com> wrote:
> 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
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>


More information about the Project_owners mailing list