зеркало из https://github.com/mozilla/gecko-dev.git
Bug 858034 - Make navigator.getDeviceStorage('') not crash when device storage is disabled. r=bent
This commit is contained in:
Родитель
5d06e0201d
Коммит
a38c634484
|
@ -992,6 +992,13 @@ Navigator::MozIsLocallyAvailable(const nsAString &aURI,
|
|||
|
||||
NS_IMETHODIMP Navigator::GetDeviceStorage(const nsAString &aType, nsIDOMDeviceStorage** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = nullptr;
|
||||
|
||||
if (!Preferences::GetBool("device.storage.enabled", false)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We're going to obsolete getDeviceStorage, but want to leave it in for
|
||||
// compatability right now. So we do essentially the same thing as GetDeviceStorages
|
||||
// but only take the first element of the array.
|
||||
|
@ -1009,7 +1016,6 @@ NS_IMETHODIMP Navigator::GetDeviceStorage(const nsAString &aType, nsIDOMDeviceSt
|
|||
if (dataType != nsIDataType::VTYPE_ARRAY) {
|
||||
NS_ASSERTION(dataType == nsIDataType::VTYPE_EMPTY_ARRAY,
|
||||
"Expecting an empty array");
|
||||
*_retval = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1030,6 +1036,9 @@ NS_IMETHODIMP Navigator::GetDeviceStorage(const nsAString &aType, nsIDOMDeviceSt
|
|||
|
||||
NS_IMETHODIMP Navigator::GetDeviceStorages(const nsAString &aType, nsIVariant** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = nullptr;
|
||||
|
||||
if (!Preferences::GetBool("device.storage.enabled", false)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче