void DataTransfer::MozGetDataAt(JSContext* aCx, const nsAString& aFormat, uint32_t aIndex, JS::MutableHandle<JS::Value> aRetval, nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aRv) { nsCOMPtr<nsIVariant> data; aRv = GetDataAtInternal(aFormat, aIndex, &aSubjectPrincipal, getter_AddRefs(data)); if (aRv.Failed()) { return; } if (!data) { aRetval.setNull(); return; } JS::Rooted<JS::Value> result(aCx); if (!VariantToJsval(aCx, data, aRetval)) { aRv = NS_ERROR_FAILURE; return; } }
JS::Value DataTransfer::MozGetDataAt(JSContext* aCx, const nsAString& aFormat, uint32_t aIndex, mozilla::ErrorResult& aRv) { nsCOMPtr<nsIVariant> data; aRv = MozGetDataAt(aFormat, aIndex, getter_AddRefs(data)); if (aRv.Failed()) { return JS::UndefinedValue(); } if (!data) { return JS::NullValue(); } JS::Rooted<JS::Value> result(aCx); JS::Rooted<JSObject*> scope(aCx, GetWrapper()); if (!VariantToJsval(aCx, scope, data, &result)) { aRv = NS_ERROR_FAILURE; return JS::UndefinedValue(); } return result; }