However, in some situations, I need to be able to perform alert, prompt, ... If I override nsIPrompt.idl for instance, I can decide whether or not I must fake the dialog. In case I should not, is there a way to call the former interface ?

You can't override nsIPrompt, that is just an interface, there's no contract ID/CID associated with it.

Anyway, if you want to forward this to the previously registered component, just get it by CID.

You are right about not overriding nsIPrompt. I don't know how to access the previous component by CID.

Anyway, I have something that almost works. I created a component with nsIPromptService CID and "@mozilla.org/embedcomp/prompt-service;1" ID. Just before registering this component, I get the former prompt service and store it. If I do so after registration, I get into a stack overflow. Beside of that, I create a new nsIPromptEnableService interface and related service, with enable() and disable() methods for the application to allow or disallow prompting, and a isEnabled() function for my new prompt service to decide if the alert-like function should be invoked from the former prompt service.

It is working just fine for alert, confirm, promptUsernameAndPassword functions, but strangely enough, it doesn't work for prompt(). If a javascript code invokes the function prompt("Enter your name"), none of my code is called and nothing happens.

I suspected the JS prompt() function to use nsIPrompt on "@mozilla.org/network/default-prompt;1" instead of nsIPromptService, so I wrote another component to override this, but I still don't get anything.

/mig

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to