Closed Bug 370048 Opened 17 years ago Closed 17 years ago

with (obj) function:: does not work properly with xml lists (e4x/Regress/regress-370048-*.js)

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

Consider the following js shell test:

~/m/trunk/mozilla/js/src $ cat ~/s/y.js
var list = <></>;
var actual, expected = list.function::length;
with (list)
    actual = function::length;

if (expected !== actual)
  throw "function::length does not work under the with statement with an empty xml list";
~/m/trunk/mozilla/js/src $ ./Linux_All_DBG.OBJ/js ~/s/y.js
/home/igor/s/y.js:4: ReferenceError: reference to undefined XML name @mozilla.org/js/function::length

The test fails since the current implementation of HasProperty in jsxml.c does not treat specially function qnames for lists and simply loops for children searching for the qname. That does not work with empty list.

Another problem is demonstrated by the following example:

~/m/trunk/mozilla/js/src $ cat ~/s/y.js
var list = <><a/></>;
var actual, expected = list.function::addNamespace;
with (list)
    actual = function::addNamespace;

if (actual !== expected)
    throw "Inconsistent xml list view through property access and with statement."

~/m/trunk/mozilla/js/src $ ./Linux_All_DBG.OBJ/js ~/s/y.js
uncaught exception: Inconsistent xml list view through property access and with statement.

Here the problem comes from the fact that for a list with one element list.function::addNamespace searches for functions in XML as well while using function::addNamespace does not perform such search.
Status: NEW → ASSIGNED
Depends on: 369740
This is fixed as a part of bug 370016.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Depends on: 370016
No longer depends on: 369740
Resolution: --- → FIXED
/cvsroot/mozilla/js/tests/e4x/Regress/regress-370048-01.js,v  <--  regress-370048-01.js
initial revision: 1.1

/cvsroot/mozilla/js/tests/e4x/Regress/regress-370048-02.js,v  <--  regress-370048-02.js
initial revision: 1.1
Flags: in-testsuite+
verified fixed 1.9.0 20070320 win/mac*/linux
Status: RESOLVED → VERIFIED
Summary: with (obj) function:: does not work properly with xml lists → with (obj) function:: does not work properly with xml lists (e4x/Regress/regress-370048-*.js)
You need to log in before you can comment on or make changes to this bug.