From eb08da7660c0b6ab0635597f3b52961fef1623bd Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 4 Dec 2010 09:00:19 +0100 Subject: [PATCH] Bug 613793 - Raise an exception when trying to append a child to a DocumentType; r=bzbarsky a=jst --- content/base/src/nsGenericElement.cpp | 8 ++--- content/base/test/Makefile.in | 1 + content/base/test/test_bug564047.html | 31 +++++++++++++++++++ .../mochitest/dom-level1-core/exclusions.js | 2 +- 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 content/base/test/test_bug564047.html diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index ea5815d48ca5..3060ef7828b2 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -4006,14 +4006,12 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild, return NS_ERROR_NULL_POINTER; } - if (IsNodeOfType(eDATA_NODE)) { + if (!IsNodeOfType(eDOCUMENT) && + !IsNodeOfType(eDOCUMENT_FRAGMENT) && + !IsElement()) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } - if (IsNodeOfType(eATTRIBUTE)) { - return NS_ERROR_NOT_IMPLEMENTED; - } - nsIContent* refContent; nsresult res = NS_OK; PRInt32 insPos; diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index 6592a31a82f5..7e4ce96564ac 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -421,6 +421,7 @@ _TEST_FILES2 = \ file_x-frame-options_main.html \ file_x-frame-options_page.sjs \ test_createHTMLDocument.html \ + test_bug564047.html \ test_bug567350.html \ test_bug574596.html \ test_bug578096.html \ diff --git a/content/base/test/test_bug564047.html b/content/base/test/test_bug564047.html new file mode 100644 index 000000000000..0d421aa1ee4a --- /dev/null +++ b/content/base/test/test_bug564047.html @@ -0,0 +1,31 @@ + + + + + Test for Bug 564047 + + + + + +Mozilla Bug 564047 +

+ +
+
+
+ + diff --git a/dom/tests/mochitest/dom-level1-core/exclusions.js b/dom/tests/mochitest/dom-level1-core/exclusions.js index 1959e571e1c5..a88568b10e96 100644 --- a/dom/tests/mochitest/dom-level1-core/exclusions.js +++ b/dom/tests/mochitest/dom-level1-core/exclusions.js @@ -74,7 +74,7 @@ var indexErrTests = ["characterdataindexsizeerrdeletedatacountnegative", "charac "characterdataindexsizeerrsubstringcountnegative", "hc_characterdataindexsizeerrdeletedatacountnegative", "hc_characterdataindexsizeerrreplacedatacountnegative", "hc_characterdataindexsizeerrsubstringcountnegative"]; -var attributeModTests = ["hc_attrappendchild1", "hc_attrappendchild2", "hc_attrappendchild3", "hc_attrappendchild5", +var attributeModTests = ["hc_attrappendchild1", "hc_attrappendchild3", "hc_attrappendchild5", "hc_attrappendchild6", "hc_attrchildnodes2", "hc_attrclonenode1", "hc_attrinsertbefore1", "hc_attrinsertbefore2", "hc_attrinsertbefore3", "hc_attrinsertbefore4", "hc_attrinsertbefore6", "hc_attrnormalize", "hc_attrremovechild2", "hc_attrreplacechild1", "hc_attrreplacechild2",