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:
jband%netscape.com 2000-03-31 02:47:46 +00:00
Родитель 541058b723
Коммит 80550f984e
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -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);