Bug 97488 -- sample code to reflect new approach to scripting, not part of the build, patch by jband and av, r=av

git-svn-id: svn://10.0.0.236/trunk@102122 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
av%netscape.com
2001-08-31 23:00:11 +00:00
parent f8474b312c
commit a84571a019
9 changed files with 114 additions and 162 deletions

View File

@@ -44,7 +44,8 @@ nsScriptablePeer::~nsScriptablePeer()
{
}
NS_IMPL_ISUPPORTS2(nsScriptablePeer, nsI4xScrPlugin, nsISecurityCheckedComponent)
// Notice that we expose our claim to implement nsIClassInfo.
NS_IMPL_ISUPPORTS2(nsScriptablePeer, nsI4xScriptablePlugin, nsIClassInfo)
//
// the following two methods will be callable from JavaScript
@@ -64,65 +65,3 @@ NS_IMETHODIMP nsScriptablePeer::Clear()
return NS_OK;
}
//
// the purpose of the rest of the code is to get succesfully
// through the Mozilla Security Manager
//
static const char gAllAccess[] = "AllAccess";
NS_IMETHODIMP nsScriptablePeer::CanCreateWrapper(const nsIID * iid, char **_retval)
{
if (!_retval)
return NS_ERROR_NULL_POINTER;
*_retval = (char*)NPN_MemAlloc(sizeof(gAllAccess)+1);
if (!*_retval)
return NS_ERROR_OUT_OF_MEMORY;
strcpy(*_retval, gAllAccess);
return NS_OK;
}
NS_IMETHODIMP nsScriptablePeer::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
{
if (!_retval)
return NS_ERROR_NULL_POINTER;
*_retval = (char*)NPN_MemAlloc(sizeof(gAllAccess)+1);
if (!*_retval)
return NS_ERROR_OUT_OF_MEMORY;
strcpy(*_retval, gAllAccess);
return NS_OK;
}
NS_IMETHODIMP nsScriptablePeer::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
{
if (!_retval)
return NS_ERROR_NULL_POINTER;
*_retval = (char*)NPN_MemAlloc(sizeof(gAllAccess)+1);
if (!*_retval)
return NS_ERROR_OUT_OF_MEMORY;
strcpy(*_retval, gAllAccess);
return NS_OK;
}
NS_IMETHODIMP nsScriptablePeer::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
{
if (!_retval)
return NS_ERROR_NULL_POINTER;
*_retval = (char*)NPN_MemAlloc(sizeof(gAllAccess)+1);
if (!*_retval)
return NS_ERROR_OUT_OF_MEMORY;
strcpy(*_retval, gAllAccess);
return NS_OK;
}