Closed Bug 967833 Opened 10 years ago Closed 6 years ago

WebApps.jsm should shutdown earlier than xpcom-shutdown

Categories

(Core Graveyard :: DOM: Apps, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mak, Unassigned)

Details

This module seems to rely on profile stored data, thus it should not shutdown at xpcom-shutdown, but earlier, either at profile-before-change or profile-before-change2 if the former is needed to sync up shutdown work.

I actually noticed this cause I have a test that causes a crash in ncContentUtils::IsCallerChrome (see the full stack at https://bugzilla.mozilla.org/show_bug.cgi?id=824433#c34). The crash is due to the fact the test is causing WebApps.jsm to be imported at profile-before-change, when this happens DOMApplicationRegistry.init() is invoked. From that point to xpcom-shutdown there is no event loop spinning, so whatever work starts from this method will be executed after xpcom-shutdown. It ends up in nsContentUtils::IsCallerChrome and at that point sSecurityManager is a null pointer and the crash happens.

Just to add some additional info, the crash start from loadAndUpdateApps and more particularly the calls to this._saveApps and this.registerAppsHandlers(runUpdate)

Note that shutting down earlier (This bug) won't solve the above crash, though a single event loops spinning between DOMApplicationRegistry.init() and xpcom-shutdown is likely enough to solve the crash, so it's unlikely to happen in a real-life case.
Product: Core → Core Graveyard
Core Graveyard / DOM: Apps is inactive. Closing all bugs in this component.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.