Closed Bug 537516 Opened 15 years ago Closed 15 years ago

nsIAppStartup Quit fails if called from a modal dialog

Categories

(Toolkit :: Startup and Profile System, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 400479

People

(Reporter: protz, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2b5) Gecko/20091204 Firefox/3.6b5
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0

In one of my Thunderbird extensions, I need to restart the application. This is done in the event handler of a XUL <window> that is opened by a JS call to window.open from the main window. The call to open has the "modal, dialog, chrome" flags.

I simply wrote Application.restart() in the handler (this actually calls nsIAppStartup::quit with the right flags, see steelApplication.js in the components/ directory). My application's dialog closes, the JS console (in dev cycles) closes too, but the main window does not close. If I re-open the JS console I get :

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIAppStartup.quit]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///home/jonathan/Applications/thunderbird/components/steelApplication.js :: app__quitWithFlags :: line 796"  data: no]

This should at least be caught by STEEL and return a failure code.

Then, if I close the main window, the application, instead of simply quitting, is restarted.

The symptoms disappear if I remove the "modal" flag.

Reproducible: Always




I don't think this is related to bug 298292 but I'm no expert here :).

A workaround :

  let app = window.opener.Application;
  window.opener.setTimeout(function () { app.restart (); }, 2000);
  window.close();

The closure on window.opener.Application is needed since by the time the timeout is run, neither Application nor window.opener exist anymore.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.