Backed out changeset 409285b3f69c (bug 862092) for mochitest-2 failures on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2013-04-17 11:48:34 -04:00
parent 9f4b6ef454
commit 78dad25bc3
5 changed files with 9 additions and 90 deletions

View File

@ -1492,37 +1492,24 @@ ReparentWrapper(JSContext* aCx, JS::HandleObject aObjArg)
js::SetReservedSlot(newobj, DOM_OBJECT_SLOT,
js::GetReservedSlot(aObj, DOM_OBJECT_SLOT));
bool isProxy = js::IsProxy(aObj);
// At this point, both |aObj| and |newobj| point to the same native
// which is bad, because one of them will end up being finalized with a
// native it does not own. |cloneGuard| ensures that if we exit before
// clearing |aObj|'s reserved slot the reserved slot of |newobj| will be
// set to null. |aObj| will go away soon, because we swap it with
// another object during the transplant and let that object die.
JSObject* propertyHolder;
JSObject *propertyHolder;
{
AutoCloneDOMObjectSlotGuard cloneGuard(aObj, newobj);
JSObject* copyFrom;
if (isProxy) {
copyFrom = DOMProxyHandler::GetExpandoObject(aObj);
} else {
copyFrom = aObj;
propertyHolder = JS_NewObjectWithGivenProto(aCx, nullptr, nullptr,
newParent);
if (!propertyHolder) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (copyFrom) {
propertyHolder = JS_NewObjectWithGivenProto(aCx, nullptr, nullptr,
newParent);
if (!propertyHolder) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (!JS_CopyPropertiesFrom(aCx, propertyHolder, copyFrom)) {
return NS_ERROR_FAILURE;
}
} else {
propertyHolder = nullptr;
if (!JS_CopyPropertiesFrom(aCx, propertyHolder, aObj)) {
return NS_ERROR_FAILURE;
}
// Expandos from other compartments are attached to the target JS object.
@ -1571,18 +1558,8 @@ ReparentWrapper(JSContext* aCx, JS::HandleObject aObjArg)
cache->SetPreservingWrapper(false);
cache->SetWrapper(aObj);
cache->SetPreservingWrapper(preserving);
if (propertyHolder) {
JSObject* copyTo;
if (isProxy) {
copyTo = DOMProxyHandler::EnsureExpandoObject(aCx, aObj);
} else {
copyTo = aObj;
}
if (!copyTo || !JS_CopyPropertiesFrom(aCx, copyTo, propertyHolder)) {
MOZ_CRASH();
}
if (!JS_CopyPropertiesFrom(aCx, aObj, propertyHolder)) {
MOZ_CRASH();
}
nsObjectLoadingContent* htmlobject;

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom()
{
var frameDoc = document.getElementById("f").contentDocument;
frameDoc.adoptNode(document.createElement("select"));
}
</script>
</head>
<body onload="boom();">
<iframe id="f"></iframe>
</body>
</html>

View File

@ -4,4 +4,3 @@ load 822340-2.html
load 832899.html
load 860591.html
load 860551.html
load 862092.html

View File

@ -72,7 +72,6 @@ MOCHITEST_FILES := \
test_queryInterface.html \
test_exceptionThrowing.html \
test_bug852846.html \
test_bug862092.html \
$(NULL)
MOCHITEST_CHROME_FILES = \

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=862092
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 862092</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 862092 **/
SimpleTest.waitForExplicitFinish();
function runTest()
{
var frameDoc = document.getElementById("f").contentDocument;
var a = document.createElement("select");
a.expando = "test";
a = frameDoc.adoptNode(a)
is(a.expando, "test", "adoptNode needs to preserve expandos");
SimpleTest.finish();
}
</script>
</head>
<body onload="runTest();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=862092">Mozilla Bug 862092</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="f"></iframe>
</div>
<pre id="test">
</pre>
</body>
</html>