Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM StorageType.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "StorageTypeBinding.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 StorageTypeValues {
12 : extern const EnumEntry strings[4] = {
13 : {"persistent", 10},
14 : {"temporary", 9},
15 : {"default", 7},
16 : { nullptr, 0 }
17 : };
18 : } // namespace StorageTypeValues
19 :
20 : bool
21 0 : ToJSValue(JSContext* aCx, StorageType aArgument, JS::MutableHandle<JS::Value> aValue)
22 : {
23 0 : MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(StorageTypeValues::strings));
24 : JSString* resultStr =
25 0 : JS_NewStringCopyN(aCx, StorageTypeValues::strings[uint32_t(aArgument)].value,
26 0 : StorageTypeValues::strings[uint32_t(aArgument)].length);
27 0 : if (!resultStr) {
28 0 : return false;
29 : }
30 0 : aValue.setString(resultStr);
31 0 : return true;
32 : }
33 :
34 :
35 : } // namespace dom
36 : } // namespace mozilla
|