I'm trying to do batch processing of web pages using Mozilla, and
error dialogs are getting in the way of this.  I would like to
override the prompt service with one that answers questions
automatically.  I noticed a thread a little while back with the
subject "How do I override nsNSSDialogs with my own class?" in which
Barry Scott posted some code for overriding the prompt service.
Based on that, I've written the following:

class null_prompt_service : public nsIPromptService
{
public:
    static void install();

    NS_DECL_ISUPPORTS
    NS_DECL_NSIPROMPTSERVICE
};

NS_DEFINE_IID(prompt_service_iid, NS_IPROMPTSERVICE_IID);

// nsIPromptService implementation omitted

void null_prompt_service::install()
{
    nsCOMPtr<nsIFactory> prompt_factory(new null_prompt_service_factory);
    check(nsComponentManager::RegisterFactory(
              prompt_service_iid,
              "Prompt Service",
              "@mozilla.org/embedcomp/prompt-service;1",
              prompt_factory,
              PR_TRUE)); // replace existing
}

(The check function used here converts throws an exception if its
argument represents an error.)

However, this doesn't seem to have any effect.  What am I doing wrong
here?  Can I solve this in version 1.7?

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to