Hi, (reposted with more information)
I have recently made changes to a project I am working on and for some
reason I am now getting a message in the debug window which says:
components.classes.webterm has no properties
In the HTML file I have stated:
var webterm = Components.classes["webterm"].createInstance();
webterm =
webterm.QueryInterface(Components.interfaces.nsIWebtermPluginInstance);
var str = new Object();
function Connect()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
webterm.GetVer(str);
alert(str.value);
}
function SetText()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
document.xpwebtrm.nsIWebtermPluginInstance.text = "Hello Patrick"
}
In the C++code I have a class
class CWebTermCtrl :
public nsIWebtermPluginInstance
{
etc
}
Then I have a method:
NS_IMETHODIMP
CWebTermCtrl::GetVer(char **aValue)
{
const char myResult[] = "CWebTermCtrl::Get Version";
if(!aValue)
return NS_ERROR_NULL_POINTER;
*aValue = (char*) nsMemory::Clone(myResult,sizeof(char)*(strlen(myResult)+1));
return (*aValue) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
CWebTermCtrl::GetText(char * *aText)
{
if(!fText)
{
*aText = NULL;
return NS_OK;
}
char* ptr = *aText = (char*) nsMemory::Clone(fText, strlen(fText)+1);
return ptr ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
In the past both GetVer and SetText have worked fine - but now I don't know why the
routine for accessing the C++ GetVer method has stopped working.
Would be grateful for some advice about what I have missed ?
Also I have been getting this message but this has been appearing since day one - is
this a bug as
have installed mozilla several times and this still appears.
chrome://communicator/content/securityUI.js line 30
components.classes['@mozilla.org/secure_browser_ui;1'] has no properties