[SM91] Update to Spidermonkey 91.1.3 APIs
[0ad.git] / libraries / source / spidermonkey / include-win32-debug / jspubtd.h
blob3855695d06d4fe7d89544613b403ac4d6b0ebc7a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef jspubtd_h
8 #define jspubtd_h
11 * JS public API typedefs.
14 #include "jstypes.h"
16 #include "js/ProtoKey.h"
17 #include "js/Result.h"
18 #include "js/TraceKind.h"
19 #include "js/TypeDecls.h"
21 #if defined(JS_GC_ZEAL) || defined(DEBUG)
22 # define JSGC_HASH_TABLE_CHECKS
23 #endif
25 namespace JS {
27 class CallArgs;
29 class JS_PUBLIC_API RealmOptions;
31 } // namespace JS
33 /* Result of typeof operator enumeration. */
34 enum JSType {
35 JSTYPE_UNDEFINED, /* undefined */
36 JSTYPE_OBJECT, /* object */
37 JSTYPE_FUNCTION, /* function */
38 JSTYPE_STRING, /* string */
39 JSTYPE_NUMBER, /* number */
40 JSTYPE_BOOLEAN, /* boolean */
41 JSTYPE_NULL, /* null */
42 JSTYPE_SYMBOL, /* symbol */
43 JSTYPE_BIGINT, /* BigInt */
44 JSTYPE_LIMIT
47 /* Dense index into cached prototypes and class atoms for standard objects. */
48 enum JSProtoKey {
49 #define PROTOKEY_AND_INITIALIZER(name, clasp) JSProto_##name,
50 JS_FOR_EACH_PROTOTYPE(PROTOKEY_AND_INITIALIZER)
51 #undef PROTOKEY_AND_INITIALIZER
52 JSProto_LIMIT
55 /* Struct forward declarations. */
56 struct JSClass;
57 class JSErrorReport;
58 struct JSFunctionSpec;
59 struct JSPrincipals;
60 struct JSPropertySpec;
61 struct JSSecurityCallbacks;
62 struct JSStructuredCloneCallbacks;
63 struct JSStructuredCloneReader;
64 struct JSStructuredCloneWriter;
65 class JS_PUBLIC_API JSTracer;
67 class JSLinearString;
69 template <typename T>
70 struct JSConstScalarSpec;
71 using JSConstDoubleSpec = JSConstScalarSpec<double>;
72 using JSConstIntegerSpec = JSConstScalarSpec<int32_t>;
74 namespace js {
76 inline JS::Realm* GetContextRealm(const JSContext* cx);
77 inline JS::Compartment* GetContextCompartment(const JSContext* cx);
78 inline JS::Zone* GetContextZone(const JSContext* cx);
80 // Whether the current thread is permitted access to any part of the specified
81 // runtime or zone.
82 JS_PUBLIC_API bool CurrentThreadCanAccessRuntime(const JSRuntime* rt);
84 #ifdef DEBUG
85 JS_PUBLIC_API bool CurrentThreadIsPerformingGC();
86 #endif
88 } // namespace js
90 namespace JS {
92 class JS_PUBLIC_API PropertyDescriptor;
94 // Decorates the Unlinking phase of CycleCollection so that accidental use
95 // of barriered accessors results in assertions instead of leaks.
96 class MOZ_STACK_CLASS JS_PUBLIC_API AutoEnterCycleCollection {
97 #ifdef DEBUG
98 JSRuntime* runtime_;
100 public:
101 explicit AutoEnterCycleCollection(JSRuntime* rt);
102 ~AutoEnterCycleCollection();
103 #else
104 public:
105 explicit AutoEnterCycleCollection(JSRuntime* rt) {}
106 ~AutoEnterCycleCollection() {}
107 #endif
110 } /* namespace JS */
112 extern "C" {
114 // Defined in NSPR prio.h.
115 using PRFileDesc = struct PRFileDesc;
118 #endif /* jspubtd_h */