This code is hard to follow with generic names like file and origin.
It would be easier to read with file being named `manifestFile` and origin named `propertiesFile` (or something alike).

Also, can't we pass a relative path to getPropertiesFile instead of a nsIFile.
Instead of 
`let propertiesFile = getPropertiesFile(webapp, config.GAIA_DIR, basedir, origin);`
`let propertiesFile = getPropertiesFile(webapp, config.GAIA_DIR, basedir, path);`
It may simplify all callers of getPropertiesFile and also the function implementation itself.