From 80550f984e77afe0b7926d07e381fa535005b95f Mon Sep 17 00:00:00 2001 From: "jband%netscape.com" Date: Fri, 31 Mar 2000 02:47:46 +0000 Subject: [PATCH] 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 --- js/src/xpconnect/src/xpcwrappednativescope.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/src/xpconnect/src/xpcwrappednativescope.cpp b/js/src/xpconnect/src/xpcwrappednativescope.cpp index 22a324deefd..1f405f64b2f 100644 --- a/js/src/xpconnect/src/xpcwrappednativescope.cpp +++ b/js/src/xpconnect/src/xpcwrappednativescope.cpp @@ -96,7 +96,7 @@ nsXPCWrappedNativeScope::FindInJSObjectScope(XPCContext* xpcc, JSObject* obj) JSObject* compobj; JSClass* clazz; JSContext* cx = xpcc->GetJSContext(); - jsid id = xpcc->GetRuntime()->GetStringID(XPCJSRuntime::IDX_COMPONENTS); + const char* name = xpcc->GetRuntime()->GetStringName(XPCJSRuntime::IDX_COMPONENTS); nsISupports* supports; nsresult rv; @@ -108,10 +108,13 @@ nsXPCWrappedNativeScope::FindInJSObjectScope(XPCContext* xpcc, JSObject* obj) while(nsnull != (parent = JS_GetParent(cx, obj))) obj = parent; - if(!OBJ_GET_PROPERTY(cx, obj, id, &prop) || + if(!JS_LookupProperty(cx, obj, name, &prop) || JSVAL_IS_PRIMITIVE(prop) || !(compobj = JSVAL_TO_OBJECT(prop))) + { + NS_ASSERTION(0,"No 'Components' in scope!"); return nsnull; + } #ifdef JS_THREADSAFE clazz = JS_GetClass(cx, compobj);