Bug 761831 - Be less ambitious in GetMemberInfo. r=bholley

This commit is contained in:
Andrew McCreight 2012-07-18 13:28:58 -07:00
parent 622384cea0
commit de2697fb49
3 changed files with 46 additions and 22 deletions

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
function removeRoot() {
window.removeEventListener("DOMNodeRemoved", removeRoot, true);
document.open();
}
window.addEventListener("DOMNodeRemoved", removeRoot, true);
var r = document.documentElement;
document.removeChild(r);
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -39,6 +39,7 @@ load 720305-1.html
load 723465.html
load 732870.html
load 751995.html
load 761831.html
asserts(0-1) load 752038.html # We may hit bug 645229 here.
asserts(1) load 753162.html # We hit bug 675518 or bug 680086 here.
load 754311.html

View File

@ -363,31 +363,31 @@ xpc_qsThrow(JSContext *cx, nsresult rv)
static void
GetMemberInfo(JSObject *obj, jsid memberId, const char **ifaceName)
{
// Get the interface name. From DefinePropertyIfFound (in
// xpcwrappednativejsops.cpp) and XPCThrower::Verbosify.
//
// We could instead make the quick stub could pass in its interface name,
// but this code often produces a more specific error message, e.g.
*ifaceName = "Unknown";
NS_ASSERTION(IS_WRAPPER_CLASS(js::GetObjectClass(obj)) ||
js::GetObjectClass(obj) == &XPC_WN_Tearoff_JSClass,
"obj must be a wrapper");
XPCWrappedNativeProto *proto;
if (IS_SLIM_WRAPPER(obj)) {
proto = GetSlimWrapperProto(obj);
} else {
XPCWrappedNative *wrapper = (XPCWrappedNative *) js::GetObjectPrivate(obj);
proto = wrapper->GetProto();
}
if (proto) {
XPCNativeSet *set = proto->GetSet();
if (set) {
XPCNativeMember *member;
XPCNativeInterface *iface;
// Don't try to generate a useful name if there are security wrappers,
// because it isn't worth the risk of something going wrong just to generate
// an error message. Instead, only handle the simple case where we have the
// reflector in hand.
if (IS_WRAPPER_CLASS(js::GetObjectClass(obj))) {
XPCWrappedNativeProto *proto;
if (IS_SLIM_WRAPPER_OBJECT(obj)) {
proto = GetSlimWrapperProto(obj);
} else {
MOZ_ASSERT(IS_WN_WRAPPER_OBJECT(obj));
XPCWrappedNative *wrapper =
static_cast<XPCWrappedNative *>(js::GetObjectPrivate(obj));
proto = wrapper->GetProto();
}
if (proto) {
XPCNativeSet *set = proto->GetSet();
if (set) {
XPCNativeMember *member;
XPCNativeInterface *iface;
if (set->FindMember(memberId, &member, &iface))
*ifaceName = iface->GetNameString();
if (set->FindMember(memberId, &member, &iface))
*ifaceName = iface->GetNameString();
}
}
}
}