Last Comment Bug 668820 - Improve how we pass arguments to reflects.js methods
: Improve how we pass arguments to reflects.js methods
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla8
Assigned To: Mounir Lamouri (:mounir)
:
Mentors:
Depends on:
Blocks: 668822 668824 668826
  Show dependency treegraph
 
Reported: 2011-07-01 08:27 PDT by Mounir Lamouri (:mounir)
Modified: 2011-07-06 06:03 PDT (History)
1 user (show)
mounir: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (28.68 KB, patch)
2011-07-01 08:27 PDT, Mounir Lamouri (:mounir)
Ms2ger: review+
Details | Diff | Review

Description Mounir Lamouri (:mounir) 2011-07-01 08:27:25 PDT
Created attachment 543443 [details] [diff] [review]
Patch v1

I mean, I think it's an improvement because it seems clearer.
Comment 1 :Ms2ger 2011-07-03 07:58:54 PDT
Comment on attachment 543443 [details] [diff] [review]
Patch v1

I'm not a big fan of this pattern, but it does look like an improvement here.

>--- a/content/html/content/test/reflect.js
>+++ b/content/html/content/test/reflect.js
> /**
>  * Checks that a given attribute is correctly reflected as a string.
>  *
>- * @param aElement      Element   node to test
>- * @param aAttr         String    name of the attribute
>- * @param aOtherValues  Array     other values to test in addition of the default ones [optional]
>+ * @param aParameters   Object    object containing the parameters, which are:
>+ *  - element      Element   node to test
>+ *  - attribute    String    name of the attribute
>+ *  - otherValues  Array     [optional] other values to test in addition of the default ones
>  */

Here and elsewhere, the indentation seems random.

>-function reflectString(aElement, aAttr, aOtherValues)
>+function reflectString(aParameters) //aElement, aAttr, aOtherValues)

Get rid of the comment.

>   // Tests when the attribute isn't set.
>-  is(aElement.getAttribute(aAttr), null,
>+  is(element.getAttribute(attr), null,
>      "When not set, the content attribute should be undefined.");

null

>-  is(aElement[aAttr], "",
>+  is(element[attr], "",
>      "When not set, the IDL attribute should return the empty string");
> 
>   /**
>    * TODO: as long as null stringification doesn't fallow the webidl specs,

"follow the WebIDL specification"

> 
>   // Tests after removeAttribute() is called. Should be equivalent with not set.
>-  is(aElement.getAttribute(aAttr), null,
>+  is(element.getAttribute(attr), null,
>      "When not set, the content attribute should be undefined.");

And here

>-function reflectUnsignedInt(aElement, aAttr, aNonNull, aDefault)
>+function reflectUnsignedInt(aParameters)
> {
>-  ok(aAttr in aElement, aAttr + " should be an IDL attribute of this element");
>-  is(typeof aElement[aAttr], "number", aAttr + " IDL attribute should be a string");
>+  ok(attr in element, attr + " should be an IDL attribute of this element");
>+  is(typeof element[attr], "number", attr + " IDL attribute should be a string");

... a number

And s/nonNull/nonZero/ everywhere.

r=me
Comment 2 Mounir Lamouri (:mounir) 2011-07-06 06:03:19 PDT
Pushed:
http://hg.mozilla.org/mozilla-central/rev/7e731092c999

Note You need to log in before you can comment on or make changes to this bug.