0

I have developed a xpcom component using c++. I have GetHWND() method in my component. I have also developed another xpcom component using javascript. I want to make use of GetHWND function in javascript xpcom component. I am using following code to do so.

netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");

netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

var myComponent = Components.classes['@dougt/WebLock'].createInstance(Components.interfaces.IWebLock);

myComponent = myComponent.QueryInterface(Components.interfaces.IWebLock);

var res = myComponent.GetHWND(mainWindow.content.document);

But it is giving error as "ReferenceError: netscape is not defined". I did google search but did not find the solution to it.

I am using Mozilla Firefox and I want it to get worked for the same.

Please help me to come out of this problem. Thanks in advance.

1
  • I would add c++ and javascripts tags to the question to try to get more people to look for solutions. Commented Feb 5, 2010 at 10:31

2 Answers 2

1

You don't need these:

netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Sign up to request clarification or add additional context in comments.

Comments

0

I agree with Nickolay, when your extension code is executed it has chrome privileges, which allow you to access XPCOM layer and components.

What I would like to see is if it will work with the lines Nikolay mentioned out. And second item >> how your interface of C++ component is defined. XPIDL doesn't aware of HWND type, so you have to provide some different type, or you can use native type but it's not supported by [scriptable] interfaces

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.