Bug 620947. Be a little more careful getting properties from document.all. r=jst

This commit is contained in:
Boris Zbarsky 2010-12-27 14:41:31 -06:00
parent f37460a48d
commit 571ccbe530
3 changed files with 35 additions and 0 deletions

View File

@ -8750,6 +8750,8 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSObject *obj,
result = node;
cache = node;
} else {
result = nsnull;
}
if (result) {

View File

@ -133,6 +133,7 @@ _TEST_FILES = \
file_bug593174_2.html \
test_bug612267.html \
test_bug617296.html \
test_bug620947.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,32 @@
<!-- This test must be in quirks mode so it has a document.all -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=620947
-->
<head>
<title>Test for Bug 620947</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=620947">Mozilla Bug 620947</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 620947 **/
is(-1 in document.all, false, "shouldn't be there");
is(document.all[-1], undefined, "shouldn't be able to get it");
</script>
</pre>
</body>
</html>