Closed Bug 428387 Opened 17 years ago Closed 17 years ago

Custom handling of connection failure

Categories

(Mozilla Labs :: Prism, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jjzhuang, Assigned: matthew.gertner)

Details

Attachments

(2 files)

We have an app with a localhost web service running on port 7633. If the web service is not running, when Prism starts it will popup an alert saying "can't connect to http://localhost:7633, which is not very user friendly. What we want to do is to have a callback to a registered fail-to-connect handler (in javascript). Then the handler can try to start our web service. If it starts successfully, handler code will return positive and Prism should retry connecting; if failed to start the web service, a negative return from handler will shutdown Prism.
Also have a question about this. What's the best way to run an external program from a javascript in prism?
(In reply to comment #1) > Also have a question about this. What's the best way to run an external > program from a javascript in prism? > nsIProcess provides that feature
Thanks Mark!
I discussed this with Mark and we don't feel like this is a generic use case since most Prism apps won't be using a local server. Instead, you should check whether the local server is reachable at startup and take action as appropriate. I've added a real startup() handler in this patch that can be used in webapp.js to do the check before the page loads.
Attachment #315539 - Flags: review?(mark.finkle)
Comment on attachment 315539 [details] [diff] [review] Rename startup handler to load and add a real startup handler to nsCommandLineHandler.js we might need to update some webapp.js scripts, but this is a better scheme.
Attachment #315539 - Flags: review?(mark.finkle) → review+
OK sounds good. Is the startup handler called before or after the window has a chance to load the static splash screen? It's better if user can see the splash screen while the startup handler is working in the background because it can take a while. Thanks!
Good point, JJ. The startup() function is called before the splashscreen is displayed. This patch adds another event that can be used to do processing after the splashscreen comes up.
Attachment #315581 - Flags: review?(mark.finkle)
Attachment #315581 - Flags: review?(mark.finkle) → review+
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: