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 26 matching lines...) Expand all Loading... |
37 #include "core/inspector/InjectedScriptNative.h" | 37 #include "core/inspector/InjectedScriptNative.h" |
38 #include "wtf/Allocator.h" | 38 #include "wtf/Allocator.h" |
39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
40 #include <v8.h> | 40 #include <v8.h> |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 class JSONValue; | 44 class JSONValue; |
45 class RemoteObjectId; | 45 class RemoteObjectId; |
46 class ScriptFunctionCall; | 46 class ScriptFunctionCall; |
| 47 class V8DebuggerClient; |
47 | 48 |
48 typedef String ErrorString; | 49 typedef String ErrorString; |
49 PassRefPtr<JSONValue> toJSONValue(const ScriptValue&); | |
50 | 50 |
51 class InjectedScript final { | 51 class InjectedScript final { |
52 USING_FAST_MALLOC(InjectedScript); | 52 USING_FAST_MALLOC(InjectedScript); |
53 public: | 53 public: |
54 InjectedScript(); | |
55 ~InjectedScript(); | 54 ~InjectedScript(); |
56 | 55 |
57 ScriptState* scriptState() const | 56 ScriptState* scriptState() const |
58 { | 57 { |
59 return m_injectedScriptObject.scriptState(); | 58 return m_injectedScriptObject.scriptState(); |
60 } | 59 } |
61 | 60 |
62 void evaluate( | 61 void evaluate( |
63 ErrorString*, | 62 ErrorString*, |
64 const String& expression, | 63 const String& expression, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; | 107 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; |
109 | 108 |
110 String objectIdToObjectGroupName(const String& objectId) const; | 109 String objectIdToObjectGroupName(const String& objectId) const; |
111 void releaseObjectGroup(const String&); | 110 void releaseObjectGroup(const String&); |
112 | 111 |
113 void setCustomObjectFormatterEnabled(bool); | 112 void setCustomObjectFormatterEnabled(bool); |
114 int contextId() { return m_contextId; } | 113 int contextId() { return m_contextId; } |
115 | 114 |
116 private: | 115 private: |
117 friend InjectedScript* InjectedScriptManager::injectedScriptFor(ScriptState*
); | 116 friend InjectedScript* InjectedScriptManager::injectedScriptFor(ScriptState*
); |
118 using InspectedStateAccessCheck = bool (*)(ScriptState*); | 117 InjectedScript(ScriptValue, V8DebuggerClient*, PassRefPtr<InjectedScriptNati
ve>, int contextId); |
119 InjectedScript(ScriptValue, InspectedStateAccessCheck, PassRefPtr<InjectedSc
riptNative>, int contextId); | |
120 | 118 |
121 void initialize(ScriptValue, InspectedStateAccessCheck); | |
122 bool canAccessInspectedWindow() const; | 119 bool canAccessInspectedWindow() const; |
123 const ScriptValue& injectedScriptObject() const; | 120 v8::Local<v8::Context> v8Context() const; |
124 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; | 121 v8::Local<v8::Value> v8Value() const; |
| 122 v8::Local<v8::Value> callFunctionWithEvalEnabled(ScriptFunctionCall&, bool&
hadException) const; |
125 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); | 123 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
126 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ
eBuilder::Debugger::ExceptionDetails>* = 0); | 124 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ
eBuilder::Debugger::ExceptionDetails>* = 0); |
127 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re
sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); | 125 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re
sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); |
128 | 126 |
| 127 v8::Isolate* m_isolate; |
129 ScriptValue m_injectedScriptObject; | 128 ScriptValue m_injectedScriptObject; |
130 InspectedStateAccessCheck m_inspectedStateAccessCheck; | 129 V8DebuggerClient* m_client; |
131 RefPtr<InjectedScriptNative> m_native; | 130 RefPtr<InjectedScriptNative> m_native; |
132 int m_contextId; | 131 int m_contextId; |
133 }; | 132 }; |
134 | 133 |
135 } // namespace blink | 134 } // namespace blink |
136 | 135 |
137 #endif | 136 #endif |
OLD | NEW |