As we all know, nsIPromptService provides an interface for driving raw UI methods like alert and confirm. There is no information baked in re: what the context of the dialog is (other than assumptions made by the method name; for example I could not impl alerts, but only impl confirms if I wanted).

I think we need the ability to provide more context (an nsresult). I'm not sure this should be provided at the same level as nsIPromptService, but, I think we need something.

Imagine that I want to only throw UI for a set of dialogs, and supress another set. Imagine the only dialog I want to throw is a DNS failure dialog. I'd want my code to look something like...

...
if (reason == NS_ERROR_DNS_FAILURE) {
 nsCOMPtr<nsIPromptService> ps = do_GetService(nsIPromptService);
 ps->Alert(...);
}
...


We currently don't have this layer. We *could* bake the nsresult into the param list of the nsIPromptService, and rename it to nsIPromptService2 or something, but, that injects context in what is otherwise a generic UI iface.

You could imagine a set of error categories (or better yet, allow the categories to be defined at runtime) that one could wrap a general nsresult macro around (like NS_FAILED).

Jud

Reply via email to