Source code

Revision control

Other Tools

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/. */
6
7
#ifndef debugger_Script_h
8
#define debugger_Script_h
9
10
#include "jsapi.h" // for Handle, JSFunctionSpec, JSPropertySpec
11
12
#include "jstypes.h" // for JS_PUBLIC_API
13
#include "NamespaceImports.h" // for Value, HandleObject, CallArgs
14
#include "debugger/Debugger.h" // for DebuggerScriptReferent
15
#include "gc/Rooting.h" // for HandleNativeObject
16
#include "vm/NativeObject.h" // for NativeObject
17
18
class JS_PUBLIC_API JSObject;
19
20
namespace js {
21
22
class BaseScript;
23
class GlobalObject;
24
25
namespace gc {
26
struct Cell;
27
}
28
29
class DebuggerScript : public NativeObject {
30
public:
31
static const JSClass class_;
32
33
enum {
34
OWNER_SLOT,
35
36
// Holds any instrumentation ID that has been assigned to the script.
37
INSTRUMENTATION_ID_SLOT,
38
39
RESERVED_SLOTS,
40
};
41
42
static NativeObject* initClass(JSContext* cx, Handle<GlobalObject*> global,
43
HandleObject debugCtor);
44
static DebuggerScript* create(JSContext* cx, HandleObject proto,
45
Handle<DebuggerScriptReferent> referent,
46
HandleNativeObject debugger);
47
48
void trace(JSTracer* trc);
49
50
using ReferentVariant = DebuggerScriptReferent;
51
52
inline gc::Cell* getReferentCell() const;
53
inline js::BaseScript* getReferentScript() const;
54
inline DebuggerScriptReferent getReferent() const;
55
56
static DebuggerScript* check(JSContext* cx, HandleValue v);
57
58
static bool construct(JSContext* cx, unsigned argc, Value* vp);
59
60
struct CallData;
61
62
template <typename T>
63
static bool getUrlImpl(JSContext* cx, const CallArgs& args,
64
Handle<T*> script);
65
66
static bool getSuccessorOrPredecessorOffsets(JSContext* cx, unsigned argc,
67
Value* vp, const char* name,
68
bool successor);
69
70
Value getInstrumentationId() const {
71
return getSlot(INSTRUMENTATION_ID_SLOT);
72
}
73
74
private:
75
static const JSClassOps classOps_;
76
77
static const JSPropertySpec properties_[];
78
static const JSFunctionSpec methods_[];
79
80
struct GetLineCountMatcher;
81
class GetSourceMatcher;
82
template <bool OnlyOffsets>
83
class GetPossibleBreakpointsMatcher;
84
class GetOffsetMetadataMatcher;
85
class GetOffsetLocationMatcher;
86
class GetSuccessorOrPredecessorOffsetsMatcher;
87
class GetAllColumnOffsetsMatcher;
88
class GetLineOffsetsMatcher;
89
struct SetBreakpointMatcher;
90
class ClearBreakpointMatcher;
91
class IsInCatchScopeMatcher;
92
};
93
94
} /* namespace js */
95
96
#endif /* debugger_Script_h */