Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM Function.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "FunctionBinding.h"
4 : #include "mozilla/OwningNonNull.h"
5 : #include "mozilla/dom/BindingUtils.h"
6 : #include "mozilla/dom/NonRefcountedDOMObject.h"
7 :
8 : namespace mozilla {
9 : namespace dom {
10 :
11 : void
12 7 : Function::Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const nsTArray<JS::Value>& arguments, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv)
13 : {
14 14 : JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());
15 14 : JS::AutoValueVector argv(cx);
16 7 : if (!argv.resize((1 - 1) + arguments.Length())) {
17 0 : aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
18 0 : return;
19 : }
20 7 : unsigned argc = (1 - 1) + arguments.Length();
21 :
22 : do {
23 9 : for (uint32_t idx = 0; idx < arguments.Length(); ++idx) {
24 2 : JS::ExposeValueToActiveJS(arguments[idx]);
25 2 : argv[0 + idx].set(arguments[idx]);
26 2 : if (!MaybeWrapValue(cx, argv[0 + idx])) {
27 0 : aRv.Throw(NS_ERROR_UNEXPECTED);
28 0 : return;
29 : }
30 2 : continue;
31 : }
32 7 : break;
33 : } while (0);
34 :
35 14 : JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback));
36 21 : if (!JS::Call(cx, aThisVal, callable,
37 14 : JS::HandleValueArray::subarray(argv, 0, argc), &rval)) {
38 0 : aRv.NoteJSContextException(cx);
39 0 : return;
40 : }
41 14 : JS::Rooted<JS::Value> rvalDecl(cx);
42 : #ifdef __clang__
43 : #pragma clang diagnostic push
44 : #pragma clang diagnostic ignored "-Wunreachable-code"
45 : #pragma clang diagnostic ignored "-Wunreachable-code-return"
46 : #endif // __clang__
47 7 : if ((false) && !CallerSubsumes(rval)) {
48 0 : ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "return value of Function");
49 0 : aRv.Throw(NS_ERROR_UNEXPECTED);
50 0 : return;
51 : }
52 : #ifdef __clang__
53 : #pragma clang diagnostic pop
54 : #endif // __clang__
55 7 : rvalDecl = rval;
56 7 : aRetVal.set(rvalDecl);
57 : }
58 :
59 :
60 :
61 : void
62 0 : VoidFunction::Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv)
63 : {
64 0 : JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());
65 :
66 0 : JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback));
67 0 : if (!JS::Call(cx, aThisVal, callable,
68 0 : JS::HandleValueArray::empty(), &rval)) {
69 0 : aRv.NoteJSContextException(cx);
70 0 : return;
71 : }
72 : }
73 :
74 :
75 :
76 : namespace binding_detail {
77 : } // namespace binding_detail
78 :
79 :
80 : namespace binding_detail {
81 : } // namespace binding_detail
82 :
83 :
84 : } // namespace dom
85 : } // namespace mozilla
|