Closed Bug 288027 Opened 20 years ago Closed 18 years ago

XMLList object should be instanceof XML

Categories

(Rhino Graveyard :: E4X, defect)

1.6R1
x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: martin.honnen, Assigned: inonit)

Details

Attachments

(1 file, 3 obsolete files)

Section 13.4.3.10 [[HasInstance]] ( V ) in the E4X specification says that the
internal HasInstance method of the XML constructor is special, it should yield
true for both XML and XMLList objects:
  "The XML constructor has a more elaborate [[HasInstance]] method than other
function objects. The XML constructor [[HasInstance]] method is defined such
that given an XML object or an XMLList object x, the expression x instanceof XML
will return true."
Rhino doesn't implement that currently it seems, as the test case

var xmlListObject1 = new XMLList('<god>Kibo</god>');
var xmlListObject2 = new XMLList('<god>Kibo</god><devil>Xibo</devil>');

print("xmlListObject1 instanceof XML: " + (xmlListObject1 instanceof XML));
print("xmlListObject2 instanceof XML: " + (xmlListObject2 instanceof XML));

yields

Rhino 1.6 release 1 2004 11 30
js> load('mozillaBugs/e4x/XMLListInstanceofXML1.js');
xmlListObject1 instanceof XML: false
xmlListObject2 instanceof XML: false

while Spidermonkey yields

js> load('mozillaBugs/e4x/XMLListInstanceofXML1.js');
xmlListObject1 instanceof XML: true
xmlListObject2 instanceof XML: true

So this is a bug in Rhino.
Reassigning to please_see_bug_288433@eml.cc pending resolution of bug 288433
Assignee: igor.bukanov → please_see_bug_288433
Assignee: please_see_bug_288433 → nobody
Attached file proposed testcase (obsolete) —
Bob, for your review ...
Assignee: nobody → inonit
Attachment #178802 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Submitter's test now passes if XMLBeans is not present.  See bug 355677.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
(In reply to comment #3)

> Bob, for your review ...

David, did you file the bug to add review flags to Rhino product's components?
No, I'm a bit behind on my queue.  I'll get caught up as soon as I can ... sorry.
Comment on attachment 254219 [details]
proposed testcase

Requesting review with our brand-new mechanism for same. :)
Attachment #254219 - Flags: review?(bclary)
Comment on attachment 254219 [details]
proposed testcase

>/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
> *

I prefer the mode line be kept separate from the license block in case Gerv 
or someone needs to do bulk edits of the license headers some time in the
future.

...

> *
> * The Original Code is Rhino code, released
> * May 6, 1999.
> *
> * The Initial Developer of the Original Code is
> * Netscape Communications Corporation.
> * Portions created by the Initial Developer are Copyright (C) 1997-2000
> * the Initial Developer. All Rights Reserved.

Netscape has nothing to do with this and the copyright is wrong. I would prefer
we use the boilerplate in <http://lxr.mozilla.org/mozilla/source/js/tests/e4x/template.js>

...

>START("13.4.3.10 - XML Constructor [[HasInstance]]");
>
>BUG(288027);
>
>var xmlListObject1 = new XMLList('<god>Kibo</god>');
>var xmlListObject2 = new XMLList('<god>Kibo</god><devil>Xibo</devil>');
>
>TEST(1, true, xmlListObject1 instanceof XML);
>TEST(2, true, xmlListObject2 instanceof XML);
>
>END();

missing end of line.

I think this should be located at e4x/XML/13.4.3.10.js

If it is alright with you, I'll make these edits and check it in.
Attachment #254219 - Flags: review?(bclary) → review-
Attached file Re-licensed test (obsolete) —
Attachment #254219 - Attachment is obsolete: true
Attachment #256634 - Flags: review?(bclary)
Attached file Renamed test
Attachment #256634 - Attachment is obsolete: true
Attachment #256635 - Flags: review?(bclary)
Attachment #256634 - Flags: review?(bclary)
Comment on attachment 256635 [details]
Renamed test

approved with minor nits:

1. I didn't mean to remove the mode line, just not make it part of the license block. I've gone ahead and added it back in the version I am checking in.

2. The person who filed the bug and/or came up with the original testcase in the bug usually gets the contributor attribution, although the person who creates the actual js test suite version of the test can also get contributor attribution. I've gone ahead and added Martin back to the contributor list to the version I am checking in.

/cvsroot/mozilla/js/tests/e4x/XML/13.4.3.10.js,v  <--  13.4.3.10.js
Attachment #256635 - Flags: review?(bclary) → review+
Flags: in-testsuite? → in-testsuite+
Adding target milestone of 1.6R6 based on the date this bug was resolved FIXED.
Target Milestone: --- → 1.6R6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: