зеркало из https://github.com/mozilla/pjs.git
Create exceptions with the right parent. bug 387390, r=jst sr=brendan
This commit is contained in:
Родитель
e92edcff6f
Коммит
178f02522a
|
@ -259,6 +259,16 @@ XPCThrower::BuildAndThrowException(JSContext* cx, nsresult rv, const char* sz)
|
||||||
JS_ReportOutOfMemory(cx);
|
JS_ReportOutOfMemory(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSObject*
|
||||||
|
GetGlobalObject(JSContext* cx, JSObject* start)
|
||||||
|
{
|
||||||
|
JSObject* parent;
|
||||||
|
|
||||||
|
while((parent = JS_GetParent(cx, start)) != nsnull)
|
||||||
|
start = parent;
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
JSBool
|
JSBool
|
||||||
XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
||||||
|
@ -269,8 +279,10 @@ XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e)
|
||||||
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
||||||
if(xpc)
|
if(xpc)
|
||||||
{
|
{
|
||||||
// XXX funky JS_GetGlobalObject alert!
|
JSObject* glob = JS_GetScopeChain(cx);
|
||||||
JSObject* glob = JS_GetGlobalObject(cx);
|
if(!glob)
|
||||||
|
return JS_FALSE;
|
||||||
|
glob = GetGlobalObject(cx, glob);
|
||||||
|
|
||||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||||
nsresult rv = xpc->WrapNative(cx, glob, e,
|
nsresult rv = xpc->WrapNative(cx, glob, e,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче