Yes there are cases that are specialized, but there are cases that aren't
found. I'm having trouble reproducing because, as I mentioned before, the
way the code is loaded/eval'd determines if the messages are logged or not
and it doesn't seem they are in the console or scratchpad. This is hugely
annoying for tests that just start failing all of a sudden because of these
"errors" after you go from common js style loading to JSM loading or
something like that, for whatever reason.

Does the engine special case these?

    let foo = config.foo;
    if (foo) ...

of

    function foobar(option) {
      if (option) ...
    }
    foobar(config.option);

But really, we should really be making these warnings *optional*. I don't
really care too much to debate the specific warnings. Right now, they are
currently forced upon us without a choice. Tests shouldn't use the flag
(because that imposes on everyone), and if you want them for your
development, you should still be able to use them, but in a way that
doesn't force those who don't want them to do so.

On Fri, Dec 19, 2014 at 7:05 PM, Jim Blandy <j...@red-bean.com> wrote:

> On Fri, Dec 19, 2014 at 2:22 PM, Nick Fitzgerald <nfitzger...@mozilla.com>
> wrote:
>
>> I generally don't find them useful, but instead annoying, and that they
>> provide a lot of noise to filter out to find actual relevant errors. This
>> is including the undefined property errors. It is a common JS style to
>> pass
>> around configuration/option objects that will be missing many properties
>> that get accessed by functions they are passed to. My understanding is
>> that
>> part of this is special cased not to generate these messages, but in my
>> experience it isn't close to enough.
>>
>
> In a recent message, Jason explained that code that tests for the presence
> of a property:
>
>   if (obj.prop)
>   if (obj.prop === undefined)
>   if (obj.prop && ...)
>
> are not supposed to generate warnings.
>
> Do you find that you're getting these warnings from code that has one of
> those forms?
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to