Closed Bug 826935 Opened 11 years ago Closed 11 years ago

ensure app.installState is defined in DOMApplicationRegistry.loadCurrentRegistry()


(Core Graveyard :: DOM: Apps, defect)

Not set


(blocking-basecamp:+, firefox19 wontfix, firefox20 fixed, b2g18 fixed)

B2G C4 (2jan on)
blocking-basecamp +
Tracking Status
firefox19 --- wontfix
firefox20 --- fixed
b2g18 --- fixed


(Reporter: myk, Assigned: myk)



(Whiteboard: [qa-])


(1 file)

If an app record in webapps.json has no installState property, then DOMApplicationRegistry.loadCurrentRegistry() doesn't define it when reading webapps.json into its DOMApplicationRegistry.webapps object (unlike WebappsApplication.init(), which sets it to "installed").

That causes problems when DOMApplicationRegistry.startDownload() is called to update an installed app with no installState, because the isUpdate local variable will be set to false instead of true, and the installState will eventually wind up being "pending" instead of "updating" when this code is evaluated near the end of the function:

            if (app.installState == "pending") {
              // We restarted a failed download, apply it automatically.

But the download isn't failed; and it shouldn't be applied automatically.

The Gaia build scripts don't set installState, so you'll run into this problem if you start B2G for the first time with a new Gaia profile, check for a packaged app update, and find one; which is exactly what we hope will happen to users who get devices with preloaded packaged app stubs that trigger update checks.

Perhaps the build scripts should set this property. But DOMApplicationRegistry shouldn't depend on it being set, just as WebappsApplication doesn't.  Ideally, we also wouldn't have two different types of app object with completely different initialization routines, but fixing that is risky.  The minimal fix here is for DOMApplicationRegistry to set installState to "installed" if it's undefined.
Comment on attachment 698188 [details] [diff] [review]
patch v1: ensures app.installState is defined

I think Fabrice is out. And backup reviewer #2 ferjm is out too. So backup reviewer #3 is Jonas.
Attachment #698188 - Flags: review?(fabrice) → review?(jonas)
Attachment #698188 - Flags: review?(jonas) → review+
blocking-basecamp: ? → +
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
Comment on attachment 698188 [details] [diff] [review]
patch v1: ensures app.installState is defined
Attachment #698188 - Flags: checkin+
Blocks: app-install
No longer blocks: market-packaged-apps
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.