зеркало из https://github.com/mozilla/pjs.git
use JS_LookupProperty to find the Components object in the JS scope because the OBJ_GET_PROPERTY call we had been using can fail for security reasons. travis needs this to fix bug 33489. r=brendan@mozilla.org
This commit is contained in:
Родитель
541058b723
Коммит
80550f984e
|
@ -96,7 +96,7 @@ nsXPCWrappedNativeScope::FindInJSObjectScope(XPCContext* xpcc, JSObject* obj)
|
||||||
JSObject* compobj;
|
JSObject* compobj;
|
||||||
JSClass* clazz;
|
JSClass* clazz;
|
||||||
JSContext* cx = xpcc->GetJSContext();
|
JSContext* cx = xpcc->GetJSContext();
|
||||||
jsid id = xpcc->GetRuntime()->GetStringID(XPCJSRuntime::IDX_COMPONENTS);
|
const char* name = xpcc->GetRuntime()->GetStringName(XPCJSRuntime::IDX_COMPONENTS);
|
||||||
nsISupports* supports;
|
nsISupports* supports;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
@ -108,10 +108,13 @@ nsXPCWrappedNativeScope::FindInJSObjectScope(XPCContext* xpcc, JSObject* obj)
|
||||||
while(nsnull != (parent = JS_GetParent(cx, obj)))
|
while(nsnull != (parent = JS_GetParent(cx, obj)))
|
||||||
obj = parent;
|
obj = parent;
|
||||||
|
|
||||||
if(!OBJ_GET_PROPERTY(cx, obj, id, &prop) ||
|
if(!JS_LookupProperty(cx, obj, name, &prop) ||
|
||||||
JSVAL_IS_PRIMITIVE(prop) ||
|
JSVAL_IS_PRIMITIVE(prop) ||
|
||||||
!(compobj = JSVAL_TO_OBJECT(prop)))
|
!(compobj = JSVAL_TO_OBJECT(prop)))
|
||||||
|
{
|
||||||
|
NS_ASSERTION(0,"No 'Components' in scope!");
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef JS_THREADSAFE
|
#ifdef JS_THREADSAFE
|
||||||
clazz = JS_GetClass(cx, compobj);
|
clazz = JS_GetClass(cx, compobj);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче