Bug 467123 - Document.cloneNode() failed in a JS component, r+sr=bz

This commit is contained in:
Olli Pettay 2008-12-05 12:48:27 +02:00
Родитель 88b6c463de
Коммит 65516d2348
3 изменённых файлов: 39 добавлений и 2 удалений

Просмотреть файл

@ -7347,8 +7347,7 @@ nsDocument::CloneDocHelper(nsDocument* clone) const
clone->nsDocument::SetDocumentURI(nsIDocument::GetDocumentURI());
// Must set the principal first, since SetBaseURI checks it.
clone->SetPrincipal(NodePrincipal());
rv = clone->SetBaseURI(nsIDocument::GetBaseURI());
NS_ENSURE_SUCCESS(rv, rv);
clone->mDocumentBaseURI = mDocumentBaseURI;
// Set scripting object
PRBool hasHadScriptObject = PR_TRUE;

Просмотреть файл

@ -51,6 +51,7 @@ _CHROME_FILES = \
test_bug421622.xul \
test_bug429785.xul \
test_bug430050.xul \
test_bug467123.xul \
$(NULL)
libs:: $(_TEST_FILES)

Просмотреть файл

@ -0,0 +1,37 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=467123
-->
<window title="Mozilla Bug 467123"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=467123"
target="_blank">Mozilla Bug 467123</a>
</body>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
/** Test for Bug 467123 **/
var xhr = new XMLHttpRequest();
xhr.open("GET", "chrome://global/content/bindings/button.xml", false);
xhr.send();
ok(xhr.responseXML, "We should have response document!");
var e = null;
try {
var clone = xhr.responseXML.cloneNode(true);
} catch (ex) {
e = ex;
}
ok(!e, e);
]]></script>
</window>