bug 83864 "Access to Components.interfaces denied sometimes", patch=jband, r=dbradley+mstoltz, sr=jst, a=blizzard

Allow xpc wrappers to be created by default, relying on security checks to happen at call-time instead.
This commit is contained in:
rginda%netscape.com 2001-06-19 23:39:30 +00:00
Родитель 5cfa2c2066
Коммит 98b375ae0a
3 изменённых файлов: 55 добавлений и 2 удалений

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

@ -1761,8 +1761,8 @@ nsXPCComponents::AttachNewComponentsObject(XPCCallContext& ccx,
NS_IMETHODIMP
nsXPCComponents::CanCreateWrapper(const nsIID * iid, char **_retval)
{
// If you have to ask, then the answer is NO
*_retval = nsnull;
// We let anyone do this...
*_retval = CloneAllAccess();
return NS_OK;
}

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

@ -371,6 +371,9 @@ NS_INTERFACE_MAP_BEGIN(nsJSIID)
NS_INTERFACE_MAP_ENTRY(nsIJSID)
NS_INTERFACE_MAP_ENTRY(nsIJSIID)
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT
NS_INTERFACE_MAP_ENTRY(nsISecurityCheckedComponent)
#endif
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIJSID)
NS_IMPL_QUERY_CLASSINFO(nsJSIID)
NS_INTERFACE_MAP_END_THREADSAFE
@ -600,6 +603,50 @@ nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
return rv;
}
#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT
static char* CloneAllAccess()
{
static const char allAccess[] = "AllAccess";
return (char*)nsMemory::Clone(allAccess, sizeof(allAccess));
}
/* string canCreateWrapper (in nsIIDPtr iid); */
NS_IMETHODIMP
nsJSIID::CanCreateWrapper(const nsIID * iid, char **_retval)
{
// We let anyone do this...
*_retval = CloneAllAccess();
return NS_OK;
}
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
NS_IMETHODIMP
nsJSIID::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
{
// If you have to ask, then the answer is NO
*_retval = nsnull;
return NS_OK;
}
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
NS_IMETHODIMP
nsJSIID::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
{
// If you have to ask, then the answer is NO
*_retval = nsnull;
return NS_OK;
}
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
NS_IMETHODIMP
nsJSIID::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
{
// If you have to ask, then the answer is NO
*_retval = nsnull;
return NS_OK;
}
#endif
/***************************************************************************/
NS_INTERFACE_MAP_BEGIN(nsJSCID)

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

@ -2385,6 +2385,9 @@ protected:
// nsJSIID
class nsJSIID : public nsIJSIID, public nsIXPCScriptable
#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT
, public nsISecurityCheckedComponent
#endif
{
public:
NS_DECL_ISUPPORTS
@ -2395,6 +2398,9 @@ public:
// we implement the rest...
NS_DECL_NSIJSIID
NS_DECL_NSIXPCSCRIPTABLE
#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT
NS_DECL_NSISECURITYCHECKEDCOMPONENT
#endif
static nsJSIID* NewID(const char* str);