#15 ✓resolved
thatcher.christopher (at gmail)

DOMDocument : jQuery 1.3.1: isXml causing endless recursion

Reported by thatcher.christopher (at gmail) | January 31st, 2009 @ 06:29 AM | in 1.0 Release

All, I just upgraded from jQuery 1.2.6 to 1.3.1 and I'm seeing this while using Chris Thatcher's latest (as of Jan 20, 2009). (This is after I patched the problem from my earlier email regarding arrays: http://groups.google.com/group/e...

java.lang.StackOverflowError
       at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1658)
       at org.mozilla.javascript.gen.c2._c295(../..//vendor/plugins/javascript_testing/lib/env.rhino.js:4336)
       at org.mozilla.javascript.gen.c2.call(../..//vendor/plugins/javascript_testing/lib/env.rhino.js)
       at org.mozilla.javascript.ScriptableObject.getImpl(ScriptableObject.java:2008)
       at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:286)
       at org.mozilla.javascript.IdScriptableObject.get(IdScriptableObject.java:387)
       at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1601)
       at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1398)
       at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1384)
       at org.mozilla.javascript.gen.c3._c197(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js:2220)
       at org.mozilla.javascript.gen.c3.call(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js)
       at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
       at org.mozilla.javascript.gen.c3._c197(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js:2220)
       at org.mozilla.javascript.gen.c3.call(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js)
       at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
       at org.mozilla.javascript.gen.c3._c197(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js:2220)
       at org.mozilla.javascript.gen.c3.call(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js)
       at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
       at org.mozilla.javascript.gen.c3._c197(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js:2220)
       at org.mozilla.javascript.gen.c3.call(../..//vendor/plugins/javascript_testing/lib/jquery-1.3.1.js)
       at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)

I tracked this down to the jQuery isXml() function that changed from 1.2.6 to 1.3.1. Here are two related change-logs: http://code.google.com/p/jqueryj... http://code.google.com/p/jqueryj...

It looks to me that isXml recurses up the DOM tree and finds the root DOMDocument. However, since DOMDocument says its ownerDocument is itself, isXml gets stuck in an endless recursion, causing the StackOverflow above.

I tried just telling DOMDocument that its ownerDocument was null, but that seemed to cause several more problems. I'm not sure if that's the correct thing to do.

Any ideas?

Thanks again, Larry

Comments and changes to this ticket

  • Thatcher

    Thatcher February 1st, 2009 @ 05:42 PM

    • State changed from “new” to “open”

    If I call document.ownerDocument in ff3 in firebug console I get null. So I think this is right.

    The issue is total cruft from the integration of the pure js dom.

    The big problem is that DOMDocument inherits from DOMNode which uses this.ownerDocument.implementation all over the place.

    I have to figure out a good solution for this.

    Thanks for finding this.

  • Thatcher

    Thatcher February 16th, 2009 @ 09:45 AM

    • Assigned user changed from “thatcher.christopher (at gmail)” to “Thatcher”

    still working on this. I'm going to have to refactor the some of the dom stuff or might add a getter to the dom document so it only exposes the ownerDocument as null there.

  • larry.karnowski (at gmail)

    larry.karnowski (at gmail) February 17th, 2009 @ 01:53 AM

    Thatcher, now that I can run the jQuery 1.3.1 compatibility test suite from my env.js working directory, I'm starting to refactor the DOM a bit to tackle that null ownerDocument.

  • Thatcher

    Thatcher February 17th, 2009 @ 04:31 AM

    this should be fixed. I added a util function ownerDocument that takes a node and return the ownerdocument or the document if the node is a document node. this allows us to us the method internally to safely set ownerDocument to null in DOMDocument while inheriting everything from DOMNode.

    Still leaving this open till we verify it fixes the recursion.

    Once I get larry's test framework in and verify I'll close.

  • Thatcher

    Thatcher September 9th, 2009 @ 07:12 PM

    • State changed from “open” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

People watching this ticket

Referenced by

Pages