Backed out changesets 6d1c36585219 and bd403a727849 (bug 1016560) for mochitest-other failures.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-06-03 13:48:49 -04:00
Родитель 1248a5b0e5
Коммит 24cbfd735d
9 изменённых файлов: 14 добавлений и 22 удалений

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

@ -1497,7 +1497,7 @@ Navigator::GetFeature(const nsAString& aName)
if (XRE_GetProcessType() == GeckoProcessType_Default) {
uint32_t memLevel = mozilla::hal::GetTotalSystemMemoryLevel();
if (memLevel == 0) {
p->MaybeReject(NS_ERROR_NOT_AVAILABLE);
p->MaybeReject(NS_LITERAL_STRING("Abnormal"));
return p.forget();
}
p->MaybeResolve((int)memLevel);

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

@ -150,7 +150,7 @@ RejectPromise(nsPIDOMWindow* aWindow, Promise* aPromise, nsresult aRv)
NS_LITERAL_STRING("An error occurred"));
}
aPromise->MaybeRejectBrokenly(error);
aPromise->MaybeReject(error);
}
void

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

@ -122,7 +122,7 @@ CreateDirectoryTask::HandlerCallback()
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(domError);
mPromise = nullptr;
return;
}

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

@ -287,7 +287,7 @@ CreateFileTask::HandlerCallback()
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(domError);
mPromise = nullptr;
return;
}

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

@ -197,7 +197,7 @@ GetFileOrDirectoryTask::HandlerCallback()
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(domError);
mPromise = nullptr;
return;
}

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

@ -185,7 +185,7 @@ RemoveTask::HandlerCallback()
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(domError);
mPromise = nullptr;
return;
}

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

@ -1465,7 +1465,7 @@ ContentChild::RecvSystemMemoryAvailable(const uint64_t& aGetterId,
nsRefPtr<Promise> p = dont_AddRef(reinterpret_cast<Promise*>(aGetterId));
if (!aMemoryAvailable) {
p->MaybeReject(NS_ERROR_NOT_AVAILABLE);
p->MaybeReject(NS_LITERAL_STRING("Abnormal"));
return true;
}

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

@ -26,7 +26,6 @@ namespace mozilla {
namespace dom {
class AnyCallback;
class DOMError;
class PromiseCallback;
class PromiseInit;
class PromiseNativeHandler;
@ -90,16 +89,9 @@ public:
MaybeSomething(aArg, &Promise::MaybeResolve);
}
inline void MaybeReject(nsresult aArg) {
MOZ_ASSERT(NS_FAILED(aArg));
MaybeSomething(aArg, &Promise::MaybeReject);
}
// DO NOT USE MaybeRejectBrokenly with in new code. Promises should be
// rejected with Error instances.
inline void MaybeRejectBrokenly(DOMError* aArg) {
MaybeSomething(aArg, &Promise::MaybeReject);
}
inline void MaybeRejectBrokenly(const nsAString& aArg) {
// aArg is a const reference so we can pass rvalues like NS_ERROR_*
template <typename T>
void MaybeReject(const T& aArg) {
MaybeSomething(aArg, &Promise::MaybeReject);
}

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

@ -76,7 +76,7 @@ public:
NS_IMETHODIMP
NotifyDialError(const nsAString& aError)
{
mPromise->MaybeRejectBrokenly(aError);
mPromise->MaybeReject(aError);
return NS_OK;
}
@ -255,13 +255,13 @@ Telephony::DialInternal(uint32_t aServiceId, const nsAString& aNumber,
nsRefPtr<Promise> promise = new Promise(global);
if (!IsValidNumber(aNumber) || !IsValidServiceId(aServiceId)) {
promise->MaybeReject(NS_ERROR_DOM_INVALID_ACCESS_ERR);
promise->MaybeReject(NS_LITERAL_STRING("InvalidAccessError"));
return promise.forget();
}
// We only support one outgoing call at a time.
if (HasDialingCall()) {
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
promise->MaybeReject(NS_LITERAL_STRING("InvalidStateError"));
return promise.forget();
}
@ -269,7 +269,7 @@ Telephony::DialInternal(uint32_t aServiceId, const nsAString& aNumber,
new Callback(this, promise, aServiceId, aNumber);
nsresult rv = mProvider->Dial(aServiceId, aNumber, aIsEmergency, callback);
if (NS_FAILED(rv)) {
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
promise->MaybeReject(NS_LITERAL_STRING("InvalidStateError"));
return promise.forget();
}