Bug 991742 part 10. Remove the "aScope" argument from the Promise ArgumentToJSValue() methods. r=bholley

This commit is contained in:
Boris Zbarsky 2014-04-08 18:27:19 -04:00
parent 172c0446fa
commit 76ead922d5
3 changed files with 8 additions and 17 deletions

View File

@ -211,9 +211,10 @@ class TypedArrayCreator
: mArray(aArray)
{}
JSObject* Create(JSContext* aCx, JS::Handle<JSObject*> aCreator) const
JSObject* Create(JSContext* aCx) const
{
return TypedArrayType::Create(aCx, aCreator, mArray.Length(), mArray.Elements());
return TypedArrayType::Create(aCx, JS::NullPtr(), mArray.Length(),
mArray.Elements());
}
private:

View File

@ -1105,7 +1105,6 @@ PromiseReportRejectFeature::Notify(JSContext* aCx, workers::Status aStatus)
bool
Promise::ArgumentToJSValue(const nsAString& aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue)
{
// XXXkhuey I'd love to use xpc::NonVoidStringToJsval here, but it requires
@ -1126,7 +1125,6 @@ Promise::ArgumentToJSValue(const nsAString& aArgument,
bool
Promise::ArgumentToJSValue(bool aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue)
{
aValue.setBoolean(aArgument);

View File

@ -79,7 +79,7 @@ public:
// Helpers for using Promise from C++.
// Most DOM objects are handled already. To add a new type T, such as ints,
// or dictionaries, add an ArgumentToJSVal overload below.
// or dictionaries, add an ArgumentToJSValue overload below.
template <typename T>
void MaybeResolve(T& aArg) {
MaybeSomething(aArg, &Promise::MaybeResolve);
@ -209,14 +209,12 @@ private:
bool
ArgumentToJSValue(const nsAString& aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue);
// Accept booleans.
bool
ArgumentToJSValue(bool aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue);
// Accept objects that inherit from nsWrapperCache and nsISupports (e.g. most
@ -226,7 +224,6 @@ private:
IsBaseOf<nsISupports, T>::value, bool>::Type
ArgumentToJSValue(T& aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue)
{
return WrapNewBindingObject(aCx, aArgument, aValue);
@ -237,12 +234,9 @@ private:
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
ArgumentToJSValue(const TypedArrayCreator<T>& aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue)
{
JS::RootedObject scope(aCx, aScope);
JSObject* abv = aArgument.Create(aCx, scope);
JSObject* abv = aArgument.Create(aCx);
if (!abv) {
return false;
}
@ -257,10 +251,9 @@ private:
IsBaseOf<nsISupports, T>::value, bool>::Type
ArgumentToJSValue(T& aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue)
{
JS::Rooted<JSObject*> scope(aCx, aScope);
JS::Rooted<JSObject*> scope(aCx, JS::CurrentGlobalOrNull(aCx));
nsresult rv = nsContentUtils::WrapNative(aCx, scope, &aArgument, aValue);
return NS_SUCCEEDED(rv);
@ -270,10 +263,9 @@ private:
bool
ArgumentToJSValue(const SmartPtr<T>& aArgument,
JSContext* aCx,
JSObject* aScope,
JS::MutableHandle<JS::Value> aValue)
{
return ArgumentToJSValue(*aArgument.get(), aCx, aScope, aValue);
return ArgumentToJSValue(*aArgument.get(), aCx, aValue);
}
template <typename T>
@ -288,7 +280,7 @@ private:
JSAutoCompartment ac(cx, wrapper);
JS::Rooted<JS::Value> val(cx);
if (!ArgumentToJSValue(aArgument, cx, wrapper, &val)) {
if (!ArgumentToJSValue(aArgument, cx, &val)) {
HandleException(cx);
return;
}