Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM MediaTrackSettings.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "AtomList.h"
4 : #include "MediaTrackSettingsBinding.h"
5 : #include "mozilla/FloatingPoint.h"
6 : #include "mozilla/OwningNonNull.h"
7 : #include "mozilla/dom/BindingUtils.h"
8 : #include "mozilla/dom/NonRefcountedDOMObject.h"
9 : #include "mozilla/dom/PrimitiveConversions.h"
10 : #include "mozilla/dom/ScriptSettings.h"
11 : #include "mozilla/dom/SimpleGlobalObject.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 :
17 0 : MediaTrackSettings::MediaTrackSettings()
18 : {
19 : // Safe to pass a null context if we pass a null value
20 0 : Init(nullptr, JS::NullHandleValue);
21 0 : }
22 :
23 :
24 :
25 : bool
26 0 : MediaTrackSettings::InitIds(JSContext* cx, MediaTrackSettingsAtoms* atomsCache)
27 : {
28 0 : MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
29 :
30 : // Initialize these in reverse order so that any failure leaves the first one
31 : // uninitialized.
32 0 : if (!atomsCache->width_id.init(cx, "width") ||
33 0 : !atomsCache->viewportWidth_id.init(cx, "viewportWidth") ||
34 0 : !atomsCache->viewportOffsetY_id.init(cx, "viewportOffsetY") ||
35 0 : !atomsCache->viewportOffsetX_id.init(cx, "viewportOffsetX") ||
36 0 : !atomsCache->viewportHeight_id.init(cx, "viewportHeight") ||
37 0 : !atomsCache->scrollWithPage_id.init(cx, "scrollWithPage") ||
38 0 : !atomsCache->noiseSuppression_id.init(cx, "noiseSuppression") ||
39 0 : !atomsCache->mediaSource_id.init(cx, "mediaSource") ||
40 0 : !atomsCache->height_id.init(cx, "height") ||
41 0 : !atomsCache->frameRate_id.init(cx, "frameRate") ||
42 0 : !atomsCache->facingMode_id.init(cx, "facingMode") ||
43 0 : !atomsCache->echoCancellation_id.init(cx, "echoCancellation") ||
44 0 : !atomsCache->deviceId_id.init(cx, "deviceId") ||
45 0 : !atomsCache->channelCount_id.init(cx, "channelCount") ||
46 0 : !atomsCache->browserWindow_id.init(cx, "browserWindow") ||
47 0 : !atomsCache->autoGainControl_id.init(cx, "autoGainControl")) {
48 0 : return false;
49 : }
50 0 : return true;
51 : }
52 :
53 : bool
54 0 : MediaTrackSettings::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
55 : {
56 : // Passing a null JSContext is OK only if we're initing from null,
57 : // Since in that case we will not have to do any property gets
58 : // Also evaluate isNullOrUndefined in order to avoid false-positive
59 : // checkers by static analysis tools
60 0 : MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
61 0 : MediaTrackSettingsAtoms* atomsCache = nullptr;
62 0 : if (cx) {
63 0 : atomsCache = GetAtomCache<MediaTrackSettingsAtoms>(cx);
64 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
65 0 : return false;
66 : }
67 : }
68 :
69 0 : if (!IsConvertibleToDictionary(val)) {
70 0 : return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
71 : }
72 :
73 0 : bool isNull = val.isNullOrUndefined();
74 : // We only need these if !isNull, in which case we have |cx|.
75 0 : Maybe<JS::Rooted<JSObject *> > object;
76 0 : Maybe<JS::Rooted<JS::Value> > temp;
77 0 : if (!isNull) {
78 0 : MOZ_ASSERT(cx);
79 0 : object.emplace(cx, &val.toObject());
80 0 : temp.emplace(cx);
81 : }
82 0 : if (!isNull) {
83 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->autoGainControl_id, temp.ptr())) {
84 0 : return false;
85 : }
86 : }
87 0 : if (!isNull && !temp->isUndefined()) {
88 0 : mAutoGainControl.Construct();
89 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mAutoGainControl.Value()))) {
90 0 : return false;
91 : }
92 0 : mIsAnyMemberPresent = true;
93 : }
94 :
95 0 : if (!isNull) {
96 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->browserWindow_id, temp.ptr())) {
97 0 : return false;
98 : }
99 : }
100 0 : if (!isNull && !temp->isUndefined()) {
101 0 : mBrowserWindow.Construct();
102 0 : if (!ValueToPrimitive<int64_t, eDefault>(cx, temp.ref(), &(mBrowserWindow.Value()))) {
103 0 : return false;
104 : }
105 0 : mIsAnyMemberPresent = true;
106 : }
107 :
108 0 : if (!isNull) {
109 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->channelCount_id, temp.ptr())) {
110 0 : return false;
111 : }
112 : }
113 0 : if (!isNull && !temp->isUndefined()) {
114 0 : mChannelCount.Construct();
115 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mChannelCount.Value()))) {
116 0 : return false;
117 : }
118 0 : mIsAnyMemberPresent = true;
119 : }
120 :
121 0 : if (!isNull) {
122 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->deviceId_id, temp.ptr())) {
123 0 : return false;
124 : }
125 : }
126 0 : if (!isNull && !temp->isUndefined()) {
127 0 : mDeviceId.Construct();
128 0 : if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mDeviceId.Value()))) {
129 0 : return false;
130 : }
131 0 : mIsAnyMemberPresent = true;
132 : }
133 :
134 0 : if (!isNull) {
135 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->echoCancellation_id, temp.ptr())) {
136 0 : return false;
137 : }
138 : }
139 0 : if (!isNull && !temp->isUndefined()) {
140 0 : mEchoCancellation.Construct();
141 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mEchoCancellation.Value()))) {
142 0 : return false;
143 : }
144 0 : mIsAnyMemberPresent = true;
145 : }
146 :
147 0 : if (!isNull) {
148 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->facingMode_id, temp.ptr())) {
149 0 : return false;
150 : }
151 : }
152 0 : if (!isNull && !temp->isUndefined()) {
153 0 : mFacingMode.Construct();
154 0 : if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mFacingMode.Value()))) {
155 0 : return false;
156 : }
157 0 : mIsAnyMemberPresent = true;
158 : }
159 :
160 0 : if (!isNull) {
161 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->frameRate_id, temp.ptr())) {
162 0 : return false;
163 : }
164 : }
165 0 : if (!isNull && !temp->isUndefined()) {
166 0 : mFrameRate.Construct();
167 0 : if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &(mFrameRate.Value()))) {
168 0 : return false;
169 0 : } else if (!mozilla::IsFinite((mFrameRate.Value()))) {
170 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "'frameRate' member of MediaTrackSettings");
171 0 : return false;
172 : }
173 0 : mIsAnyMemberPresent = true;
174 : }
175 :
176 0 : if (!isNull) {
177 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->height_id, temp.ptr())) {
178 0 : return false;
179 : }
180 : }
181 0 : if (!isNull && !temp->isUndefined()) {
182 0 : mHeight.Construct();
183 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mHeight.Value()))) {
184 0 : return false;
185 : }
186 0 : mIsAnyMemberPresent = true;
187 : }
188 :
189 0 : if (!isNull) {
190 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->mediaSource_id, temp.ptr())) {
191 0 : return false;
192 : }
193 : }
194 0 : if (!isNull && !temp->isUndefined()) {
195 0 : mMediaSource.Construct();
196 0 : if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mMediaSource.Value()))) {
197 0 : return false;
198 : }
199 0 : mIsAnyMemberPresent = true;
200 : }
201 :
202 0 : if (!isNull) {
203 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->noiseSuppression_id, temp.ptr())) {
204 0 : return false;
205 : }
206 : }
207 0 : if (!isNull && !temp->isUndefined()) {
208 0 : mNoiseSuppression.Construct();
209 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mNoiseSuppression.Value()))) {
210 0 : return false;
211 : }
212 0 : mIsAnyMemberPresent = true;
213 : }
214 :
215 0 : if (!isNull) {
216 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->scrollWithPage_id, temp.ptr())) {
217 0 : return false;
218 : }
219 : }
220 0 : if (!isNull && !temp->isUndefined()) {
221 0 : mScrollWithPage.Construct();
222 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mScrollWithPage.Value()))) {
223 0 : return false;
224 : }
225 0 : mIsAnyMemberPresent = true;
226 : }
227 :
228 0 : if (!isNull) {
229 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->viewportHeight_id, temp.ptr())) {
230 0 : return false;
231 : }
232 : }
233 0 : if (!isNull && !temp->isUndefined()) {
234 0 : mViewportHeight.Construct();
235 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mViewportHeight.Value()))) {
236 0 : return false;
237 : }
238 0 : mIsAnyMemberPresent = true;
239 : }
240 :
241 0 : if (!isNull) {
242 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->viewportOffsetX_id, temp.ptr())) {
243 0 : return false;
244 : }
245 : }
246 0 : if (!isNull && !temp->isUndefined()) {
247 0 : mViewportOffsetX.Construct();
248 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mViewportOffsetX.Value()))) {
249 0 : return false;
250 : }
251 0 : mIsAnyMemberPresent = true;
252 : }
253 :
254 0 : if (!isNull) {
255 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->viewportOffsetY_id, temp.ptr())) {
256 0 : return false;
257 : }
258 : }
259 0 : if (!isNull && !temp->isUndefined()) {
260 0 : mViewportOffsetY.Construct();
261 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mViewportOffsetY.Value()))) {
262 0 : return false;
263 : }
264 0 : mIsAnyMemberPresent = true;
265 : }
266 :
267 0 : if (!isNull) {
268 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->viewportWidth_id, temp.ptr())) {
269 0 : return false;
270 : }
271 : }
272 0 : if (!isNull && !temp->isUndefined()) {
273 0 : mViewportWidth.Construct();
274 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mViewportWidth.Value()))) {
275 0 : return false;
276 : }
277 0 : mIsAnyMemberPresent = true;
278 : }
279 :
280 0 : if (!isNull) {
281 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->width_id, temp.ptr())) {
282 0 : return false;
283 : }
284 : }
285 0 : if (!isNull && !temp->isUndefined()) {
286 0 : mWidth.Construct();
287 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mWidth.Value()))) {
288 0 : return false;
289 : }
290 0 : mIsAnyMemberPresent = true;
291 : }
292 0 : return true;
293 : }
294 :
295 : bool
296 0 : MediaTrackSettings::Init(const nsAString& aJSON)
297 : {
298 0 : AutoJSAPI jsapi;
299 0 : JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
300 0 : if (!cleanGlobal) {
301 0 : return false;
302 : }
303 0 : if (!jsapi.Init(cleanGlobal)) {
304 0 : return false;
305 : }
306 0 : JSContext* cx = jsapi.cx();
307 0 : JS::Rooted<JS::Value> json(cx);
308 0 : bool ok = ParseJSON(cx, aJSON, &json);
309 0 : NS_ENSURE_TRUE(ok, false);
310 0 : return Init(cx, json);
311 : }
312 :
313 : bool
314 0 : MediaTrackSettings::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
315 : {
316 0 : MediaTrackSettingsAtoms* atomsCache = GetAtomCache<MediaTrackSettingsAtoms>(cx);
317 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
318 0 : return false;
319 : }
320 :
321 0 : JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
322 0 : if (!obj) {
323 0 : return false;
324 : }
325 0 : rval.set(JS::ObjectValue(*obj));
326 :
327 0 : if (mAutoGainControl.WasPassed()) {
328 : do {
329 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
330 0 : JS::Rooted<JS::Value> temp(cx);
331 0 : bool const & currentValue = mAutoGainControl.InternalValue();
332 0 : temp.setBoolean(currentValue);
333 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->autoGainControl_id, temp, JSPROP_ENUMERATE)) {
334 0 : return false;
335 : }
336 0 : break;
337 : } while(0);
338 : }
339 :
340 0 : if (mBrowserWindow.WasPassed()) {
341 : do {
342 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
343 0 : JS::Rooted<JS::Value> temp(cx);
344 0 : int64_t const & currentValue = mBrowserWindow.InternalValue();
345 0 : temp.set(JS_NumberValue(double(currentValue)));
346 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->browserWindow_id, temp, JSPROP_ENUMERATE)) {
347 0 : return false;
348 : }
349 0 : break;
350 : } while(0);
351 : }
352 :
353 0 : if (mChannelCount.WasPassed()) {
354 : do {
355 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
356 0 : JS::Rooted<JS::Value> temp(cx);
357 0 : int32_t const & currentValue = mChannelCount.InternalValue();
358 0 : temp.setInt32(int32_t(currentValue));
359 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->channelCount_id, temp, JSPROP_ENUMERATE)) {
360 0 : return false;
361 : }
362 0 : break;
363 : } while(0);
364 : }
365 :
366 0 : if (mDeviceId.WasPassed()) {
367 : do {
368 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
369 0 : JS::Rooted<JS::Value> temp(cx);
370 0 : nsString const & currentValue = mDeviceId.InternalValue();
371 0 : if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
372 0 : return false;
373 : }
374 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->deviceId_id, temp, JSPROP_ENUMERATE)) {
375 0 : return false;
376 : }
377 0 : break;
378 : } while(0);
379 : }
380 :
381 0 : if (mEchoCancellation.WasPassed()) {
382 : do {
383 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
384 0 : JS::Rooted<JS::Value> temp(cx);
385 0 : bool const & currentValue = mEchoCancellation.InternalValue();
386 0 : temp.setBoolean(currentValue);
387 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->echoCancellation_id, temp, JSPROP_ENUMERATE)) {
388 0 : return false;
389 : }
390 0 : break;
391 : } while(0);
392 : }
393 :
394 0 : if (mFacingMode.WasPassed()) {
395 : do {
396 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
397 0 : JS::Rooted<JS::Value> temp(cx);
398 0 : nsString const & currentValue = mFacingMode.InternalValue();
399 0 : if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
400 0 : return false;
401 : }
402 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->facingMode_id, temp, JSPROP_ENUMERATE)) {
403 0 : return false;
404 : }
405 0 : break;
406 : } while(0);
407 : }
408 :
409 0 : if (mFrameRate.WasPassed()) {
410 : do {
411 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
412 0 : JS::Rooted<JS::Value> temp(cx);
413 0 : double const & currentValue = mFrameRate.InternalValue();
414 0 : temp.set(JS_NumberValue(double(currentValue)));
415 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->frameRate_id, temp, JSPROP_ENUMERATE)) {
416 0 : return false;
417 : }
418 0 : break;
419 : } while(0);
420 : }
421 :
422 0 : if (mHeight.WasPassed()) {
423 : do {
424 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
425 0 : JS::Rooted<JS::Value> temp(cx);
426 0 : int32_t const & currentValue = mHeight.InternalValue();
427 0 : temp.setInt32(int32_t(currentValue));
428 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->height_id, temp, JSPROP_ENUMERATE)) {
429 0 : return false;
430 : }
431 0 : break;
432 : } while(0);
433 : }
434 :
435 0 : if (mMediaSource.WasPassed()) {
436 : do {
437 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
438 0 : JS::Rooted<JS::Value> temp(cx);
439 0 : nsString const & currentValue = mMediaSource.InternalValue();
440 0 : if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
441 0 : return false;
442 : }
443 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->mediaSource_id, temp, JSPROP_ENUMERATE)) {
444 0 : return false;
445 : }
446 0 : break;
447 : } while(0);
448 : }
449 :
450 0 : if (mNoiseSuppression.WasPassed()) {
451 : do {
452 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
453 0 : JS::Rooted<JS::Value> temp(cx);
454 0 : bool const & currentValue = mNoiseSuppression.InternalValue();
455 0 : temp.setBoolean(currentValue);
456 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->noiseSuppression_id, temp, JSPROP_ENUMERATE)) {
457 0 : return false;
458 : }
459 0 : break;
460 : } while(0);
461 : }
462 :
463 0 : if (mScrollWithPage.WasPassed()) {
464 : do {
465 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
466 0 : JS::Rooted<JS::Value> temp(cx);
467 0 : bool const & currentValue = mScrollWithPage.InternalValue();
468 0 : temp.setBoolean(currentValue);
469 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->scrollWithPage_id, temp, JSPROP_ENUMERATE)) {
470 0 : return false;
471 : }
472 0 : break;
473 : } while(0);
474 : }
475 :
476 0 : if (mViewportHeight.WasPassed()) {
477 : do {
478 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
479 0 : JS::Rooted<JS::Value> temp(cx);
480 0 : int32_t const & currentValue = mViewportHeight.InternalValue();
481 0 : temp.setInt32(int32_t(currentValue));
482 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->viewportHeight_id, temp, JSPROP_ENUMERATE)) {
483 0 : return false;
484 : }
485 0 : break;
486 : } while(0);
487 : }
488 :
489 0 : if (mViewportOffsetX.WasPassed()) {
490 : do {
491 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
492 0 : JS::Rooted<JS::Value> temp(cx);
493 0 : int32_t const & currentValue = mViewportOffsetX.InternalValue();
494 0 : temp.setInt32(int32_t(currentValue));
495 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->viewportOffsetX_id, temp, JSPROP_ENUMERATE)) {
496 0 : return false;
497 : }
498 0 : break;
499 : } while(0);
500 : }
501 :
502 0 : if (mViewportOffsetY.WasPassed()) {
503 : do {
504 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
505 0 : JS::Rooted<JS::Value> temp(cx);
506 0 : int32_t const & currentValue = mViewportOffsetY.InternalValue();
507 0 : temp.setInt32(int32_t(currentValue));
508 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->viewportOffsetY_id, temp, JSPROP_ENUMERATE)) {
509 0 : return false;
510 : }
511 0 : break;
512 : } while(0);
513 : }
514 :
515 0 : if (mViewportWidth.WasPassed()) {
516 : do {
517 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
518 0 : JS::Rooted<JS::Value> temp(cx);
519 0 : int32_t const & currentValue = mViewportWidth.InternalValue();
520 0 : temp.setInt32(int32_t(currentValue));
521 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->viewportWidth_id, temp, JSPROP_ENUMERATE)) {
522 0 : return false;
523 : }
524 0 : break;
525 : } while(0);
526 : }
527 :
528 0 : if (mWidth.WasPassed()) {
529 : do {
530 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
531 0 : JS::Rooted<JS::Value> temp(cx);
532 0 : int32_t const & currentValue = mWidth.InternalValue();
533 0 : temp.setInt32(int32_t(currentValue));
534 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->width_id, temp, JSPROP_ENUMERATE)) {
535 0 : return false;
536 : }
537 0 : break;
538 : } while(0);
539 : }
540 :
541 0 : return true;
542 : }
543 :
544 : bool
545 0 : MediaTrackSettings::ToJSON(nsAString& aJSON) const
546 : {
547 0 : AutoJSAPI jsapi;
548 0 : jsapi.Init();
549 0 : JSContext *cx = jsapi.cx();
550 : // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
551 : // because we'll only be creating objects, in ways that have no
552 : // side-effects, followed by a call to JS::ToJSONMaybeSafely,
553 : // which likewise guarantees no side-effects for the sorts of
554 : // things we will pass it.
555 0 : JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
556 0 : JS::Rooted<JS::Value> val(cx);
557 0 : if (!ToObjectInternal(cx, &val)) {
558 0 : return false;
559 : }
560 0 : JS::Rooted<JSObject*> obj(cx, &val.toObject());
561 0 : return StringifyToJSON(cx, obj, aJSON);
562 : }
563 :
564 : void
565 0 : MediaTrackSettings::TraceDictionary(JSTracer* trc)
566 : {
567 0 : }
568 :
569 : MediaTrackSettings&
570 0 : MediaTrackSettings::operator=(const MediaTrackSettings& aOther)
571 : {
572 0 : mAutoGainControl.Reset();
573 0 : if (aOther.mAutoGainControl.WasPassed()) {
574 0 : mAutoGainControl.Construct(aOther.mAutoGainControl.Value());
575 : }
576 0 : mBrowserWindow.Reset();
577 0 : if (aOther.mBrowserWindow.WasPassed()) {
578 0 : mBrowserWindow.Construct(aOther.mBrowserWindow.Value());
579 : }
580 0 : mChannelCount.Reset();
581 0 : if (aOther.mChannelCount.WasPassed()) {
582 0 : mChannelCount.Construct(aOther.mChannelCount.Value());
583 : }
584 0 : mDeviceId.Reset();
585 0 : if (aOther.mDeviceId.WasPassed()) {
586 0 : mDeviceId.Construct(aOther.mDeviceId.Value());
587 : }
588 0 : mEchoCancellation.Reset();
589 0 : if (aOther.mEchoCancellation.WasPassed()) {
590 0 : mEchoCancellation.Construct(aOther.mEchoCancellation.Value());
591 : }
592 0 : mFacingMode.Reset();
593 0 : if (aOther.mFacingMode.WasPassed()) {
594 0 : mFacingMode.Construct(aOther.mFacingMode.Value());
595 : }
596 0 : mFrameRate.Reset();
597 0 : if (aOther.mFrameRate.WasPassed()) {
598 0 : mFrameRate.Construct(aOther.mFrameRate.Value());
599 : }
600 0 : mHeight.Reset();
601 0 : if (aOther.mHeight.WasPassed()) {
602 0 : mHeight.Construct(aOther.mHeight.Value());
603 : }
604 0 : mMediaSource.Reset();
605 0 : if (aOther.mMediaSource.WasPassed()) {
606 0 : mMediaSource.Construct(aOther.mMediaSource.Value());
607 : }
608 0 : mNoiseSuppression.Reset();
609 0 : if (aOther.mNoiseSuppression.WasPassed()) {
610 0 : mNoiseSuppression.Construct(aOther.mNoiseSuppression.Value());
611 : }
612 0 : mScrollWithPage.Reset();
613 0 : if (aOther.mScrollWithPage.WasPassed()) {
614 0 : mScrollWithPage.Construct(aOther.mScrollWithPage.Value());
615 : }
616 0 : mViewportHeight.Reset();
617 0 : if (aOther.mViewportHeight.WasPassed()) {
618 0 : mViewportHeight.Construct(aOther.mViewportHeight.Value());
619 : }
620 0 : mViewportOffsetX.Reset();
621 0 : if (aOther.mViewportOffsetX.WasPassed()) {
622 0 : mViewportOffsetX.Construct(aOther.mViewportOffsetX.Value());
623 : }
624 0 : mViewportOffsetY.Reset();
625 0 : if (aOther.mViewportOffsetY.WasPassed()) {
626 0 : mViewportOffsetY.Construct(aOther.mViewportOffsetY.Value());
627 : }
628 0 : mViewportWidth.Reset();
629 0 : if (aOther.mViewportWidth.WasPassed()) {
630 0 : mViewportWidth.Construct(aOther.mViewportWidth.Value());
631 : }
632 0 : mWidth.Reset();
633 0 : if (aOther.mWidth.WasPassed()) {
634 0 : mWidth.Construct(aOther.mWidth.Value());
635 : }
636 0 : return *this;
637 : }
638 :
639 : namespace binding_detail {
640 : } // namespace binding_detail
641 :
642 :
643 : } // namespace dom
644 : } // namespace mozilla
|