Closed GoogleCodeExporter closed 9 years ago
Sooo... this actually isn't legal JavaScript: not in IE, not in Firefox, and
not in
Mozilla Rhino. They all throw errors if you try to set an "import" property on
an
any object, so there's no way to call import() on an object.
I'm surprised you're seeing that it's legal in some particular environment. Is
it
when writing Firefox extensions and/or XUL apps? If so, I can add a
configuration
option to permit it as an identifier.
Original comment by steve.ye...@gmail.com
on 14 Apr 2008 at 10:35
Steve try this code in the Firefox error console, it works just fine:
var foo = {};
foo.import = function () { return 42; };
foo.import();
I don't have a plain spidermonkey or xpcshell handy though.
Components.utils.import
is a new feature in Firefox, used by both extensions and xul apps.
Original comment by dlb...@gmail.com
on 14 Apr 2008 at 10:59
I verified that Firefox lets you use keywords as property names. IE and Rhino
do
not, and technically Ecma-262 forbids it. I'll have to submit a Rhino bug and
have
them chew on it.
In the meantime, I'll add an option that permits it in js2-mode, but it'll have
to be
off by default since it's not really legal JavaScript.
Original comment by steve.ye...@gmail.com
on 14 Apr 2008 at 11:36
Yea, that's fine. Perhaps a different error message when the identifier is a
keyword?
One that mentions the option would be nice.
Original comment by dlb...@gmail.com
on 14 Apr 2008 at 11:50
Fixed in the svn repository. Will be available as a new option
(js2-allow-keywords-as-property-names) in next release.
Original comment by steve.ye...@gmail.com
on 14 Apr 2008 at 12:12
Original comment by steve.ye...@gmail.com
on 16 Apr 2008 at 9:45
Original comment by steve.ye...@gmail.com
on 19 Apr 2008 at 10:53
Arg, my notifications for this bug were going to a black hole. Yes, this is for
writing Firefox extensions, where it is legal. Thanks for adding the option
for it!
Original comment by vthun...@gmail.com
on 21 May 2008 at 1:27
Original issue reported on code.google.com by
vthun...@gmail.com
on 31 Mar 2008 at 9:15