The default bug view has changed. See this FAQ.

Improve how we pass arguments to reflects.js methods

RESOLVED FIXED in mozilla8

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mounir, Assigned: mounir)

Tracking

Trunk
mozilla8
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
Created attachment 543443 [details] [diff] [review]
Patch v1

I mean, I think it's an improvement because it seems clearer.
Attachment #543443 - Flags: review?(Ms2ger)
(Assignee)

Updated

6 years ago
Blocks: 668822
(Assignee)

Updated

6 years ago
Blocks: 668824
(Assignee)

Updated

6 years ago
Blocks: 668826
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
Attachment #543443 - Flags: review?(Ms2ger) → review+
(Assignee)

Updated

6 years ago
Flags: in-testsuite+
Whiteboard: [needs review] → [inbound]
(Assignee)

Comment 2

6 years ago
Pushed:
http://hg.mozilla.org/mozilla-central/rev/7e731092c999
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.