Bug 618871 - Try again to fix accessing content constructors from chrome through Xray wrappers. r=jst@mozilla.com, a=blocker

This commit is contained in:
Blake Kaplan 2011-01-05 20:28:19 -08:00
parent b195811fd6
commit 617e140f0e
3 changed files with 17 additions and 2 deletions

View File

@ -6115,8 +6115,19 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
}
NS_ENSURE_TRUE(ci, NS_ERROR_UNEXPECTED);
return aXPConnect->GetWrappedNativePrototype(cx, aWin->GetGlobalJSObject(),
ci, aProto);
nsresult rv =
aXPConnect->GetWrappedNativePrototype(cx, aWin->GetGlobalJSObject(), ci,
aProto);
NS_ENSURE_SUCCESS(rv, rv);
JSObject *proto_obj;
(*aProto)->GetJSObject(&proto_obj);
if (!JS_WrapObject(cx, &proto_obj)) {
return NS_ERROR_FAILURE;
}
NS_IF_RELEASE(*aProto);
return aXPConnect->HoldObject(cx, proto_obj, aProto);
}
// Either ci_data must be non-null or name_struct must be non-null and of type

View File

@ -15,6 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=610390
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<iframe type="content"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
src="data:text/html,&lt;script&gt;var x=3&lt;/script&gt;"
onload="go()"
id="ifr">

View File

@ -59,6 +59,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500931
saw0 = true;
}
ok(saw0, "properly enumerated the 0 value");
ok(win.XPathEvaluator.toString().indexOf("XPathEvaluator") >= 0,
"Can access content window.XPathEvaluator");
}
SimpleTest.waitForExplicitFinish();