mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 22:35:43 +00:00
Bug 553896 - Node.isEqualNode(null) shouldn't throw. r=smaug
This commit is contained in:
parent
0152250bfd
commit
f42ea8604f
@ -539,10 +539,11 @@ NS_IMETHODIMP
|
||||
nsDOMAttribute::IsEqualNode(nsIDOMNode* aOther,
|
||||
PRBool* aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOther);
|
||||
|
||||
*aReturn = PR_FALSE;
|
||||
|
||||
if (!aOther)
|
||||
return NS_OK;
|
||||
|
||||
// Node type check by QI. We also reuse this later.
|
||||
nsCOMPtr<nsIAttribute> aOtherAttr = do_QueryInterface(aOther);
|
||||
if (!aOtherAttr) {
|
||||
|
@ -5668,10 +5668,11 @@ nsDocument::IsSameNode(nsIDOMNode* aOther, PRBool* aReturn)
|
||||
NS_IMETHODIMP
|
||||
nsDocument::IsEqualNode(nsIDOMNode* aOther, PRBool* aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOther);
|
||||
|
||||
*aReturn = PR_FALSE;
|
||||
|
||||
if (!aOther)
|
||||
return NS_OK;
|
||||
|
||||
// Node type check by QI. We also reuse this later.
|
||||
nsCOMPtr<nsIDocument> aOtherDoc = do_QueryInterface(aOther);
|
||||
if (!aOtherDoc) {
|
||||
|
@ -894,10 +894,11 @@ nsNode3Tearoff::AreNodesEqual(nsIContent* aContent1,
|
||||
NS_IMETHODIMP
|
||||
nsNode3Tearoff::IsEqualNode(nsIDOMNode* aOther, PRBool* aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOther);
|
||||
|
||||
*aReturn = PR_FALSE;
|
||||
|
||||
if (!aOther)
|
||||
return NS_OK;
|
||||
|
||||
// Since we implement nsIContent, aOther must as well.
|
||||
nsCOMPtr<nsIContent> aOtherContent = do_QueryInterface(aOther);
|
||||
// Documents and attributes don't implement nsIContent.
|
||||
|
@ -361,6 +361,7 @@ _TEST_FILES = test_bug5141.html \
|
||||
test_bug548463.html \
|
||||
test_bug545644.html \
|
||||
test_bug545644.xhtml \
|
||||
test_bug553896.xhtml \
|
||||
$(NULL)
|
||||
|
||||
# This test fails on the Mac for some reason
|
||||
|
70
content/base/test/test_bug553896.xhtml
Normal file
70
content/base/test/test_bug553896.xhtml
Normal file
@ -0,0 +1,70 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=553896
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 553896</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553896">Mozilla Bug 553896</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/** Test for Bug 553896 **/
|
||||
try {
|
||||
ok(!document.createElement("foo").isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.createAttribute("foo").isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.createTextNode("foo").isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.createCDATASection("foo").isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.createProcessingInstruction("foo", "bar").isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.createComment("foo").isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.implementation.createDocumentType("html", "", "").isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
try {
|
||||
ok(!document.createDocumentFragment().isEqualNode(null), "Node is equal to null?");
|
||||
} catch (e) {
|
||||
ok(false, "Exception was raised.");
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user