> Norris Boyd wrote:
> > On Aug 25, 7:58 pm, Mark Porter <dm4m
...@gmail.com> wrote:
> > > I am trying to use the FEATURE_WARNING_AS_ERROR flag, and in general
> > > it is helping me avoid common errors. One thing I can't figure out is
> > > this error:
> > > Referenced to undefined property "times" (file:/data/tomcat/webapps/
> > > myna/shared/js/profiler.js#107)
> > > 106: var my = arguments.callee;
> > > 107: if (!my.times) my.times = {}
> > > 108: var curLabel = element.label;
> > > The other common variants cause the same error:
> > > if (my.times === undefined)
> > > if (typeof my.times === 'undefined')
> > > I can get around this with something like this:
> > > if (!my["times"]) my.times = {}
> > > This seems like a hack. Is this the "proper" way to check for the
> > > existence of an object property?
> > On Aug 25, 7:58 pm, Mark Porter <dm4m...@gmail.com> wrote:
> > > I am trying to use the FEATURE_WARNING_AS_ERROR flag, and in general
> > > it is helping me avoid common errors. One thing I can't figure out is
> > > this error:
> > > Referenced to undefined property "times" (file:/data/tomcat/webapps/
> > > myna/shared/js/profiler.js#107)
> > > 106: var my = arguments.callee;
> > > 107: if (!my.times) my.times = {}
> > > 108: var curLabel = element.label;
> > > The other common variants cause the same error:
> > > if (my.times === undefined)
> > > if (typeof my.times === 'undefined')
> > > I can get around this with something like this:
> > > if (!my["times"]) my.times = {}
> > > This seems like a hack. Is this the "proper" way to check for the
> > > existence of an object property?
> > This is a bug in Rhino. Here's SpiderMonkey's behavior:
> > js> if (o.foo) print(3)
> > js> if (o.foo == "undefined") print(3)
> > typein:4: strict warning: reference to undefined property o.foo
> > js> if (typeof o.foo == "undefined") print(3)
> > 3
> > So a reference to an undefined property in strict mode is okay as the
> > operand of typeof or in a conditional.
> > I've filed bughttps://bugzilla.mozilla.org/show_bug.cgi?id=393785.
> > --N
> I just checked in changes to CVS so this is now fixed. Rhino now
> suppresses warnings for undefined property o.p for the following
> constructs:
> typeof o.p
> if (o.p)
> if (!o.p)
> if (o.p == undefined)
> if (undefined == o.p)
> --N
That will be perfect. Will that be in 1.6R8 when it is released? Also,