зеркало из https://github.com/mozilla/gecko-dev.git
Merge birch to m-c.
This commit is contained in:
Коммит
72d7d56f36
|
@ -33,8 +33,8 @@ function testAudioPlayPause() {
|
|||
var startDate;
|
||||
audio.addEventListener('progress', function() {
|
||||
lockState = false;
|
||||
audio.pause();
|
||||
startDate = new Date();
|
||||
audio.pause();
|
||||
});
|
||||
|
||||
navigator.mozPower.addWakeLockListener(function testAudioPlayListener(topic, state) {
|
||||
|
|
|
@ -393,15 +393,13 @@ this.AlarmService = {
|
|||
return;
|
||||
}
|
||||
|
||||
aNewAlarm['timezoneOffset'] = this._currentTimezoneOffset;
|
||||
let aNewAlarmTime = this._getAlarmTime(aNewAlarm);
|
||||
if (aNewAlarmTime <= Date.now()) {
|
||||
debug("Adding a alarm that has past time.");
|
||||
this._debugCurrentAlarm();
|
||||
aErrorCb("InvalidStateError");
|
||||
if (!aNewAlarm.date) {
|
||||
aErrorCb("alarm.date is null");
|
||||
return;
|
||||
}
|
||||
|
||||
aNewAlarm['timezoneOffset'] = this._currentTimezoneOffset;
|
||||
|
||||
this._db.add(
|
||||
aNewAlarm,
|
||||
function addSuccessCb(aNewId) {
|
||||
|
@ -424,6 +422,7 @@ this.AlarmService = {
|
|||
// If the new alarm is earlier than the current alarm, swap them and
|
||||
// push the previous alarm back to queue.
|
||||
let alarmQueue = this._alarmQueue;
|
||||
let aNewAlarmTime = this._getAlarmTime(aNewAlarm);
|
||||
let currentAlarmTime = this._getAlarmTime(this._currentAlarm);
|
||||
if (aNewAlarmTime < currentAlarmTime) {
|
||||
alarmQueue.unshift(this._currentAlarm);
|
||||
|
|
|
@ -57,11 +57,11 @@
|
|||
domRequest.onsuccess = function(e) {
|
||||
navigator.mozAlarms.remove(e.target.result);
|
||||
|
||||
ok(false, "Should not be able to add alarm for already past date.");
|
||||
ok(true, "Should be able to add alarm for already past date, which should fire immediately.");
|
||||
testNull();
|
||||
};
|
||||
domRequest.onerror = function(e) {
|
||||
ok(true, "Can't use past date when adding new alarm.");
|
||||
ok(false, "Unable to add alarm for yesterday.");
|
||||
|
||||
// Errors as it should, on to the next test
|
||||
testNull();
|
||||
|
@ -81,7 +81,7 @@
|
|||
}
|
||||
domRequest.onsuccess = function(e) {
|
||||
// Null should not be valid
|
||||
ok(false, "Null should not be accepted as input for `respectTimezone` param.");
|
||||
ok(false, "Null should not be accepted as input for `date` param.");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
domRequest.onerror = function(e) {
|
||||
|
|
|
@ -111,47 +111,32 @@ DeviceStorageUsedSpaceCache::GetCacheEntry(const nsAString& aStorageName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static int64_t
|
||||
GetFreeBytes(const nsAString& aStorageName)
|
||||
{
|
||||
// This function makes the assumption that the various types
|
||||
// are all stored on the same filesystem. So we use pictures.
|
||||
|
||||
DeviceStorageFile dsf(NS_LITERAL_STRING(DEVICESTORAGE_PICTURES), aStorageName);
|
||||
int64_t freeBytes = 0;
|
||||
dsf.GetDiskFreeSpace(&freeBytes);
|
||||
return freeBytes;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DeviceStorageUsedSpaceCache::GetUsedSizeForType(const nsAString& aStorageType,
|
||||
const nsAString& aStorageName,
|
||||
uint64_t* usedSize)
|
||||
DeviceStorageUsedSpaceCache::AccumUsedSizes(const nsAString& aStorageName,
|
||||
uint64_t* aPicturesSoFar,
|
||||
uint64_t* aVideosSoFar,
|
||||
uint64_t* aMusicSoFar,
|
||||
uint64_t* aTotalSoFar)
|
||||
{
|
||||
RefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
|
||||
if (!cacheEntry || cacheEntry->mDirty) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (aStorageType.EqualsLiteral(DEVICESTORAGE_PICTURES)) {
|
||||
*usedSize = cacheEntry->mPicturesUsedSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aStorageType.EqualsLiteral(DEVICESTORAGE_VIDEOS)) {
|
||||
*usedSize = cacheEntry->mVideosUsedSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aStorageType.EqualsLiteral(DEVICESTORAGE_MUSIC)) {
|
||||
*usedSize = cacheEntry->mMusicUsedSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aStorageType.EqualsLiteral(DEVICESTORAGE_SDCARD)) {
|
||||
*usedSize = cacheEntry->mTotalUsedSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult DeviceStorageUsedSpaceCache::AccumUsedSizes(const nsAString& aStorageName,
|
||||
uint64_t* aPicturesSoFar,
|
||||
uint64_t* aVideosSoFar,
|
||||
uint64_t* aMusicSoFar,
|
||||
uint64_t* aTotalSoFar)
|
||||
{
|
||||
RefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
|
||||
if (!cacheEntry || cacheEntry->mDirty) {
|
||||
int64_t freeBytes = GetFreeBytes(cacheEntry->mStorageName);
|
||||
if (freeBytes != cacheEntry->mFreeBytes) {
|
||||
// Free space changed, so our cached results are no longer valid.
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
@ -176,6 +161,7 @@ DeviceStorageUsedSpaceCache::SetUsedSizes(const nsAString& aStorageName,
|
|||
cacheEntry->mStorageName = aStorageName;
|
||||
mCacheEntries.AppendElement(cacheEntry);
|
||||
}
|
||||
cacheEntry->mFreeBytes = GetFreeBytes(cacheEntry->mStorageName);
|
||||
|
||||
cacheEntry->mPicturesUsedSize = aPictureSize;
|
||||
cacheEntry->mVideosUsedSize = aVideosSize;
|
||||
|
|
|
@ -103,9 +103,6 @@ public:
|
|||
mIOThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
nsresult GetUsedSizeForType(const nsAString& aStorageType,
|
||||
const nsAString& aStorageName,
|
||||
uint64_t* usedSize);
|
||||
nsresult AccumUsedSizes(const nsAString& aStorageName,
|
||||
uint64_t* aPictureSize, uint64_t* aVideosSize,
|
||||
uint64_t* aMusicSize, uint64_t* aTotalSize);
|
||||
|
@ -122,6 +119,7 @@ private:
|
|||
public:
|
||||
bool mDirty;
|
||||
nsString mStorageName;
|
||||
int64_t mFreeBytes;
|
||||
uint64_t mPicturesUsedSize;
|
||||
uint64_t mVideosUsedSize;
|
||||
uint64_t mMusicUsedSize;
|
||||
|
|
Загрузка…
Ссылка в новой задаче