Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XPCOM component not getting registered in Firefox 1.5

2 views
Skip to first unread message

Gautam Bhagra

unread,
Nov 4, 2005, 5:52:07 AM11/4/05
to
Hi all,
 
I am unable to get my XPCOM component registered in Firefox 1.5 RC1
I get the "Components.classes[classid] has no properties" error in Firefox browser, whenever i try to access my component.
I have compiled my XPCOM code using gecko sdk 1.7
Also, since CView does not work with Firefox 1.5, i am unable to see the components that are registered with Firefox 1.5
 
Is there some other sdk that i am supposed to use to compile my components in order to use with Firefox 1.5?
 
Also, is there some other extension that i can use with Firefox 1.5 in order to see the components registered there?
 
Thanks in advance
Gautam


Yahoo! FareChase - Search multiple travel sites in one click.

Philippe C. Martin

unread,
Nov 4, 2005, 12:39:15 PM11/4/05
to
Gautam,

I face the same problem.

Please post the solution when you get it as I will.

Regards,

Philippe

On Friday 04 November 2005 10:52 am, Gautam Bhagra wrote:
> Hi all,
>
> I am unable to get my XPCOM component registered in Firefox 1.5 RC1
> I get the "Components.classes[classid] has no properties" error in Firefox
> browser, whenever i try to access my component. I have compiled my XPCOM
> code using gecko sdk 1.7
> Also, since CView does not work with Firefox 1.5, i am unable to see the
> components that are registered with Firefox 1.5
>
> Is there some other sdk that i am supposed to use to compile my components
> in order to use with Firefox 1.5?
>
> Also, is there some other extension that i can use with Firefox 1.5 in
> order to see the components registered there?
>
> Thanks in advance
> Gautam
>
>

> ---------------------------------


> Yahoo! FareChase - Search multiple travel sites in one click.

--
*************************************
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
*************************************

Mook

unread,
Nov 6, 2005, 7:39:10 AM11/6/05
to
Gautam Bhagra wrote:
> Hi all,
>
> I am unable to get my XPCOM component registered in Firefox 1.5 RC1
> I get the "Components.classes[classid] has no properties" error in
> Firefox browser, whenever i try to access my component.
> I have compiled my XPCOM code using gecko sdk 1.7
> Also, since CView does not work with Firefox 1.5, i am unable to see the
> components that are registered with Firefox 1.5
>
> Is there some other sdk that i am supposed to use to compile my
> components in order to use with Firefox 1.5?
>
> Also, is there some other extension that i can use with Firefox 1.5 in
> order to see the components registered there?
>
> Thanks in advance
> Gautam
>

Firefox 1.5RC1 uses the 1.8 SDK, not the 1.7 one. I believe there's a
copy in
http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.8b1/

There does seem to be a working cview in the source tree, but I do not
know if anyone has a copy anywhere. (I'm building Firefox myself, which
lets me use it.) As a workaround, reading the generated compreg.dat in
your Firefox profile folder will also tell you what components are
registered (but not what interfaces each implements).

Hope this helps,
Mook (random bystander)

Christian Biesinger

unread,
Nov 6, 2005, 7:55:38 AM11/6/05
to
Mook wrote:
> Firefox 1.5RC1 uses the 1.8 SDK, not the 1.7 one. I believe there's a
> copy in
> http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.8b1/

But components compiled with the 1.7 SDK are supposed to be compatible
with Firefox 1.5 too.

Gautam Bhagra

unread,
Nov 8, 2005, 12:57:07 AM11/8/05
to
I am still unable to get the component to work.
 
I am unable to compile my component code in the 1.8 SDK .
I get the following link error
 
"error LNK2019: unresolved external symbol "__declspec(dllimport) unsigned int __cdecl NS_NewGenericModule2(struct nsModuleInfo *,class nsIModule * *)" (__imp_?NS_NewGenericModule2@@YAIPAUnsModuleInfo@@PAPAVnsIModule@@@Z) referenced in function _NSGetModule"
 
On comparing this with the 1.7 SDK, i find that the size of the xpcom.lib is just 10KB in SDK1.8 but it is 491KB in 1.7
 
So, if i were to replace the xpcom.lib file of 1.8 with the one in 1.7, it compiles fine. However, it still fails to register my component.
 
also, the link error happens in 1.8 SDK only because of the follwing MACRO that i use in the ComponentModule

 

NS_IMPL_NSGETMODULE("MyModule", components)


If i comment it out, it works fine.
 
Has anyone else faced the same problem or know of any way i can get around this so as to make my component work on 1.5?
 
Thanks,
Gautam
 
Mook <mook_dot_m...@no.spam.please> wrote:
_______________________________________________
Mozilla-xpcom mailing list
Mozill...@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-xpcom


Christian Biesinger

unread,
Nov 8, 2005, 4:29:41 PM11/8/05
to
Gautam Bhagra wrote:
> "error LNK2019: unresolved external symbol "__declspec(dllimport) unsigned int __cdecl NS_NewGenericModule2(struct nsModuleInfo *,class nsIModule * *)" (__imp_?NS_NewGenericModule2@@YAIPAUnsModuleInfo@@PAPAVnsIModule@@@Z) referenced in function _NSGetModule"

What libraries are you linking to?

Gautam Bhagra

unread,
Nov 9, 2005, 12:51:52 AM11/9/05
to
Hi Christian,
 
I am linking to xpcom.lib
 
 
Thanks,
Gautam

Christian Biesinger <cbies...@web.de> wrote:
_______________________________________________
Mozilla-xpcom mailing list
Mozill...@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-xpcom

Christian Biesinger

unread,
Nov 9, 2005, 2:05:57 PM11/9/05
to
Gautam Bhagra wrote:
> Hi Christian,
>
> I am linking to xpcom.lib

You also need to link to one of the glue variants, see
http://developer.mozilla.org/en/docs/XPCOM_Glue

Thomas Lee

unread,
Nov 9, 2005, 6:46:17 PM11/9/05
to
Hi Everybody,
 
I went through all of the same issues that most everybody here has talked about with FF .5 registration. My scenario was that I developed a toolbar for FF 1.0.X and it has come time to upgrade this to work with FF 1.5. It was my understanding that the Gecko 1.7 SDK would be sufficient to use with FF 1.5. Not the case however. When I tried to instantiated my C++ component I received a NS_ERROR_XPC_CI_RETURNED_FAILURE error. I even went so far as to create an empty shell of a component and still received the error. So after mucking around for a day or so I decided to solicit the news group where I learned that in fact we had to use the 1.8 Gecko SDK for FF 1.5. No problem I thought - however I ran into several issues. One issue was that  I no longer could use nsEmbedString class as it would no longer compile. After research I discovered that I should use nsString - however to use this class I had to define MOZILLA_STRICT_API. So I said what the heck - so I defined out of spite. So now everything compiles except for one tiny problem - I can no longer use NS_GetServiceManager because it is not included when I define MOZILLA_STRICT_API. My question is how can I get the global instance of the Service Manager now? Is there another method to do this? Or should I be using a different string solution instead of defining MOZILLA_STRICT_API?
 
Thanks for looking at this issue!
 
Tom -
 
"Gautam Bhagra" <gautam...@yahoo.com> wrote in message news:mailman.1131101526...@mozilla.org...

Thomas Lee

unread,
Nov 10, 2005, 10:08:31 AM11/10/05
to
Comments below.


"Christian Biesinger" <cbies...@web.de> wrote in message
news:mailman.1131626257....@mozilla.org...


> Thomas Lee wrote:
>> I went through all of the same issues that most everybody here has
>> talked about with FF .5 registration. My scenario was that I
>> developed a toolbar for FF 1.0.X and it has come time to upgrade this
>> to work with FF 1.5. It was my understanding that the Gecko 1.7 SDK
>> would be sufficient to use with FF 1.5.
>

> That is indeed the theory, as long as you are using only frozen functions.


>
>> Not the case however. When I
>> tried to instantiated my C++ component I received a
>> NS_ERROR_XPC_CI_RETURNED_FAILURE error.
>

> Well, there are two possibilities that I can currently think of for
> this...
> o) You have an Init() method + NS_GENERIC_FACTORY_CONSTRUCTOR_INIT, and
> that Init method returns a failure code
> o) The IID of the interface that JS is asking for has changed
> o) (maybe) compreg.dat is out of date
>
> It might be the case that you are linking to unfrozen symbols in xpcom
> that changed, although I'd think that that would give a different error.
>

Well that is what I thought originally with the 1.7 SDK. That is why I
created an empty interface. In other words I deleted all my code and just
had the empty methods returning NS_OK - just to see if I could instantiate
my interface.

The result is that it failed with

Error: [Exception... "Component returned failure code: 0x80570015
(NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]" nsresult:
"0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE)" location: "JS frame ::
chrome://mycomponent/content/mycomponent.js :: onInit :: line 67" data: no]
Source File: chrome://mycomponent/content/mycomponent.js
Line: 67

BTW - this fails if I use getService() or createInstance() from my script.

If I create a debug version and set break points in my code the last item
that is called from FF 1.5 is NS_IMPL_NSGETMODULE. I never actually hit the
constructor of my interface. So the failure is definitely something to do
with NS_IMPL_NSGETMODULE I believe.

>> I even went so far as to
>> create an empty shell of a component and still received the error. So
>> after mucking around for a day or so I decided to solicit the news
>> group where I learned that in fact we had to use the 1.8 Gecko SDK
>> for FF 1.5.
>

> You should compile with the SDK of the oldest version that you want to run
> with. I do believe that people succeeded in doing this :)
>

Compiling is not really the issue with 1.7. The issue is purely runtime with
FF 1.5. I went back this morning and revisited the 1.7 SDK with
MOZILLA_STRICT_API defined and I do still get the same error
(NS_ERROR_XPC_CI_RETURNED_FAILURE) when FF 1.5 tries to load my XPCOM
component. I also verified that the last ietsm that is called within my DLL
is NS_IMPL_NSGETMODULE.

>> No problem I thought - however I ran into several issues.
>> One issue was that I no longer could use nsEmbedString class as it
>> would no longer compile. After research I discovered that I should
>> use nsString - however to use this class I had to define
>> MOZILLA_STRICT_API.
>

> Yeah, if you want cross-version compatibility you should define
> MOZILLA_STRICT_API. (Not needed for a Gecko 1.8 SDK, though)
>
> Odd that nsEmbedString doesn't work for you... it certainly should (it's a
> typedef for nsString, see nsStringAPI.h / nsEmbedString.h)
>

These are the errors I get when I include nsEmbedString.h with 1.8. Same
code compiles with 1.7.

c:\gecko-sdk\include\nsembedstring.h(48) : error C2146: syntax error :
missing ';' before identifier 'nsEmbedString'
c:\gecko-sdk\include\nsembedstring.h(48) : fatal error C1004: unexpected end
of file found

>> So I said what the heck - so I defined out of
>> spite. So now everything compiles except for one tiny problem - I can
>> no longer use NS_GetServiceManager because it is not included when I
>> define MOZILLA_STRICT_API.
>

> Did you try #include "nsXPCOM.h"?
>
I included this and it did compile which brought me to the next issue which
is a runtime issue. I no longer can complete the following without a
NS_NOINTERFACE error.

rv = spServiceManager->GetServiceByContractID(
"@mozilla.org/appshell/appShellService;1",
NS_GET_IID(nsIAppShellService),
getter_AddRefs(spAppShell));

do_GetService() does not work either with 1.8.


> You might also want to look at
> http://developer.mozilla.org/en/docs/XPCOM_Glue#Compiling_or_linking_against_XPCOM_headers
> if you haven't already.
>

I think this is my home page for my browser in the last couple days. :-)

> -biesi
>


Martin Kremer

unread,
Dec 6, 2005, 8:53:18 PM12/6/05
to
Any news on this issue ?
I can get the componenent registered in 1.5 by using the latest gecko-sdk,
but now calls to do_createinstance that worked in earlier versions fail,
and the nsIDOMXULCommandDispatcher-trick for getting access to the DOM of a
html-page does not work anymore.

Martin

Christian Biesinger

unread,
Jan 5, 2006, 4:10:26 PM1/5/06
to
Martin Kremer wrote:
> Any news on this issue ?
> I can get the componenent registered in 1.5 by using the latest gecko-sdk,
> but now calls to do_createinstance that worked in earlier versions fail,
> and the nsIDOMXULCommandDispatcher-trick for getting access to the DOM
> of a html-page does not work anymore.

That probably means that the interface changed between the header file
you used and the firefox version you are running. That means that the
IID of the interface changed, so do_CreateInstance fails too.

You could compile against new headers, or get both versions (rename the
interface in one of them), and QI to both versions.

0 new messages