OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef InjectedScript_h | 31 #ifndef InjectedScript_h |
32 #define InjectedScript_h | 32 #define InjectedScript_h |
33 | 33 |
34 #include "InspectorTypeBuilder.h" | 34 #include "InspectorTypeBuilder.h" |
| 35 #include "bindings/common/StackTrace.h" |
35 #include "bindings/v8/ScriptObject.h" | 36 #include "bindings/v8/ScriptObject.h" |
36 #include "core/inspector/InjectedScriptBase.h" | 37 #include "core/inspector/InjectedScriptBase.h" |
37 #include "core/inspector/InjectedScriptManager.h" | 38 #include "core/inspector/InjectedScriptManager.h" |
38 #include "core/inspector/ScriptArguments.h" | 39 #include "core/inspector/ScriptArguments.h" |
39 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
41 | 42 |
42 namespace WebCore { | 43 namespace WebCore { |
43 | 44 |
44 class InjectedScriptModule; | 45 class InjectedScriptModule; |
45 class Node; | 46 class Node; |
46 class SerializedScriptValue; | 47 class SerializedScriptValue; |
47 | 48 |
48 class InjectedScript FINAL : public InjectedScriptBase { | 49 class InjectedScript : public virtual InjectedScriptBase { |
49 public: | 50 public: |
50 InjectedScript(); | |
51 virtual ~InjectedScript() { } | 51 virtual ~InjectedScript() { } |
52 | 52 |
53 void evaluate( | 53 virtual void evaluate(ErrorString*, |
| 54 const String& expression, |
| 55 const String& objectGroup, |
| 56 bool includeCommandLineAPI, |
| 57 bool returnByValue, |
| 58 bool generatePreview, |
| 59 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
| 60 TypeBuilder::OptOutput<bool>* wasThrown) = 0; |
| 61 virtual void callFunctionOn(ErrorString*, |
| 62 const String& objectId, |
| 63 const String& expression, |
| 64 const String& arguments, |
| 65 bool returnByValue, |
| 66 bool generatePreview, |
| 67 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
| 68 TypeBuilder::OptOutput<bool>* wasThrown) = 0; |
| 69 virtual void evaluateOnCallFrame( |
| 70 ErrorString*, |
| 71 const StackTrace& callFrames, |
| 72 const Vector<StackTrace>& asyncCallStacks, |
| 73 const String& callFrameId, |
| 74 const String& expression, |
| 75 const String& objectGroup, |
| 76 bool includeCommandLineAPI, |
| 77 bool returnByValue, |
| 78 bool generatePreview, |
| 79 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
| 80 TypeBuilder::OptOutput<bool>* wasThrown) = 0; |
| 81 virtual void getCompletionsOnCallFrame( |
| 82 ErrorString*, |
| 83 const StackTrace& callFrames, |
| 84 const Vector<StackTrace>& asyncCallStacks, |
| 85 const String& callFrameId, |
| 86 const String& expression, |
| 87 RefPtr<TypeBuilder::Array<String> >* result) = 0; |
| 88 virtual void restartFrame(ErrorString*, const StackTrace& callFrames, const
String& callFrameId, RefPtr<JSONObject>* result) = 0; |
| 89 virtual void getStepInPositions(ErrorString*, const StackTrace& callFrames,
const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Loca
tion> >& positions) = 0; |
| 90 virtual void setVariableValue(ErrorString*, const StackTrace& callFrames, co
nst String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber,
const String& variableName, const String& newValueStr) = 0; |
| 91 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefP
tr<TypeBuilder::Debugger::FunctionDetails>* result) = 0; |
| 92 virtual void getCompletions(ErrorString*, const String& expression, RefPtr<T
ypeBuilder::Array<String> >* result) = 0; |
| 93 virtual void getProperties(ErrorString*, const String& objectId, bool ownPro
perties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Run
time::PropertyDescriptor> >* result) = 0; |
| 94 virtual void getInternalProperties(ErrorString*, const String& objectId, Ref
Ptr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* resu
lt) = 0; |
| 95 virtual void getProperty(ErrorString*, const String& objectId, const RefPtr<
JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, Ty
peBuilder::OptOutput<bool>* wasThrown) = 0; |
| 96 |
| 97 virtual Node* nodeForObjectId(const String& objectId) = 0; |
| 98 virtual void releaseObject(const String& objectId) = 0; |
| 99 |
| 100 virtual PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wr
apCallFrames(const StackTrace&, int asyncOrdinal) = 0; |
| 101 |
| 102 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const Scri
ptValue&, const String& groupName, bool generatePreview = false) = 0; |
| 103 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const Scrip
tValue& table, const ScriptValue& columns) = 0; |
| 104 |
| 105 virtual ActivationFrame findCallFrameById(ErrorString*, const StackTrace& to
pCallFrame, const String& callFrameId) = 0; |
| 106 |
| 107 virtual void releaseObjectGroup(const String&) = 0; |
| 108 }; |
| 109 |
| 110 class V8InjectedScript FINAL : public V8InjectedScriptBase, public InjectedScrip
t { |
| 111 public: |
| 112 V8InjectedScript(); |
| 113 virtual ~V8InjectedScript() { } |
| 114 |
| 115 virtual void evaluate( |
54 ErrorString*, | 116 ErrorString*, |
55 const String& expression, | 117 const String& expression, |
56 const String& objectGroup, | 118 const String& objectGroup, |
57 bool includeCommandLineAPI, | 119 bool includeCommandLineAPI, |
58 bool returnByValue, | 120 bool returnByValue, |
59 bool generatePreview, | 121 bool generatePreview, |
60 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 122 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
61 TypeBuilder::OptOutput<bool>* wasThrown); | 123 TypeBuilder::OptOutput<bool>* wasThrown); |
62 void callFunctionOn( | 124 virtual void callFunctionOn( |
63 ErrorString*, | 125 ErrorString*, |
64 const String& objectId, | 126 const String& objectId, |
65 const String& expression, | 127 const String& expression, |
66 const String& arguments, | 128 const String& arguments, |
67 bool returnByValue, | 129 bool returnByValue, |
68 bool generatePreview, | 130 bool generatePreview, |
69 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 131 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
70 TypeBuilder::OptOutput<bool>* wasThrown); | 132 TypeBuilder::OptOutput<bool>* wasThrown); |
71 void evaluateOnCallFrame( | 133 virtual void evaluateOnCallFrame( |
72 ErrorString*, | 134 ErrorString*, |
73 const ScriptValue& callFrames, | 135 const StackTrace& callFrames, |
74 const Vector<ScriptValue>& asyncCallStacks, | 136 const Vector<StackTrace>& asyncCallStacks, |
75 const String& callFrameId, | 137 const String& callFrameId, |
76 const String& expression, | 138 const String& expression, |
77 const String& objectGroup, | 139 const String& objectGroup, |
78 bool includeCommandLineAPI, | 140 bool includeCommandLineAPI, |
79 bool returnByValue, | 141 bool returnByValue, |
80 bool generatePreview, | 142 bool generatePreview, |
81 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 143 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
82 TypeBuilder::OptOutput<bool>* wasThrown); | 144 TypeBuilder::OptOutput<bool>* wasThrown); |
83 void restartFrame(ErrorString*, const ScriptValue& callFrames, const String&
callFrameId, RefPtr<JSONObject>* result); | 145 virtual void getCompletionsOnCallFrame( |
84 void getStepInPositions(ErrorString*, const ScriptValue& callFrames, const S
tring& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >
& positions); | 146 ErrorString*, |
85 void setVariableValue(ErrorString*, const ScriptValue& callFrames, const Str
ing* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const S
tring& variableName, const String& newValueStr); | 147 const StackTrace& callFrames, |
86 void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeB
uilder::Debugger::FunctionDetails>* result); | 148 const Vector<StackTrace>& asyncCallStacks, |
87 void getProperties(ErrorString*, const String& objectId, bool ownProperties,
bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::Pr
opertyDescriptor> >* result); | 149 const String& callFrameId, |
88 void getInternalProperties(ErrorString*, const String& objectId, RefPtr<Type
Builder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* result); | 150 const String& expression, |
89 Node* nodeForObjectId(const String& objectId); | 151 RefPtr<TypeBuilder::Array<String> >* result); |
90 void releaseObject(const String& objectId); | 152 virtual void restartFrame(ErrorString*, const StackTrace& callFrames, const
String& callFrameId, RefPtr<JSONObject>* result); |
| 153 virtual void getStepInPositions(ErrorString*, const StackTrace& callFrames,
const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Loca
tion> >& positions); |
| 154 virtual void setVariableValue(ErrorString*, const StackTrace& callFrames, co
nst String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber,
const String& variableName, const String& newValueStr); |
| 155 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefP
tr<TypeBuilder::Debugger::FunctionDetails>* result); |
| 156 virtual void getCompletions(ErrorString*, const String& expression, RefPtr<T
ypeBuilder::Array<String> >* out_result); |
| 157 virtual void getProperties(ErrorString*, const String& objectId, bool ownPro
perties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Run
time::PropertyDescriptor> >* result); |
| 158 virtual void getInternalProperties(ErrorString*, const String& objectId, Ref
Ptr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* resu
lt); |
| 159 virtual void getProperty(ErrorString*, const String& objectId, const RefPtr<
JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, Ty
peBuilder::OptOutput<bool>* wasThrown); |
| 160 virtual Node* nodeForObjectId(const String& objectId); |
| 161 virtual void releaseObject(const String& objectId); |
91 | 162 |
92 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wrapCallFr
ames(const ScriptValue&, int asyncOrdinal); | 163 virtual PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wr
apCallFrames(const StackTrace&, int asyncOrdinal); |
93 | 164 |
94 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const ScriptValue&
, const String& groupName, bool generatePreview = false) const; | 165 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const Scri
ptValue&, const String& groupName, bool generatePreview = false); |
95 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const ScriptValue&
table, const ScriptValue& columns) const; | 166 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const Scrip
tValue& table, const ScriptValue& columns); |
| 167 |
96 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String&
groupName); | 168 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String&
groupName); |
97 ScriptValue findObjectById(const String& objectId) const; | 169 ScriptValue findObjectById(const String& objectId) const; |
98 ScriptValue findCallFrameById(ErrorString*, const ScriptValue& topCallFrame,
const String& callFrameId); | 170 virtual ActivationFrame findCallFrameById(ErrorString*, const StackTrace& to
pCallFrame, const String& callFrameId); |
99 | 171 |
100 void inspectNode(Node*); | 172 void inspectNode(Node*); |
101 void releaseObjectGroup(const String&); | 173 virtual void releaseObjectGroup(const String&); |
102 | 174 |
103 private: | 175 private: |
104 friend class InjectedScriptModule; | 176 friend class InjectedScriptModule; |
105 friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*)
; | 177 friend InjectedScript& InjectedScriptManager::injectedScriptFor(ScriptState*
); |
106 InjectedScript(ScriptObject, InspectedStateAccessCheck); | 178 V8InjectedScript(ScriptObject, InspectedStateAccessCheck); |
107 | 179 |
108 ScriptValue nodeAsScriptValue(Node*); | 180 ScriptValue nodeAsScriptValue(Node*); |
109 }; | 181 }; |
110 | 182 |
111 | |
112 } // namespace WebCore | 183 } // namespace WebCore |
113 | 184 |
114 #endif | 185 #endif |
OLD | NEW |