mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 761831 - Be less ambitious in GetMemberInfo. r=bholley
This commit is contained in:
parent
622384cea0
commit
de2697fb49
23
js/xpconnect/crashtests/761831.html
Normal file
23
js/xpconnect/crashtests/761831.html
Normal 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>
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user