Backed out changeset 4191b252db9b (bug 1886734) for causing build bustages @netwerk...
[gecko.git] / js / src / debugger / Script.h
blobf6ba5537242d6a7afb8463c62b6a96c7d977f997
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 debugger_Script_h
8 #define debugger_Script_h
10 #include "jstypes.h" // for JS_PUBLIC_API
11 #include "NamespaceImports.h" // for Value, HandleObject, CallArgs
12 #include "debugger/Debugger.h" // for DebuggerScriptReferent
13 #include "js/TypeDecls.h" // for Handle
14 #include "vm/NativeObject.h" // for NativeObject
16 class JS_PUBLIC_API JSObject;
17 struct JSFunctionSpec;
18 struct JSPropertySpec;
20 namespace js {
22 class BaseScript;
23 class GlobalObject;
25 namespace gc {
26 struct Cell;
29 class DebuggerScript : public NativeObject {
30 public:
31 static const JSClass class_;
33 enum {
34 SCRIPT_SLOT,
35 OWNER_SLOT,
37 RESERVED_SLOTS,
40 static NativeObject* initClass(JSContext* cx, Handle<GlobalObject*> global,
41 HandleObject debugCtor);
42 static DebuggerScript* create(JSContext* cx, HandleObject proto,
43 Handle<DebuggerScriptReferent> referent,
44 Handle<NativeObject*> debugger);
46 void trace(JSTracer* trc);
48 using ReferentVariant = DebuggerScriptReferent;
50 inline gc::Cell* getReferentCell() const;
51 inline js::BaseScript* getReferentScript() const;
52 inline DebuggerScriptReferent getReferent() const;
54 void clearReferent() { clearReservedSlotGCThingAsPrivate(SCRIPT_SLOT); }
56 static DebuggerScript* check(JSContext* cx, HandleValue v);
58 static bool construct(JSContext* cx, unsigned argc, Value* vp);
60 struct CallData;
62 Debugger* owner() const;
64 private:
65 static const JSClassOps classOps_;
67 static const JSPropertySpec properties_[];
68 static const JSFunctionSpec methods_[];
70 struct GetLineCountMatcher;
71 class GetSourceMatcher;
72 template <bool OnlyOffsets>
73 class GetPossibleBreakpointsMatcher;
74 class GetOffsetMetadataMatcher;
75 class GetOffsetLocationMatcher;
76 class GetAllColumnOffsetsMatcher;
77 class GetLineOffsetsMatcher;
78 struct SetBreakpointMatcher;
79 class ClearBreakpointMatcher;
80 class IsInCatchScopeMatcher;
83 } /* namespace js */
85 #endif /* debugger_Script_h */