Re: DOMCore test bugs:

Hi David,

On 08/03/2011 11:01 PM, David Flanagan wrote:
> I've found a few problems trying to run the DOM Core .html tests.
>
> 1)
> webapps/DOMCore/tests/submissions/Ms2ger/Document-getElementsByTagName.html
>> test(function() {
>> var l = document.getElementsByTagName("nosuchtag")
>> l[5] = "foopy"
>> assert_equals(l.item(5), null)
>> }, "Expandos shouldn't affect item()")
>
> This test is incorrect: §4.7.3 of WebIDL (steps 2.4 and 2.5) say that
> the attempt to set l[5] should throw TypeError. This is different than
> what most web browsers do today, I think.

WebIDL says: [1]

 > 2.  If /O/ supports indexed properties and /P/ is an array index
 >     property name, then:
>     4.  If /creating/ is true and /O/ does not implement an interface
 >         with an index creator, then Reject.

and

> The term “Reject” is used in the same sense as that defined in
> ECMA-262, namely, to mean “If /Throw/ is |true|, then throw a |TypeError|
> exception, otherwise return |false|”.

In this case, /Throw/ is false. (It is true if and only if the script is 
in strict mode.)

> 2) webapps/DOMCore/tests/submissions/Ms2ger/Element-tagName.html
>
> this test relies on DOMParser, which means that simple DOM Core
> implementations can't run it.

I've made that part optional.

>
> 3) webapps/DOMCore/tests/submissions/Ms2ger/Node-appendChild.html
> webapps/DOMCore/tests/submissions/Ms2ger/Node-removeChild.html
>
> These two tests use frames[], so DOM Core implementations that don't
> support that property can't run them.

I can make them use iframe.contentDocument instead, if that helps you. I 
do think we should keep those tests, though. Regardless of spec 
organization, this is code that does need to be tested, and we can't 
really rely on the same code being hit with Documents created using, 
e.g., DOMImplementation.createDocument.

> 4) webapps/DOMCore/tests/submissions/Ms2ger/Node-hasAttributes.html
>
> This one tests for hasAttributes() which has been explicitly removed
> from the DOM Core spec.

Looks like it was, indeed. I removed the test.

> 5) webapps/DOMCore/tests/submissions/Ms2ger/Node-insertBefore.html
>
> This test treats Attr objects like nodes, but DOM Core says they are not
> nodes.

I've removed these checks.

http://dvcs.w3.org/hg/webapps/rev/d7927f4830d8

Thanks for your comments
Ms2ger

[1] http://dev.w3.org/2006/webapi/WebIDL/#defineownproperty

Received on Monday, 8 August 2011 11:37:19 UTC