| 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 dbg_Source_h |
| 8 |
#define dbg_Source_h |
| 9 |
|
| 10 |
#include "NamespaceImports.h" // for Value, HandleObject, CallArgs |
| 11 |
#include "debugger/Debugger.h" // for DebuggerSourceReferent |
| 12 |
#include "vm/NativeObject.h" // for NativeObject |
| 13 |
|
| 14 |
namespace js { |
| 15 |
class GlobalObject; |
| 16 |
} |
| 17 |
|
| 18 |
namespace js { |
| 19 |
|
| 20 |
class DebuggerSource : public NativeObject { |
| 21 |
public: |
| 22 |
static const JSClass class_; |
| 23 |
|
| 24 |
enum { |
| 25 |
SOURCE_SLOT, |
| 26 |
OWNER_SLOT, |
| 27 |
TEXT_SLOT, |
| 28 |
RESERVED_SLOTS, |
| 29 |
}; |
| 30 |
|
| 31 |
static NativeObject* initClass(JSContext* cx, Handle<GlobalObject*> global, |
| 32 |
HandleObject debugCtor); |
| 33 |
static DebuggerSource* create(JSContext* cx, HandleObject proto, |
| 34 |
Handle<DebuggerSourceReferent> referent, |
| 35 |
Handle<NativeObject*> debugger); |
| 36 |
|
| 37 |
void trace(JSTracer* trc); |
| 38 |
|
| 39 |
using ReferentVariant = DebuggerSourceReferent; |
| 40 |
|
| 41 |
NativeObject* getReferentRawObject() const; |
| 42 |
DebuggerSourceReferent getReferent() const; |
| 43 |
|
| 44 |
void clearReferent() { clearReservedSlotGCThingAsPrivate(SOURCE_SLOT); } |
| 45 |
|
| 46 |
static DebuggerSource* check(JSContext* cx, HandleValue v); |
| 47 |
static bool construct(JSContext* cx, unsigned argc, Value* vp); |
| 48 |
|
| 49 |
struct CallData; |
| 50 |
|
| 51 |
Debugger* owner() const; |
| 52 |
|
| 53 |
private: |
| 54 |
static const JSClassOps classOps_; |
| 55 |
|
| 56 |
static const JSPropertySpec properties_[]; |
| 57 |
static const JSFunctionSpec methods_[]; |
| 58 |
}; |
| 59 |
|
| 60 |
} /* namespace js */ |
| 61 |
|
| 62 |
#endif /* dbg_Source_h */ |