Last Comment Bug 56758 - Attr appendChild, insertBefore, removeChild, replaceChild fail
: Attr appendChild, insertBefore, removeChild, replaceChild fail
Status: RESOLVED INVALID
: dom1
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: x86 Windows 2000
: P3 normal with 7 votes (vote)
: Future
Assigned To: Nobody; OK to take it and work on it
:
: Andrew Overholt [:overholt]
Mentors:
: 421769 547798 (view as bug list)
Depends on: AttrExodus
Blocks: 125665
  Show dependency treegraph
 
Reported: 2000-10-15 17:52 PDT by Bob Clary [:bc:]
Modified: 2014-04-26 03:08 PDT (History)
19 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Bob Clary [:bc:] 2000-10-15 17:52:50 PDT
Attr may have Text or EntityReference Nodes as children.  When using any of the
appendChild, insertBefore, removeChild, replaceChild methods a
DOM_NO_MODIFICATION_ALLOWED_ERR exception is thrown no matter what.

To reproduce, visit the above URL using a recent build of Mozilla, select the
tc_catt504 test case and press submit.  In the left frame you can view the setup
steps (creating the nodes used), and the results of executing the test case. Due
to a scrollbar bug, you will have to click on the right frame and use the
keyboard to navigate through the report.

I will attach simplified testcases as soon as I can.
Comment 1 Johnny Stenback (:jst, jst@mozilla.com) 2000-10-17 18:01:57 PDT
Known problem, could even be a dup. --> Future.
Comment 2 Prashant Desale 2001-03-06 16:21:32 PST
QA contact Update
Comment 3 Prashant Desale 2001-06-05 12:06:30 PDT
Updating QA contact to Shivakiran Tummala.
Comment 4 Brian Clark 2001-08-03 19:30:55 PDT
This doesn't even come close to working in Mozilla 0.9.3 on MacOS 9.1. 

I just ran through the DOM HTML Level 2 Conformance tests made available by
Netscape.  The test is called "tc_hatt504 Test Attribute children".  Mozilla
0.9.3 for Mac failed every single part of this test, including
Node.insertBefore, appendChild, removeChild and replaceChild.

The Netscape test is available here:
http://developer.netscape.com/evangelism/tools/testsuites/tc.html?txtTitle=DOM%20HTML%20Level%202%20Conformance%20Tests&txtApiPath=w3c-dom-html-2/&txtTestCases=tc&txtInvariantApiTestFrame=tc_invariantTestFrame&txtMutantApiTestFrame=tc_mutantTestFrame

If this link doesn't work for you, try clicking on the "DOM HTML Level 2
Conformance Test on this page: 
http://developer.netscape.com/evangelism/tools/testsuites/

Comment 5 Brian King [:kinger] 2001-10-11 18:13:18 PDT
Some of these are working, some not (replaceChild). Will there be any movement
here soon?
Comment 6 Fabian Guisset 2001-10-13 05:46:55 PDT
Yes. See Jonas Sicking's last comment in bug 104219. Not too soon unfortunately :-(
Comment 7 Johnny Stenback (:jst, jst@mozilla.com) 2001-10-15 23:53:32 PDT
Even if our attribute code soon can cope with this we'll still need to work on
our entity code to expose what we need from the parser, I wouldn't hold my
breath here...
Comment 8 gavin long 2002-02-15 14:58:36 PST
This appears to be causing Moz to fail one of the tests in the w3c DOM test suite:

The test ECMAscript/tests/attrsetvaluenomodificationallowederrEE.html barfs, with 

[Exception... "Component returned failure code: 0x80004003
(NS_ERROR_INVALID_POINTER) [nsIDOMElement.appendChild]"  nsresult: "0x80004003
(NS_ERROR_INVALID_POINTER)"  
location: "JS frame ::
file:///C:/bugzilla/w3c_dom_core/ecmascript/tests/alltests.html ::
attrsetvaluenomodificationallowederrEE_runTest :: line 624"  data: no]"

Comment 9 Bob Clary [:bc:] 2002-02-27 11:13:14 PST
-> eapp per oracle
Comment 10 Bob Clary [:bc:] 2002-03-12 08:21:20 PST
remove eapp
Comment 11 Johnny Stenback (:jst, jst@mozilla.com) 2003-03-23 13:12:19 PST
Mass-reassigning bugs to dom_bugs@netscape.com
Comment 12 Pratik 2004-11-18 22:12:03 PST
So if I understand this right, I have to do the following to fix this bug

- I need to implement appendChild, etc in nsDOMAttribute class.
- Have appendChild, insertBefore, etc call appropriate functions in
nsAttributeChildList
- Implement those functions in nsAttributeChildList

Does this look right? If it does, then I have the following questions

- Is there a standard Vector or List data structure that I can use instead of
implementing my own in nsAttributeChildList.
Comment 13 Bob Clary [:bc:] 2005-10-19 08:36:44 PDT
My old mindspring account is long ago and far away. Updating URL. Select
tc_catt504. You can also run:
<http://test.bclary.com/tests/w3.org/2001/DOM-Test-Suite/build/ecmascript/level2/core/alltests.html>

Comment 14 Alex Vincent [:WeirdAl] 2006-06-12 12:41:43 PDT
I don't really have a good grasp on what's expected behavior for this bug.  I'm also not able to find the testcases bc points us to for Attr.*Child or Attr.insertBefore.
Comment 15 Bob Clary [:bc:] 2006-06-12 14:57:36 PDT
http://archive.bclary.com/bc-dom-tests/
Comment 16 Jeff Walden [:Waldo] (remove +bmo to email) 2006-07-28 22:17:22 PDT
For the record, there are some very basic tests which use Attr.appendChild in bug 345700 (to be committed within the next few days, depending on when I have free time ).  Whenever this is fixed, the test code there should be enabled so that this functionality can be tested there.
Comment 17 Peter Van der Beken [:peterv] 2006-09-06 01:29:29 PDT
When this is fixed the code in nsNodeUtils::CloneAndAdopt should be updated (it has a comment about which block to remove).
Comment 18 Bernd 2008-03-09 08:19:29 PDT
*** Bug 421769 has been marked as a duplicate of this bug. ***
Comment 19 Bernd 2008-03-09 08:23:05 PDT
currently we throw NS_ERROR_NOT_IMPLEMENTED
 instead of NS_ERROR_DOM_HIERARCHY_REQUEST_ERR as expected in http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html?raw=1
Comment 20 :Ms2ger (⌚ UTC+1/+2) 2011-10-09 11:41:56 PDT
*** Bug 547798 has been marked as a duplicate of this bug. ***
Comment 21 :Ms2ger (⌚ UTC+1/+2) 2014-02-27 13:25:52 PST
This shouldn't work per spec, and we won't make it work.
Comment 22 Bob Clary [:bc:] 2014-02-27 16:14:14 PST
<http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-637646024>

<quote>
In XML, where the value of an attribute can contain entity references, the child nodes of the Attr node may be either Text or EntityReference nodes 
</quote>

While html attributes don't have children, xml attributes do, so this isn't invalid. If it is not worth fixing, just say so.

For what it's worth, Chrome does allow you to append text children to either html or xml attributes and we now throw HierarchyRequestError.

Note You need to log in before you can comment on or make changes to this bug.