/work/obj-fuzz/dom/bindings/FunctionBinding.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
12 | | using namespace mozilla::dom::binding_detail; |
13 | | |
14 | | |
15 | | void |
16 | | Function::Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const nsTArray<JS::Value>& arguments, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv) |
17 | 0 | { |
18 | 0 | JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue()); |
19 | 0 | JS::AutoValueVector argv(cx); |
20 | 0 | if (!argv.resize((1 - 1) + arguments.Length())) { |
21 | 0 | aRv.Throw(NS_ERROR_OUT_OF_MEMORY); |
22 | 0 | return; |
23 | 0 | } |
24 | 0 | unsigned argc = (1 - 1) + arguments.Length(); |
25 | 0 |
|
26 | 0 | do { |
27 | 0 | for (uint32_t idx = 0; idx < arguments.Length(); ++idx) { |
28 | 0 | JS::ExposeValueToActiveJS(arguments[idx]); |
29 | 0 | argv[0 + idx].set(arguments[idx]); |
30 | 0 | if (!MaybeWrapValue(cx, argv[0 + idx])) { |
31 | 0 | aRv.Throw(NS_ERROR_UNEXPECTED); |
32 | 0 | return; |
33 | 0 | } |
34 | 0 | continue; |
35 | 0 | } |
36 | 0 | break; |
37 | 0 | } while (false); |
38 | 0 |
|
39 | 0 | JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback)); |
40 | 0 | if (!JS::Call(cx, aThisVal, callable, |
41 | 0 | JS::HandleValueArray::subarray(argv, 0, argc), &rval)) { |
42 | 0 | aRv.NoteJSContextException(cx); |
43 | 0 | return; |
44 | 0 | } |
45 | 0 | JS::Rooted<JS::Value> rvalDecl(cx); |
46 | 0 | #ifdef __clang__ |
47 | 0 | #pragma clang diagnostic push |
48 | 0 | #pragma clang diagnostic ignored "-Wunreachable-code" |
49 | 0 | #pragma clang diagnostic ignored "-Wunreachable-code-return" |
50 | 0 | #endif // __clang__ |
51 | 0 | if ((false) && !CallerSubsumes(rval)) { |
52 | 0 | ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "return value of Function"); |
53 | 0 | aRv.Throw(NS_ERROR_UNEXPECTED); |
54 | 0 | return; |
55 | 0 | } |
56 | 0 | #ifdef __clang__ |
57 | 0 | #pragma clang diagnostic pop |
58 | 0 | #endif // __clang__ |
59 | 0 | rvalDecl = rval; |
60 | 0 | aRetVal.set(rvalDecl); |
61 | 0 | } |
62 | | |
63 | | |
64 | | |
65 | | void |
66 | | VoidFunction::Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv) |
67 | 0 | { |
68 | 0 | JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue()); |
69 | 0 |
|
70 | 0 | JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback)); |
71 | 0 | if (!JS::Call(cx, aThisVal, callable, |
72 | 0 | JS::HandleValueArray::empty(), &rval)) { |
73 | 0 | aRv.NoteJSContextException(cx); |
74 | 0 | return; |
75 | 0 | } |
76 | 0 | } |
77 | | |
78 | | |
79 | | |
80 | | namespace binding_detail { |
81 | | } // namespace binding_detail |
82 | | |
83 | | |
84 | | namespace binding_detail { |
85 | | } // namespace binding_detail |
86 | | |
87 | | |
88 | | } // namespace dom |
89 | | } // namespace mozilla |