const nsGlobalNameStruct *name_struct = NS_OK;
const nsGlobalNameStruct *name_struct = nsnull;
StubConstructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,                jsval *rval){  JSFunction *fun = ::JS_ValueToFunction(cx, argv[-2]);  if (!fun)    return JS_FALSE;  extern nsScriptNameSpaceManager *gNameSpaceManager;  NS_ENSURE_TRUE(gNameSpaceManager, NS_ERROR_NOT_INITIALIZED);  const char *name = ::JS_GetFunctionName(fun);  nsAutoString nameStr;  nameStr.AssignWithConversion(name);  const nsGlobalNameStruct *name_struct = NS_OK;  nsresult rv = gNameSpaceManager->LookupName(nameStr, &name_struct);  if (NS_FAILED(rv) || !name_struct ||      name_struct->mType != nsGlobalNameStruct::eTypeExternalConstructor) {    return JS_FALSE;  }  nsCOMPtr<nsISupports> native(do_CreateInstance(name_struct->mCID, &rv));  NS_ENSURE_SUCCESS(rv, JS_FALSE);  nsCOMPtr<nsIJSNativeInitializer> initializer(do_QueryInterface(native));  if (initializer) {    rv = initializer->Initialize(cx, obj, argc, argv);    if (NS_FAILED(rv)) {      return JS_FALSE;    }  }  nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(native));  if (owner) {    nsCOMPtr<nsIScriptContext> context;    nsJSUtils::GetStaticScriptContext(cx, obj, getter_AddRefs(context));    NS_ENSURE_TRUE(context, NS_ERROR_UNEXPECTED);    JSObject* new_obj;    rv = owner->GetScriptObject(context, (void**)&new_obj);    if (NS_SUCCEEDED(rv)) {      *rval = OBJECT_TO_JSVAL(new_obj);    }    return rv;  }  rv = nsDOMGenericSH::WrapNative(cx, ::JS_GetGlobalObject(cx), native,                                  NS_GET_IID(nsISupports), rval);  return NS_SUCCEEDED(rv) ? JS_TRUE : JS_FALSE;}