Bug 785124 - Pt 6 - Fix JS code that was failing xpcshell tests. r=marshall_law

This commit is contained in:
Dave Hylands 2013-01-10 14:46:39 +01:00
parent 4eafc2a88b
commit 9139c75270
2 changed files with 17 additions and 6 deletions

View File

@ -18,6 +18,10 @@ XPCOMUtils.defineLazyServiceGetter(Services, "env",
"@mozilla.org/process/environment;1",
"nsIEnvironment");
XPCOMUtils.defineLazyServiceGetter(Services, "um",
"@mozilla.org/updates/update-manager;1",
"nsIUpdateManager");
XPCOMUtils.defineLazyServiceGetter(Services, "volumeService",
"@mozilla.org/telephony/volume-service;1",
"nsIVolumeService");
@ -26,6 +30,9 @@ XPCOMUtils.defineLazyGetter(this, "gExtStorage", function dp_gExtStorage() {
return Services.env.get("EXTERNAL_STORAGE");
});
// This exists to mark the affected code for bug 828858.
const gUseSDCard = true;
const VERBOSE = 1;
let log =
VERBOSE ?
@ -90,13 +97,15 @@ DirectoryProvider.prototype = {
return this.createUpdatesDir(LOCAL_DIR);
}
let activeUpdate = Services.um.activeUpdate;
if (this.volumeHasFreeSpace(gExtStorage, requiredSpace)) {
let extUpdateDir = this.createUpdatesDir(gExtStorage);
if (extUpdateDir !== null) {
return extUpdateDir;
if (gUseSDCard) {
if (this.volumeHasFreeSpace(gExtStorage, requiredSpace)) {
let extUpdateDir = this.createUpdatesDir(gExtStorage);
if (extUpdateDir !== null) {
return extUpdateDir;
}
log("Warning: " + gExtStorage + " has enough free space for update " +
activeUpdate.name + ", but is not writable");
}
log("Warning: " + gExtStorage + " has enough free space for update " +
activeUpdate.name + ", but is not writable");
}
if (this.volumeHasFreeSpace(LOCAL_DIR, requiredSpace)) {

View File

@ -189,6 +189,8 @@ var gVolumeMountLock = null;
XPCOMUtils.defineLazyGetter(this, "gExtStorage", function aus_gExtStorage() {
return Services.env.get("EXTERNAL_STORAGE");
});
var gSDCardMountLock = null;
#endif
XPCOMUtils.defineLazyModuleGetter(this, "UpdateChannel",