Closed Bug 279209 Opened 20 years ago Closed 19 years ago

GetServiceByContractID failed with "@mozilla.org/preferences-service;1"

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED EXPIRED

People

(Reporter: georgez, Assigned: dougt)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624

I added below code to mfcembed.exe for profile management. Which works with
Mozilla 1.4 through 1.8a4 .zip packages, and 1.6 through 1.8a4 .exe package
(mfcembed was copied to the GRE directory). But it failed with 1.4.x .exe
package in below line:
>   return svcMgr->GetServiceByContractID(aContractID, aIID, aResult);
with error code: 80004005. From nsError.h ...
> /* Returned when a function fails */
> 182 #define NS_ERROR_FAILURE                   ((nsresult) 0x80004005L)

nsresult InitializeProfile()
{......
   nsCOMPtr<nsIPrefService> pref;
   rv = GetService("@mozilla.org/preferences-service;1",
                   NS_GET_IID(nsIPrefService),
                   getter_AddRefs(pref));
}
nsresult GetService(const char *aContractID, const nsIID &aIID, void **aResult)
{
   nsCOMPtr<nsIServiceManager> svcMgr;
   nsresult rv = NS_GetServiceManager(getter_AddRefs(svcMgr));
   if (NS_FAILED(rv)) return rv;

// Faiilure in below line with error code: 80004005
   return svcMgr->GetServiceByContractID(aContractID, aIID, aResult);
}

Other calls succeed like:
> rv = GetService("@mozilla.org/network/protocol;1?name=http",
                    NS_GET_IID(nsIHttpProtocolHandler),
                    getter_AddRefs(httpHandler));

Why ONLY below call
> rv = GetService("@mozilla.org/preferences-service;1",
                   NS_GET_IID(nsIPrefService),
                   getter_AddRefs(pref));
failed and only with 1.4 .exe package installation ?  I find this line
"@mozilla.org/preferences-service;1,{1cd91b88-1dd2-11b2-92e1-ed22ed298000}" in
compreg.dat of Mozilla 1.4 .exe GRE directory.

Reproducible: Always
I managed to debug into the Mozilla 1.4 source code, and found that it failed in
below two places:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/xpcom/components/nsComponentManager.cpp&rev=1.234
(for 1.4 release)
// failure in line#2006:
2004 dp         1.153     {
2005 dougt      1.231
2006 timeless   1.213         rv = factory->CreateInstance(aDelegate, aIID,
aResult); //// failed sometimes.
2007 dp         1.153         NS_RELEASE(factory);

// failure in below lines:
2447 timeless   1.213
2448 neeti      1.176     entry->mServiceObject = service;
2449                      *result = service.get();
2450 timeless   1.213     NS_ADDREF(NS_STATIC_CAST(nsISupports*, *result));
2451 dougt      1.158     return rv; //// rv turns to 80004005, even though
line#2006 succeeds sometimes.
2452                  }
After the above pieces of code, it went into a piece of asemble code, so I don't
know the exact error info. I was quite confused. I went through the change log
to this file, but didn't find which fix might fix it, as it doesn't happen with
1.6 .exe package:
http://bonsai.mozilla.org/cvslog.cgi?file=mozilla/xpcom/components/nsComponentManager.cpp&rev=1.234

Comment are very welcome, Thanks !
And I found below two lines in compreg.dat with Mozilla 1.4 .zip package:
{1cd91b88-1dd2-11b2-92e1-ed22ed298000},@mozilla.org/preferences-service;1,,Preferences
Server,gre:xppref32.dll
@mozilla.org/preferences-service;1,{1cd91b88-1dd2-11b2-92e1-ed22ed298000}

and below line in compreg.dat with Mozilla 1.4 .exe package:
@mozilla.org/preferences-service;1,{1cd91b88-1dd2-11b2-92e1-ed22ed298000}
Another self-update. I rechecked that the debug build (mozilla\dist\*) works, my
last post reporting the failure
// failure in line#2006:
......
// failure in below lines:
is misleading. :-(

As it only happens to the installer (.exe) package, I tried to package the debug
binaries into an installer package, but failed for some problems with the
process. On the other hand, I found that copying two directories (res and
defaults) in the user specified installation directory (C:\Program
Files\mozilla.org\Mozilla) to the GRE directory [Program Files\Common
Files\mozilla.org\GRE\1.4f_2003062408] makes it work. So, it seems a bug with
the GRE directory.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.