diff --git a/js/src/xpconnect/src/xpccomponents.cpp b/js/src/xpconnect/src/xpccomponents.cpp index 5a5a4177083f..8bb1113dd380 100644 --- a/js/src/xpconnect/src/xpccomponents.cpp +++ b/js/src/xpconnect/src/xpccomponents.cpp @@ -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; } diff --git a/js/src/xpconnect/src/xpcjsid.cpp b/js/src/xpconnect/src/xpcjsid.cpp index 676268003b16..893989722872 100644 --- a/js/src/xpconnect/src/xpcjsid.cpp +++ b/js/src/xpconnect/src/xpcjsid.cpp @@ -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) diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index 323ece93fa53..1005c5093683 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -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);