Backed out 3 changesets (bug 996474, bug 996831) for B2G bustage on a CLOSED TREE.

Backed out changeset 8f98a4c2257f (bug 996831)
Backed out changeset 7acce569bd84 (bug 996831)
Backed out changeset 1845b09c7578 (bug 996474)
This commit is contained in:
Ryan VanderMeulen 2014-04-16 19:31:41 -04:00
Родитель 74b5f3ee46
Коммит 565416fed7
5 изменённых файлов: 26 добавлений и 62 удалений

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

@ -131,7 +131,28 @@ Throw(JSContext* aCx, nsresult aRv, const char* aMessage)
}
}
nsRefPtr<Exception> finalException = CreateException(aCx, aRv, aMessage);
nsRefPtr<Exception> finalException;
// Do we use DOM exceptions for this error code?
switch (NS_ERROR_GET_MODULE(aRv)) {
case NS_ERROR_MODULE_DOM:
case NS_ERROR_MODULE_SVG:
case NS_ERROR_MODULE_DOM_XPATH:
case NS_ERROR_MODULE_DOM_INDEXEDDB:
case NS_ERROR_MODULE_DOM_FILEHANDLE:
finalException = DOMException::Create(aRv);
break;
default:
break;
}
// If not, use the default.
if (!finalException) {
// aMessage can be null.
finalException = new Exception(nsCString(aMessage), aRv,
EmptyCString(), nullptr, nullptr);
}
MOZ_ASSERT(finalException);
if (!ThrowExceptionObject(aCx, finalException)) {
@ -143,29 +164,6 @@ Throw(JSContext* aCx, nsresult aRv, const char* aMessage)
return false;
}
already_AddRefed<Exception>
CreateException(JSContext* aCx, nsresult aRv, const char* aMessage)
{
// Do we use DOM exceptions for this error code?
switch (NS_ERROR_GET_MODULE(aRv)) {
case NS_ERROR_MODULE_DOM:
case NS_ERROR_MODULE_SVG:
case NS_ERROR_MODULE_DOM_XPATH:
case NS_ERROR_MODULE_DOM_INDEXEDDB:
case NS_ERROR_MODULE_DOM_FILEHANDLE:
return DOMException::Create(aRv);
default:
break;
}
// If not, use the default.
// aMessage can be null, so we can't use nsDependentCString on it.
nsRefPtr<Exception> exception =
new Exception(nsCString(aMessage), aRv,
EmptyCString(), nullptr, nullptr);
return exception.forget();
}
already_AddRefed<nsIStackFrame>
GetCurrentJSStack()
{

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

@ -30,11 +30,6 @@ ThrowExceptionObject(JSContext* aCx, Exception* aException);
bool
ThrowExceptionObject(JSContext* aCx, nsIException* aException);
// Create an exception object for the given nsresult and message but
// don't set it pending on aCx. This never returns null.
already_AddRefed<Exception>
CreateException(JSContext* aCx, nsresult aRv, const char* aMessage = nullptr);
already_AddRefed<nsIStackFrame>
GetCurrentJSStack();

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

@ -5,8 +5,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/Exceptions.h"
#include "nsAString.h"
#include "nsContentUtils.h"
#include "nsStringBuffer.h"
@ -51,14 +49,5 @@ ISupportsToJSValue(JSContext* aCx,
} // namespace tojsvalue_detail
bool
ToJSValue(JSContext* aCx,
nsresult aArgument,
JS::MutableHandle<JS::Value> aValue)
{
nsRefPtr<Exception> exception = CreateException(aCx, aArgument);
return ToJSValue(aCx, exception, aValue);
}
} // namespace dom
} // namespace mozilla

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

@ -203,22 +203,6 @@ ToJSValue(JSContext* aCx,
return aArgument.ToObject(aCx, aValue);
}
// Accept existing JS values (which may not be same-compartment with us
inline bool
ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
JS::MutableHandle<JS::Value> aValue)
{
aValue.set(aArgument);
return MaybeWrapValue(aCx, aValue);
}
// Accept nsresult, for use in rejections, and create an XPCOM
// exception object representing that nsresult.
bool
ToJSValue(JSContext* aCx,
nsresult aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept arrays of other things we accept
template <typename T>
bool

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

@ -78,17 +78,15 @@ public:
JS::Handle<JS::Value> aValue);
// Helpers for using Promise from C++.
// Most DOM objects are handled already. To add a new type T, add a
// ToJSValue overload in ToJSValue.h.
// aArg is a const reference so we can pass rvalues like integer constants
// Most DOM objects are handled already. To add a new type T, such as ints,
// or dictionaries, add a ToJSValue overload in ToJSValue.h.
template <typename T>
void MaybeResolve(const T& aArg) {
void MaybeResolve(T& aArg) {
MaybeSomething(aArg, &Promise::MaybeResolve);
}
// aArg is a const reference so we can pass rvalues like NS_ERROR_*
template <typename T>
void MaybeReject(const T& aArg) {
void MaybeReject(T& aArg) {
MaybeSomething(aArg, &Promise::MaybeReject);
}