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