зеркало из https://github.com/mozilla/gecko-dev.git
Bug 737612 - Range.insertNode() on a detached text node should throw standard exception type; r=smaug
This commit is contained in:
Родитель
0874f9e17c
Коммит
660bfc0de9
|
@ -2107,7 +2107,7 @@ nsRange::InsertNode(nsIDOMNode* aN)
|
|||
nsCOMPtr<nsIDOMNode> tSCParentNode;
|
||||
res = tStartContainer->GetParentNode(getter_AddRefs(tSCParentNode));
|
||||
if(NS_FAILED(res)) return res;
|
||||
NS_ENSURE_STATE(tSCParentNode);
|
||||
NS_ENSURE_TRUE(tSCParentNode, NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
|
||||
|
||||
PRInt32 tEndOffset;
|
||||
GetEndOffset(&tEndOffset);
|
||||
|
|
|
@ -569,6 +569,7 @@ _TEST_FILES2 = \
|
|||
bug696301-script-1.js^headers^ \
|
||||
bug696301-script-2.js \
|
||||
test_bug737565.html \
|
||||
test_bug737612.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=737612
|
||||
-->
|
||||
<title>Test for Bug 737612</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=737612">Mozilla Bug 737612</a>
|
||||
<script>
|
||||
|
||||
/** Test for Bug 737612 **/
|
||||
var text = document.createTextNode("abc");
|
||||
var range = document.createRange();
|
||||
range.setStart(text, 1);
|
||||
var threw = false;
|
||||
try {
|
||||
range.insertNode(document.head);
|
||||
} catch(e) {
|
||||
var threw = true;
|
||||
is(Object.getPrototypeOf(e), DOMException.prototype,
|
||||
"Must throw DOMException");
|
||||
is(e.code, DOMException.HIERARCHY_REQUEST_ERR,
|
||||
"Must throw HIERARCHY_REQUEST_ERR");
|
||||
}
|
||||
ok(threw, "Must throw when insertNode()ing into detached text node");
|
||||
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче