Changing the style guide's preference for loose over strict equality checks in non-test code (was: Re: PSA: The mochitest ise() function is dead, please use is() instead)

2015-05-14 Thread Gijs Kruitbosch
On 14/05/2015 01:21, Martin Thomson wrote: On Wed, May 13, 2015 at 4:54 PM, Matthew N. mattn+firefox-...@mozilla.com wrote: In JavaScript, == is preferred to ===. from https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Operators Ahh, that's where it was hiding.

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-14 Thread Mike de Boer
On 14 May 2015, at 03:15, Boris Zbarsky bzbar...@mit.edu wrote: On 5/13/15 7:35 PM, Gregory Szorc wrote: I would steer people in the direction of Assert.jsm, specifically Assert.deepEqual This should be used very very carefully. As a very simple example, using this (or worse yet

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-14 Thread James Graham
On 14/05/15 00:35, Gregory Szorc wrote: I would steer people in the direction of Assert.jsm, specifically Assert.deepEqual, which uses ObjectUtils.jsm goodness for type aware comparisons so things like Date, RegExp, and Object comparisons have sane behavior. (deepEqual falls back to === for

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-14 Thread Boris Zbarsky
On 5/14/15 8:03 AM, Mike de Boer wrote: Same goes for Gecko wrapper objects, like `window`. When you want to use `deepEqual` with those, anyone should feel free to add support for it! Here's the thing. When comparing window objects, in what sense would anything other than === be useful?

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-14 Thread Ehsan Akhgari
On 2015-05-14 8:03 AM, Mike de Boer wrote: On 14 May 2015, at 03:15, Boris Zbarsky bzbar...@mit.edu wrote: On 5/13/15 7:35 PM, Gregory Szorc wrote: I would steer people in the direction of Assert.jsm, specifically Assert.deepEqual This should be used very very carefully. As a very simple

Re: Changing the style guide's preference for loose over strict equality checks in non-test code (was: Re: PSA: The mochitest ise() function is dead, please use is() instead)

2015-05-14 Thread Eric Rescorla
On Thu, May 14, 2015 at 9:14 AM, Martin Thomson m...@mozilla.com wrote: On Thu, May 14, 2015 at 5:17 AM, Gijs Kruitbosch gijskruitbo...@gmail.com wrote: On 14/05/2015 01:21, Martin Thomson wrote: On Wed, May 13, 2015 at 4:54 PM, Matthew N. mattn+firefox-...@mozilla.com wrote: In

Re: Changing the style guide's preference for loose over strict equality checks in non-test code (was: Re: PSA: The mochitest ise() function is dead, please use is() instead)

2015-05-14 Thread Martin Thomson
On Thu, May 14, 2015 at 5:17 AM, Gijs Kruitbosch gijskruitbo...@gmail.com wrote: On 14/05/2015 01:21, Martin Thomson wrote: On Wed, May 13, 2015 at 4:54 PM, Matthew N. mattn+firefox-...@mozilla.com wrote: In JavaScript, == is preferred to ===. from

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-13 Thread Gregory Szorc
On Wed, May 13, 2015 at 3:52 PM, Martin Thomson m...@mozilla.com wrote: On Wed, May 13, 2015 at 3:46 PM, Ehsan Akhgari ehsan.akhg...@gmail.com wrote: ise() was an alias to is() as of bug 949614. I landed bug 1154275 on inbound today which removes ise() and replaces its usages with is().

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-13 Thread Martin Thomson
On Wed, May 13, 2015 at 3:46 PM, Ehsan Akhgari ehsan.akhg...@gmail.com wrote: ise() was an alias to is() as of bug 949614. I landed bug 1154275 on inbound today which removes ise() and replaces its usages with is(). Since is() now does a === comparison by default, there should be no reason to

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-13 Thread Martin Thomson
On Wed, May 13, 2015 at 4:54 PM, Matthew N. mattn+firefox-...@mozilla.com wrote: In JavaScript, == is preferred to ===. from https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Operators Ahh, that's where it was hiding. Can we reverse that statement please?

Re: PSA: The mochitest ise() function is dead, please use is() instead

2015-05-13 Thread Boris Zbarsky
On 5/13/15 7:35 PM, Gregory Szorc wrote: I would steer people in the direction of Assert.jsm, specifically Assert.deepEqual This should be used very very carefully. As a very simple example, using this (or worse yet notDeepEqual) in any test that tries to check for equality of Window objects