/work/obj-fuzz/dom/bindings/FileModeBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM FileMode.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "FileModeBinding.h" |
4 | | #include "jsapi.h" |
5 | | #include "mozilla/dom/BindingDeclarations.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 | | namespace FileModeValues { |
16 | | extern const EnumEntry strings[3] = { |
17 | | {"readonly", 8}, |
18 | | {"readwrite", 9}, |
19 | | { nullptr, 0 } |
20 | | }; |
21 | | } // namespace FileModeValues |
22 | | |
23 | | bool |
24 | | ToJSValue(JSContext* aCx, FileMode aArgument, JS::MutableHandle<JS::Value> aValue) |
25 | 0 | { |
26 | 0 | MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(FileModeValues::strings)); |
27 | 0 | JSString* resultStr = |
28 | 0 | JS_NewStringCopyN(aCx, FileModeValues::strings[uint32_t(aArgument)].value, |
29 | 0 | FileModeValues::strings[uint32_t(aArgument)].length); |
30 | 0 | if (!resultStr) { |
31 | 0 | return false; |
32 | 0 | } |
33 | 0 | aValue.setString(resultStr); |
34 | 0 | return true; |
35 | 0 | } |
36 | | |
37 | | |
38 | | } // namespace dom |
39 | | } // namespace mozilla |