mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
fix for bug #40248. I was using the category manager incorrectly.
thanks to bruce@cubik.org for pointing it out.
This commit is contained in:
parent
221780c317
commit
f46ad05a0b
@ -65,7 +65,7 @@ NS_METHOD nsCookieHTTPNotify::RegisterProc(nsIComponentManager *aCompMgr,
|
||||
nsCID cid = NS_COOKIEHTTPNOTIFY_CID;
|
||||
char *cidString = cid.ToString();
|
||||
nsXPIDLCString prevEntry;
|
||||
rv = catman->AddCategoryEntry(NS_HTTP_STARTUP_CATEGORY, cidString, "Http Cookie Notify",
|
||||
rv = catman->AddCategoryEntry(NS_HTTP_STARTUP_CATEGORY, "Http Cookie Notify", cidString,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(prevEntry));
|
||||
nsAllocator::Free(cidString);
|
||||
|
||||
|
@ -52,7 +52,7 @@ function (compMgr, fileSpec, location, type)
|
||||
true, true, type);
|
||||
|
||||
catman = Components.classes["mozilla.categorymanager.1"].getService(nsICategoryManager);
|
||||
catman.addCategoryEntry("command-line-argument-handlers",CHATZILLASERVICE_PROGID, "chatzilla command line handler", true, true);
|
||||
catman.addCategoryEntry("command-line-argument-handlers","chatzilla command line handler",CHATZILLASERVICE_PROGID, true, true);
|
||||
}
|
||||
|
||||
chatzillaModule.unregisterSelf =
|
||||
|
@ -48,6 +48,10 @@
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
||||
#if defined(DEBUG_dp) || defined(DEBUG_sspitzer) || defined(DEBUG_seth)
|
||||
#define DEBUG_HTTP_STARTUP_CATEGORY 1
|
||||
#endif
|
||||
|
||||
#include "nsHTTPRequest.h"
|
||||
#ifdef DEBUG_gagan
|
||||
#include "nsIWebFilters.h"
|
||||
@ -139,31 +143,39 @@ CategoryCreateService( const char *category )
|
||||
nFailed++;
|
||||
continue;
|
||||
}
|
||||
nsXPIDLCString cidString;
|
||||
rv = catEntry->GetData(getter_Copies(cidString));
|
||||
nsXPIDLCString entryString;
|
||||
rv = catEntry->GetData(getter_Copies(entryString));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
nFailed++;
|
||||
continue;
|
||||
}
|
||||
nsXPIDLCString cidString;
|
||||
rv = categoryManager->GetCategoryEntry(category,(const char *)entryString, getter_Copies(cidString));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
nFailed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCID cid;
|
||||
rv = cid.Parse(cidString);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
#ifdef DEBUG_dp
|
||||
#ifdef DEBUG_HTTP_STARTUP_CATEGORY
|
||||
printf("CategoryCreateInstance: Instantiating cid: %s \
|
||||
in category %s.\n",
|
||||
(const char *)cidString, category);
|
||||
#endif /* DEBUG_dp */
|
||||
#endif /* DEBUG_HTTP_STARTUP_CATEGORY */
|
||||
// Create a service from the cid
|
||||
nsCOMPtr<nsISupports> instance = do_GetService(cid, &rv);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_dp
|
||||
#ifdef DEBUG_HTTP_STARTUP_CATEGORY
|
||||
printf("HTTP Handler: Instantiating progid %s \
|
||||
in http startup category.\n", (const char *)cidString);
|
||||
#endif /* DEBUG_dp */
|
||||
#endif /* DEBUG_HTTP_STARTUP_CATEGORY */
|
||||
// This might be a progid. Try that too.
|
||||
nsCOMPtr<nsISupports> instance = do_GetService(cidString, &rv);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ NS_METHOD macro_class::RegisterProc(nsIComponentManager *aCompMgr, nsIFile *aPat
|
||||
nsCOMPtr<nsICategoryManager> catman = do_GetService("mozilla.categorymanager.1", &rv); \
|
||||
if (NS_FAILED(rv)) return rv; \
|
||||
nsXPIDLCString prevEntry; \
|
||||
rv = catman->AddCategoryEntry(COMMAND_LINE_ARGUMENT_HANDLERS, macro_progid, macro_pretty_name, PR_TRUE, PR_TRUE, getter_Copies(prevEntry)); \
|
||||
rv = catman->AddCategoryEntry(COMMAND_LINE_ARGUMENT_HANDLERS, macro_pretty_name, macro_progid, PR_TRUE, PR_TRUE, getter_Copies(prevEntry)); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_METHOD macro_class::UnregisterProc(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation) \
|
||||
|
@ -289,12 +289,17 @@ static void DumpArbitraryHelp()
|
||||
rv = catman->EnumerateCategory(COMMAND_LINE_ARGUMENT_HANDLERS, getter_AddRefs(e));
|
||||
if(NS_SUCCEEDED(rv) && e) {
|
||||
while (PR_TRUE) {
|
||||
nsCOMPtr<nsISupportsString> progid;
|
||||
rv = e->GetNext(getter_AddRefs(progid));
|
||||
if (NS_FAILED(rv) || !progid) break;
|
||||
nsCOMPtr<nsISupportsString> catEntry;
|
||||
rv = e->GetNext(getter_AddRefs(catEntry));
|
||||
if (NS_FAILED(rv) || !catEntry) break;
|
||||
|
||||
nsXPIDLCString progidString;
|
||||
progid->ToString (getter_Copies(progidString));
|
||||
nsXPIDLCString entryString;
|
||||
rv = catEntry->GetData(getter_Copies(entryString));
|
||||
if (NS_FAILED(rv) || !((const char *)entryString)) break;
|
||||
|
||||
nsXPIDLCString progidString;
|
||||
rv = catman->GetCategoryEntry(COMMAND_LINE_ARGUMENT_HANDLERS,(const char *)entryString, getter_Copies(progidString));
|
||||
if (NS_FAILED(rv) || !((const char *)progidString)) break;
|
||||
|
||||
#ifdef DEBUG_CMD_LINE
|
||||
printf("cmd line handler progid = %s\n", (const char *)progidString);
|
||||
|
@ -64,8 +64,8 @@ var jsConsoleHandlerModule = {
|
||||
location, true, true, type);
|
||||
var catman = Components.classes["mozilla.categorymanager.1"]
|
||||
.getService(Components.interfaces.nsICategoryManager);
|
||||
catman.addCategoryEntry("command-line-argument-handlers",
|
||||
JSCONSOLEHANDLER_PROGID, "jsconsole command line handler",
|
||||
catman.addCategoryEntry("command-line-argument-handlers", "jsconsole command line handler",
|
||||
JSCONSOLEHANDLER_PROGID,
|
||||
true, true);
|
||||
},
|
||||
|
||||
|
@ -93,7 +93,7 @@ NS_METHOD macro_class::RegisterProc(nsIComponentManager *aCompMgr, nsIFile *aPat
|
||||
nsCOMPtr<nsICategoryManager> catman = do_GetService("mozilla.categorymanager.1", &rv); \
|
||||
if (NS_FAILED(rv)) return rv; \
|
||||
nsXPIDLCString prevEntry; \
|
||||
rv = catman->AddCategoryEntry(COMMAND_LINE_ARGUMENT_HANDLERS, macro_progid, macro_pretty_name, PR_TRUE, PR_TRUE, getter_Copies(prevEntry)); \
|
||||
rv = catman->AddCategoryEntry(COMMAND_LINE_ARGUMENT_HANDLERS, macro_pretty_name, macro_progid, PR_TRUE, PR_TRUE, getter_Copies(prevEntry)); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_METHOD macro_class::UnregisterProc(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation) \
|
||||
|
Loading…
Reference in New Issue
Block a user