bug 580128 - Find the true caller through the wrappers. r=jst

This commit is contained in:
Blake Kaplan 2010-10-10 15:36:01 -07:00
parent 9d0588387a
commit 0b191e8ccd

View File

@ -5573,8 +5573,24 @@ nsGlobalWindow::CallerInnerWindow()
return nsnull;
}
JSObject *scope = ::JS_GetScopeChain(cx);
JSObject *scope = nsnull;
JSStackFrame *fp = nsnull;
JS_FrameIterator(cx, &fp);
if (fp) {
while (fp->isDummyFrame()) {
if (!JS_FrameIterator(cx, &fp))
break;
}
if (fp)
scope = &fp->scopeChain();
}
if (!scope)
scope = JS_GetScopeChain(cx);
JSAutoEnterCompartment ac;
if (!ac.enter(cx, scope))
return nsnull;
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;