| 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 "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 |
| 15 |
|
| 16 |
class JS_PUBLIC_API JSObject; |
| 17 |
struct JSFunctionSpec; |
| 18 |
struct JSPropertySpec; |
| 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 |
SCRIPT_SLOT, |
| 35 |
OWNER_SLOT, |
| 36 |
|
| 37 |
RESERVED_SLOTS, |
| 38 |
}; |
| 39 |
|
| 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); |
| 45 |
|
| 46 |
void trace(JSTracer* trc); |
| 47 |
|
| 48 |
using ReferentVariant = DebuggerScriptReferent; |
| 49 |
|
| 50 |
inline gc::Cell* getReferentCell() const; |
| 51 |
inline js::BaseScript* getReferentScript() const; |
| 52 |
inline DebuggerScriptReferent getReferent() const; |
| 53 |
|
| 54 |
void clearReferent() { clearReservedSlotGCThingAsPrivate(SCRIPT_SLOT); } |
| 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 |
Debugger* owner() const; |
| 63 |
|
| 64 |
private: |
| 65 |
static const JSClassOps classOps_; |
| 66 |
|
| 67 |
static const JSPropertySpec properties_[]; |
| 68 |
static const JSFunctionSpec methods_[]; |
| 69 |
|
| 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; |
| 81 |
}; |
| 82 |
|
| 83 |
} /* namespace js */ |
| 84 |
|
| 85 |
#endif /* debugger_Script_h */ |