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