Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM WebrtcGlobalInformation.webidl BY Codegen.py - DO NOT EDIT */
#include <type_traits>
#include "AtomList.h"
#include "MainThreadUtils.h"
#include "WebrtcGlobalInformation.h"
#include "WebrtcGlobalInformationBinding.h"
#include "WrapperFactory.h"
#include "js/Array.h"
#include "js/CallAndConstruct.h"
#include "js/Exception.h"
#include "js/ForOfIterator.h"
#include "js/MapAndSet.h"
#include "js/Object.h"
#include "js/PropertyAndElement.h"
#include "js/PropertyDescriptor.h"
#include "js/experimental/JitInfo.h"
#include "mozilla/Atomics.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/BindingCallContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DOMJSClass.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/PrimitiveConversions.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/SimpleGlobalObject.h"
#include "mozilla/dom/XrayExpandoClass.h"
#include "nsContentUtils.h"
namespace mozilla::dom {
namespace binding_detail {}; // Just to make sure it's known as a namespace
using namespace mozilla::dom::binding_detail;
MOZ_CAN_RUN_SCRIPT void
WebrtcGlobalLoggingCallback::Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const Sequence<nsString>& logMessages, ErrorResult& aRv)
{
JS::Rooted<JS::Value> rval(cx);
JS::RootedVector<JS::Value> argv(cx);
if (!argv.resize(1)) {
// That threw an exception on the JSContext, and our CallSetup will do
// the right thing with that.
return;
}
unsigned argc = 1;
do {
uint32_t length = logMessages.Length();
JS::Rooted<JSObject*> returnArray(cx, JS::NewArrayObject(cx, length));
if (!returnArray) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
// Scope for 'tmp'
{
JS::Rooted<JS::Value> tmp(cx);
for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
// Control block to let us common up the JS_DefineElement calls when there
// are different ways to succeed at wrapping the object.
do {
if (!xpc::NonVoidStringToJsval(cx, logMessages[sequenceIdx0], &tmp)) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
break;
} while (false);
if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
JSPROP_ENUMERATE)) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
}
}
argv[0].setObject(*returnArray);
break;
} while (false);
JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback));
if (!JS::Call(cx, aThisVal, callable,
JS::HandleValueArray::subarray(argv, 0, argc), &rval)) {
aRv.NoteJSContextException(cx);
return;
}
}
WebrtcGlobalMediaContext::WebrtcGlobalMediaContext()
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
WebrtcGlobalMediaContext::InitIds(JSContext* cx, WebrtcGlobalMediaContextAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->hasH264Hardware_id.init(cx, "hasH264Hardware")) {
return false;
}
return true;
}
bool
WebrtcGlobalMediaContext::Init(const char* sourceDescription, bool passedToJSImpl)
{
return true;
}
bool
WebrtcGlobalMediaContext::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
WebrtcGlobalMediaContextAtoms* atomsCache = GetAtomCache<WebrtcGlobalMediaContextAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
if (!obj) {
return false;
}
rval.set(JS::ObjectValue(*obj));
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
bool const & currentValue = mHasH264Hardware;
temp.setBoolean(currentValue);
if (!JS_DefinePropertyById(cx, obj, atomsCache->hasH264Hardware_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
return true;
}
void
WebrtcGlobalMediaContext::TraceDictionary(JSTracer* trc)
{
}
WebrtcGlobalMediaContext&
WebrtcGlobalMediaContext::operator=(const WebrtcGlobalMediaContext& aOther)
{
DictionaryBase::operator=(aOther);
mHasH264Hardware = aOther.mHasH264Hardware;
return *this;
}
bool
WebrtcGlobalMediaContext::operator==(const WebrtcGlobalMediaContext& aOther) const
{
if (mHasH264Hardware != aOther.mHasH264Hardware) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT void
WebrtcGlobalStatisticsCallback::Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const WebrtcGlobalStatisticsReport& reports, ErrorResult& aRv)
{
JS::Rooted<JS::Value> rval(cx);
JS::RootedVector<JS::Value> argv(cx);
if (!argv.resize(1)) {
// That threw an exception on the JSContext, and our CallSetup will do
// the right thing with that.
return;
}
unsigned argc = 1;
do {
if (!reports.ToObjectInternal(cx, argv[0])) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
break;
} while (false);
JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback));
if (!JS::Call(cx, aThisVal, callable,
JS::HandleValueArray::subarray(argv, 0, argc), &rval)) {
aRv.NoteJSContextException(cx);
return;
}
}
MOZ_CAN_RUN_SCRIPT void
WebrtcGlobalStatisticsHistoryCallback::Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const WebrtcGlobalStatisticsReport& reports, ErrorResult& aRv)
{
JS::Rooted<JS::Value> rval(cx);
JS::RootedVector<JS::Value> argv(cx);
if (!argv.resize(1)) {
// That threw an exception on the JSContext, and our CallSetup will do
// the right thing with that.
return;
}
unsigned argc = 1;
do {
if (!reports.ToObjectInternal(cx, argv[0])) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
break;
} while (false);
JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback));
if (!JS::Call(cx, aThisVal, callable,
JS::HandleValueArray::subarray(argv, 0, argc), &rval)) {
aRv.NoteJSContextException(cx);
return;
}
}
MOZ_CAN_RUN_SCRIPT void
WebrtcGlobalStatisticsHistoryPcIdsCallback::Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const Sequence<nsString>& pcIds, ErrorResult& aRv)
{
JS::Rooted<JS::Value> rval(cx);
JS::RootedVector<JS::Value> argv(cx);
if (!argv.resize(1)) {
// That threw an exception on the JSContext, and our CallSetup will do
// the right thing with that.
return;
}
unsigned argc = 1;
do {
uint32_t length = pcIds.Length();
JS::Rooted<JSObject*> returnArray(cx, JS::NewArrayObject(cx, length));
if (!returnArray) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
// Scope for 'tmp'
{
JS::Rooted<JS::Value> tmp(cx);
for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
// Control block to let us common up the JS_DefineElement calls when there
// are different ways to succeed at wrapping the object.
do {
if (!xpc::NonVoidStringToJsval(cx, pcIds[sequenceIdx0], &tmp)) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
break;
} while (false);
if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
JSPROP_ENUMERATE)) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
}
}
argv[0].setObject(*returnArray);
break;
} while (false);
JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback));
if (!JS::Call(cx, aThisVal, callable,
JS::HandleValueArray::subarray(argv, 0, argc), &rval)) {
aRv.NoteJSContextException(cx);
return;
}
}
WebrtcGlobalStatisticsReport::WebrtcGlobalStatisticsReport()
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
WebrtcGlobalStatisticsReport::InitIds(JSContext* cx, WebrtcGlobalStatisticsReportAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->sdpHistories_id.init(cx, "sdpHistories") ||
!atomsCache->reports_id.init(cx, "reports")) {
return false;
}
return true;
}
bool
WebrtcGlobalStatisticsReport::Init(const char* sourceDescription, bool passedToJSImpl)
{
{
// scope for any temporaries our default value setting needs.
/* mReports array is already empty; nothing to do */
}
mIsAnyMemberPresent = true;
{
// scope for any temporaries our default value setting needs.
/* mSdpHistories array is already empty; nothing to do */
}
mIsAnyMemberPresent = true;
return true;
}
bool
WebrtcGlobalStatisticsReport::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
WebrtcGlobalStatisticsReportAtoms* atomsCache = GetAtomCache<WebrtcGlobalStatisticsReportAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
if (!obj) {
return false;
}
rval.set(JS::ObjectValue(*obj));
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
Sequence<RTCStatsReportInternal> const & currentValue = mReports;
uint32_t length = currentValue.Length();
JS::Rooted<JSObject*> returnArray(cx, JS::NewArrayObject(cx, length));
if (!returnArray) {
return false;
}
// Scope for 'tmp'
{
JS::Rooted<JS::Value> tmp(cx);
for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
// Control block to let us common up the JS_DefineElement calls when there
// are different ways to succeed at wrapping the object.
do {
if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
return false;
}
break;
} while (false);
if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
JSPROP_ENUMERATE)) {
return false;
}
}
}
temp.setObject(*returnArray);
if (!JS_DefinePropertyById(cx, obj, atomsCache->reports_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
Sequence<RTCSdpHistoryInternal> const & currentValue = mSdpHistories;
uint32_t length = currentValue.Length();
JS::Rooted<JSObject*> returnArray(cx, JS::NewArrayObject(cx, length));
if (!returnArray) {
return false;
}
// Scope for 'tmp'
{
JS::Rooted<JS::Value> tmp(cx);
for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
// Control block to let us common up the JS_DefineElement calls when there
// are different ways to succeed at wrapping the object.
do {
if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) {
return false;
}
break;
} while (false);
if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
JSPROP_ENUMERATE)) {
return false;
}
}
}
temp.setObject(*returnArray);
if (!JS_DefinePropertyById(cx, obj, atomsCache->sdpHistories_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
return true;
}
void
WebrtcGlobalStatisticsReport::TraceDictionary(JSTracer* trc)
{
}
WebrtcGlobalStatisticsReport&
WebrtcGlobalStatisticsReport::operator=(const WebrtcGlobalStatisticsReport& aOther)
{
DictionaryBase::operator=(aOther);
mReports = aOther.mReports;
mSdpHistories = aOther.mSdpHistories;
return *this;
}
namespace WebrtcGlobalInformation_Binding {
MOZ_CAN_RUN_SCRIPT static bool
getAllStats(JSContext* cx_, unsigned argc, JS::Value* vp)
{
BindingCallContext cx(cx_, "WebrtcGlobalInformation.getAllStats");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "getAllStats", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
if (!args.requireAtLeast(cx, "WebrtcGlobalInformation.getAllStats", 1)) {
return false;
}
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
RootedCallback<OwningNonNull<binding_detail::FastWebrtcGlobalStatisticsCallback>> arg0(cx);
if (args[0].isObject()) {
if (JS::IsCallable(&args[0].toObject())) {
{ // scope for tempRoot and tempGlobalRoot if needed
arg0 = new binding_detail::FastWebrtcGlobalStatisticsCallback(&args[0].toObject(), JS::CurrentGlobalOrNull(cx));
}
} else {
cx.ThrowErrorMessage<MSG_NOT_CALLABLE>("Argument 1");
return false;
}
} else {
cx.ThrowErrorMessage<MSG_NOT_OBJECT>("Argument 1");
return false;
}
Optional<nsAString> arg1;
binding_detail::FakeString<char16_t> arg1_holder;
if (args.hasDefined(1)) {
if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1_holder)) {
return false;
}
arg1 = &arg1_holder;
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::GetAllStats(global, MOZ_KnownLive(NonNullHelper(arg0)), NonNullHelper(Constify(arg1)), rv))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::GetAllStats(global, MOZ_KnownLive(NonNullHelper(arg0)), NonNullHelper(Constify(arg1)), rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "WebrtcGlobalInformation.getAllStats"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setUndefined();
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
getStatsHistoryPcIds(JSContext* cx_, unsigned argc, JS::Value* vp)
{
BindingCallContext cx(cx_, "WebrtcGlobalInformation.getStatsHistoryPcIds");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "getStatsHistoryPcIds", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
if (!args.requireAtLeast(cx, "WebrtcGlobalInformation.getStatsHistoryPcIds", 1)) {
return false;
}
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
RootedCallback<OwningNonNull<binding_detail::FastWebrtcGlobalStatisticsHistoryPcIdsCallback>> arg0(cx);
if (args[0].isObject()) {
if (JS::IsCallable(&args[0].toObject())) {
{ // scope for tempRoot and tempGlobalRoot if needed
arg0 = new binding_detail::FastWebrtcGlobalStatisticsHistoryPcIdsCallback(&args[0].toObject(), JS::CurrentGlobalOrNull(cx));
}
} else {
cx.ThrowErrorMessage<MSG_NOT_CALLABLE>("Argument 1");
return false;
}
} else {
cx.ThrowErrorMessage<MSG_NOT_OBJECT>("Argument 1");
return false;
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::GetStatsHistoryPcIds(global, MOZ_KnownLive(NonNullHelper(arg0)), rv))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::GetStatsHistoryPcIds(global, MOZ_KnownLive(NonNullHelper(arg0)), rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "WebrtcGlobalInformation.getStatsHistoryPcIds"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setUndefined();
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
getStatsHistorySince(JSContext* cx_, unsigned argc, JS::Value* vp)
{
BindingCallContext cx(cx_, "WebrtcGlobalInformation.getStatsHistorySince");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "getStatsHistorySince", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
if (!args.requireAtLeast(cx, "WebrtcGlobalInformation.getStatsHistorySince", 2)) {
return false;
}
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
RootedCallback<OwningNonNull<binding_detail::FastWebrtcGlobalStatisticsHistoryCallback>> arg0(cx);
if (args[0].isObject()) {
if (JS::IsCallable(&args[0].toObject())) {
{ // scope for tempRoot and tempGlobalRoot if needed
arg0 = new binding_detail::FastWebrtcGlobalStatisticsHistoryCallback(&args[0].toObject(), JS::CurrentGlobalOrNull(cx));
}
} else {
cx.ThrowErrorMessage<MSG_NOT_CALLABLE>("Argument 1");
return false;
}
} else {
cx.ThrowErrorMessage<MSG_NOT_OBJECT>("Argument 1");
return false;
}
binding_detail::FakeString<char16_t> arg1;
if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
return false;
}
Optional<double> arg2;
if (args.hasDefined(2)) {
arg2.Construct();
if (!ValueToPrimitive<double, eDefault>(cx, args[2], "Argument 3", &arg2.Value())) {
return false;
} else if (!std::isfinite(arg2.Value())) {
cx.ThrowErrorMessage<MSG_NOT_FINITE>("Argument 3");
return false;
}
}
Optional<double> arg3;
if (args.hasDefined(3)) {
arg3.Construct();
if (!ValueToPrimitive<double, eDefault>(cx, args[3], "Argument 4", &arg3.Value())) {
return false;
} else if (!std::isfinite(arg3.Value())) {
cx.ThrowErrorMessage<MSG_NOT_FINITE>("Argument 4");
return false;
}
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::GetStatsHistorySince(global, MOZ_KnownLive(NonNullHelper(arg0)), NonNullHelper(Constify(arg1)), Constify(arg2), Constify(arg3), rv))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::GetStatsHistorySince(global, MOZ_KnownLive(NonNullHelper(arg0)), NonNullHelper(Constify(arg1)), Constify(arg2), Constify(arg3), rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "WebrtcGlobalInformation.getStatsHistorySince"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setUndefined();
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
getMediaContext(JSContext* cx, unsigned argc, JS::Value* vp)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "getMediaContext", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
WebrtcGlobalMediaContext result;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::GetMediaContext(global, result))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::GetMediaContext(global, result);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!result.ToObjectInternal(cx, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
clearAllStats(JSContext* cx, unsigned argc, JS::Value* vp)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "clearAllStats", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::ClearAllStats(global))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::ClearAllStats(global);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setUndefined();
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
getLogging(JSContext* cx_, unsigned argc, JS::Value* vp)
{
BindingCallContext cx(cx_, "WebrtcGlobalInformation.getLogging");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "getLogging", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
if (!args.requireAtLeast(cx, "WebrtcGlobalInformation.getLogging", 2)) {
return false;
}
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
binding_detail::FakeString<char16_t> arg0;
if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
return false;
}
RootedCallback<OwningNonNull<binding_detail::FastWebrtcGlobalLoggingCallback>> arg1(cx);
if (args[1].isObject()) {
if (JS::IsCallable(&args[1].toObject())) {
{ // scope for tempRoot and tempGlobalRoot if needed
arg1 = new binding_detail::FastWebrtcGlobalLoggingCallback(&args[1].toObject(), JS::CurrentGlobalOrNull(cx));
}
} else {
cx.ThrowErrorMessage<MSG_NOT_CALLABLE>("Argument 2");
return false;
}
} else {
cx.ThrowErrorMessage<MSG_NOT_OBJECT>("Argument 2");
return false;
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::GetLogging(global, NonNullHelper(Constify(arg0)), MOZ_KnownLive(NonNullHelper(arg1)), rv))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::GetLogging(global, NonNullHelper(Constify(arg0)), MOZ_KnownLive(NonNullHelper(arg1)), rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "WebrtcGlobalInformation.getLogging"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setUndefined();
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
clearLogging(JSContext* cx, unsigned argc, JS::Value* vp)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "clearLogging", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::ClearLogging(global))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::ClearLogging(global);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setUndefined();
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
get_aecDebug(JSContext* cx, unsigned argc, JS::Value* vp)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "aecDebug", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
bool result(mozilla::dom::WebrtcGlobalInformation::AecDebug(global));
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setBoolean(result);
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_aecDebug(JSContext* cx, unsigned argc, JS::Value* vp)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "aecDebug", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
if (!args.requireAtLeast(cx, "aecDebug setter", 1)) {
return false;
}
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
bool arg0;
if (!ValueToPrimitive<bool, eDefault>(cx, args[0], "Value being assigned", &arg0)) {
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::SetAecDebug(global, arg0))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::SetAecDebug(global, arg0);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
get_aecDebugLogDir(JSContext* cx, unsigned argc, JS::Value* vp)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"WebrtcGlobalInformation", "aecDebugLogDir", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
DOMString result;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(mozilla::dom::WebrtcGlobalInformation::GetAecDebugLogDir(global, result))>, "Should be returning void here");
mozilla::dom::WebrtcGlobalInformation::GetAecDebugLogDir(global, result);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
return false;
}
return true;
}
static const JSFunctionSpec sStaticMethods_specs[] = {
JS_FNSPEC("getAllStats", getAllStats, nullptr, 1, JSPROP_ENUMERATE, nullptr),
JS_FNSPEC("getStatsHistoryPcIds", getStatsHistoryPcIds, nullptr, 1, JSPROP_ENUMERATE, nullptr),
JS_FNSPEC("getStatsHistorySince", getStatsHistorySince, nullptr, 2, JSPROP_ENUMERATE, nullptr),
JS_FNSPEC("getMediaContext", getMediaContext, nullptr, 0, JSPROP_ENUMERATE, nullptr),
JS_FNSPEC("clearAllStats", clearAllStats, nullptr, 0, JSPROP_ENUMERATE, nullptr),
JS_FNSPEC("getLogging", getLogging, nullptr, 2, JSPROP_ENUMERATE, nullptr),
JS_FNSPEC("clearLogging", clearLogging, nullptr, 0, JSPROP_ENUMERATE, nullptr),
JS_FS_END
};
static const Prefable<const JSFunctionSpec> sStaticMethods[] = {
{ nullptr, &sStaticMethods_specs[0] },
{ nullptr, nullptr }
};
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
"We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
"We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
static const JSPropertySpec sStaticAttributes_specs[] = {
JSPropertySpec::nativeAccessors("aecDebug", JSPROP_ENUMERATE, get_aecDebug, nullptr, set_aecDebug, nullptr),
JSPropertySpec::nativeAccessors("aecDebugLogDir", JSPROP_ENUMERATE, get_aecDebugLogDir, nullptr, nullptr, nullptr),
JS_PS_END
};
static const Prefable<const JSPropertySpec> sStaticAttributes[] = {
{ nullptr, &sStaticAttributes_specs[0] },
{ nullptr, nullptr }
};
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
"We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
"We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
static uint16_t sNativeProperties_sortedPropertyIndices[9];
static PropertyInfo sNativeProperties_propertyInfos[9];
static const NativePropertiesN<2> sNativeProperties = {
true, 0 /* sStaticMethods */,
true, 1 /* sStaticAttributes */,
false, 0,
false, 0,
false, 0,
false, 0,
false, 0,
-1,
9,
sNativeProperties_sortedPropertyIndices,
{
{ sStaticMethods, &sNativeProperties_propertyInfos[0] },
{ sStaticAttributes, &sNativeProperties_propertyInfos[7] }
}
};
static_assert(9 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)),
"We have a property info count that is oversized");
bool sNativePropertiesInited = false;
const NativePropertyHooks sNativePropertyHooks = {
nullptr,
{ sNativeProperties.Upcast(), nullptr, &sNativePropertiesInited },
prototypes::id::_ID_Count,
constructors::id::WebrtcGlobalInformation,
&DefaultXrayExpandoObjectClass
};
static const DOMIfaceAndProtoJSClass sNamespaceObjectClass = {
{
"WebrtcGlobalInformation",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS,
JS_NULL_CLASS_OPS,
JS_NULL_CLASS_SPEC,
JS_NULL_CLASS_EXT,
JS_NULL_OBJECT_OPS
},
eNamespace,
prototypes::id::_ID_Count,
0,
&sNativePropertyHooks,
JS::GetRealmObjectPrototype
};
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
{
return nsContentUtils::ThreadsafeIsSystemCaller(aCx);
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
{
JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmObjectPrototype(aCx));
if (!constructorProto) {
return;
}
JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebrtcGlobalInformation);
dom::CreateNamespaceObject(aCx, aGlobal, constructorProto,
sNamespaceObjectClass,
interfaceCache,
sNativeProperties.Upcast(),
nullptr,
"WebrtcGlobalInformation", aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx)
{
return GetConstructorObjectHandle(aCx);
}
} // namespace WebrtcGlobalInformation_Binding
} // namespace mozilla::dom