mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changesets 6d1c36585219 and bd403a727849 (bug 1016560) for mochitest-other failures.
CLOSED TREE
This commit is contained in:
parent
33ff563880
commit
d221f7e847
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user