зеркало из https://github.com/mozilla/pjs.git
Don't create exceptions using the global object as the parent, since that's bogus, use the scope chain instead. bug 386695, r+sr=jst
This commit is contained in:
Родитель
a1b0206721
Коммит
cabc2867aa
|
@ -259,6 +259,16 @@ XPCThrower::BuildAndThrowException(JSContext* cx, nsresult rv, const char* sz)
|
|||
JS_ReportOutOfMemory(cx);
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
GetGlobalObject(JSContext* cx, JSObject* start)
|
||||
{
|
||||
JSObject* parent;
|
||||
|
||||
while((parent = JS_GetParent(cx, start)) != nsnull)
|
||||
start = parent;
|
||||
return start;
|
||||
}
|
||||
|
||||
// static
|
||||
JSBool
|
||||
XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
||||
|
@ -269,8 +279,10 @@ XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
|||
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
||||
if(xpc)
|
||||
{
|
||||
// XXX funky JS_GetGlobalObject alert!
|
||||
JSObject* glob = JS_GetGlobalObject(cx);
|
||||
JSObject* glob = JS_GetScopeChain(cx);
|
||||
if(!glob)
|
||||
return JS_FALSE;
|
||||
glob = GetGlobalObject(cx, glob);
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
nsresult rv = xpc->WrapNative(cx, glob, e,
|
||||
|
|
Загрузка…
Ссылка в новой задаче