Bug 872170 - Fix camera file saving with composite device storage. r=mikeh

This commit is contained in:
Dave Hylands 2013-05-16 11:12:29 -07:00
Родитель 4a56501d24
Коммит 70ed43e46c
3 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -282,7 +282,8 @@ nsDOMCameraControl::StartRecording(const JS::Value& aOptions, nsIDOMDeviceStorag
#endif
nsCOMPtr<nsIFile> folder;
storageArea->GetRootDirectory(getter_AddRefs(folder));
rv = storageArea->GetRootDirectoryForFile(filename, getter_AddRefs(folder));
NS_ENSURE_SUCCESS(rv, rv);
return mCameraControl->StartRecording(&options, folder, filename, onSuccess, onError);
}

Просмотреть файл

@ -2932,12 +2932,20 @@ nsDOMDeviceStorage::Available(nsIDOMDOMRequest** aRetval)
}
NS_IMETHODIMP
nsDOMDeviceStorage::GetRootDirectory(nsIFile** aRootDirectory)
nsDOMDeviceStorage::GetRootDirectoryForFile(const nsAString& aName, nsIFile** aRootDirectory)
{
if (!mRootDirectory) {
nsRefPtr<nsDOMDeviceStorage> ds;
if (IsComposite()) {
nsString storagePath;
ds = GetStorage(aName, storagePath);
} else {
ds = this;
}
if (!ds || !ds->mRootDirectory) {
return NS_ERROR_FAILURE;
}
return mRootDirectory->Clone(aRootDirectory);
return ds->mRootDirectory->Clone(aRootDirectory);
}
NS_IMETHODIMP

Просмотреть файл

@ -16,7 +16,7 @@ dictionary DeviceStorageEnumerationParameters
jsval since;
};
[scriptable, uuid(3d336180-b130-4b54-b205-ce74e36e733f), builtinclass]
[scriptable, uuid(be690a9b-f0b4-4cde-a505-0b442abe2109), builtinclass]
interface nsIDOMDeviceStorage : nsIDOMEventTarget
{
[implicit_jscontext] attribute jsval onchange;
@ -48,5 +48,5 @@ interface nsIDOMDeviceStorage : nsIDOMEventTarget
// include any path information.
readonly attribute DOMString storageName;
[noscript] readonly attribute nsIFile rootDirectory;
[noscript] nsIFile getRootDirectoryForFile(in DOMString aName);
};