mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 891891 - Print diagnostics when an XPCWrappedJS is QI-ed off-main-thread. r=mrbkap
Let's try to figure out which XPCWrappedJS is causing this. I've filed a reminder for myself to back this out by sept 3.
This commit is contained in:
parent
02b6e70d9b
commit
e8a333cf1c
@ -573,6 +573,22 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self,
|
||||
REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (MOZ_UNLIKELY(!NS_IsMainThread())) {
|
||||
printf("Uh oh! DelegatedQueryInterface called off-main-thread!\n");
|
||||
printf("Name: %s\n", GetInterfaceName());
|
||||
JSCompartment *c = js::GetObjectCompartment(self->GetJSObjectPreserveColor());
|
||||
char *origin = nullptr;
|
||||
nsresult rv = xpc::GetCompartmentPrincipal(c)->GetOrigin(&origin);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
printf("Principal origin: %s\n", origin);
|
||||
NS_Free(origin);
|
||||
} else {
|
||||
printf("Unable to get origin from principal :-(\n");
|
||||
}
|
||||
nsAutoCString loc(EnsureCompartmentPrivate(c)->GetLocation());
|
||||
printf("Global's Location: %s\n", loc.get());
|
||||
MOZ_CRASH();
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIXPConnectJSObjectHolder))) {
|
||||
NS_ADDREF(self);
|
||||
*aInstancePtr = (void*) static_cast<nsIXPConnectJSObjectHolder*>(self);
|
||||
|
Loading…
Reference in New Issue
Block a user