Line data Source code
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 SocketReadyStateValues {
12 : extern const EnumEntry strings[6] = {
13 : {"opening", 7},
14 : {"open", 4},
15 : {"closing", 7},
16 : {"closed", 6},
17 : {"halfclosed", 10},
18 : { nullptr, 0 }
19 : };
20 : } // namespace SocketReadyStateValues
21 :
22 : bool
23 0 : ToJSValue(JSContext* aCx, SocketReadyState aArgument, JS::MutableHandle<JS::Value> aValue)
24 : {
25 0 : MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(SocketReadyStateValues::strings));
26 : JSString* resultStr =
27 0 : JS_NewStringCopyN(aCx, SocketReadyStateValues::strings[uint32_t(aArgument)].value,
28 0 : SocketReadyStateValues::strings[uint32_t(aArgument)].length);
29 0 : if (!resultStr) {
30 0 : return false;
31 : }
32 0 : aValue.setString(resultStr);
33 0 : return true;
34 : }
35 :
36 :
37 : } // namespace dom
38 : } // namespace mozilla
|