OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "platform/v8_inspector/public/V8RuntimeAgent.h" | 33 #include "platform/v8_inspector/public/V8RuntimeAgent.h" |
34 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
35 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
38 #include <v8.h> | 38 #include <v8.h> |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class V8EventListenerInfo; | 42 class V8EventListenerInfo; |
43 class JSONValue; | |
44 class V8DebuggerImpl; | 43 class V8DebuggerImpl; |
45 class V8DebuggerAgentImpl; | 44 class V8DebuggerAgentImpl; |
46 | 45 |
| 46 namespace protocol { |
| 47 class DictionaryValue; |
| 48 } |
| 49 |
47 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by
the inspector, | 50 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by
the inspector, |
48 // a reference to the InjectedScriptHost may be leaked to the page being inspect
ed. Thus, the | 51 // a reference to the InjectedScriptHost may be leaked to the page being inspect
ed. Thus, the |
49 // InjectedScriptHost must never implemment methods that have more power over th
e page than the | 52 // InjectedScriptHost must never implemment methods that have more power over th
e page than the |
50 // page already has itself (e.g. origin restriction bypasses). | 53 // page already has itself (e.g. origin restriction bypasses). |
51 | 54 |
52 class InjectedScriptHost : public RefCounted<InjectedScriptHost> { | 55 class InjectedScriptHost : public RefCounted<InjectedScriptHost> { |
53 public: | 56 public: |
54 static PassRefPtr<InjectedScriptHost> create(V8DebuggerImpl*); | 57 static PassRefPtr<InjectedScriptHost> create(V8DebuggerImpl*); |
55 ~InjectedScriptHost(); | 58 ~InjectedScriptHost(); |
56 | 59 |
57 void setClearConsoleCallback(PassOwnPtr<V8RuntimeAgent::ClearConsoleCallback
>); | 60 void setClearConsoleCallback(PassOwnPtr<V8RuntimeAgent::ClearConsoleCallback
>); |
58 void setInspectObjectCallback(PassOwnPtr<V8RuntimeAgent::InspectCallback>); | 61 void setInspectObjectCallback(PassOwnPtr<V8RuntimeAgent::InspectCallback>); |
59 void setDebuggerAgent(V8DebuggerAgentImpl* debuggerAgent) { m_debuggerAgent
= debuggerAgent; } | 62 void setDebuggerAgent(V8DebuggerAgentImpl* debuggerAgent) { m_debuggerAgent
= debuggerAgent; } |
60 | 63 |
61 void disconnect(); | 64 void disconnect(); |
62 | 65 |
63 void addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspectable>); | 66 void addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspectable>); |
64 void clearInspectedObjects(); | 67 void clearInspectedObjects(); |
65 V8RuntimeAgent::Inspectable* inspectedObject(unsigned num); | 68 V8RuntimeAgent::Inspectable* inspectedObject(unsigned num); |
66 | 69 |
67 void inspectImpl(PassRefPtr<JSONValue> objectToInspect, PassRefPtr<JSONValue
> hints); | 70 void inspectImpl(PassRefPtr<protocol::Value> objectToInspect, PassRefPtr<pro
tocol::Value> hints); |
68 | 71 |
69 void clearConsoleMessages(); | 72 void clearConsoleMessages(); |
70 void debugFunction(const String& scriptId, int lineNumber, int columnNumber)
; | 73 void debugFunction(const String& scriptId, int lineNumber, int columnNumber)
; |
71 void undebugFunction(const String& scriptId, int lineNumber, int columnNumbe
r); | 74 void undebugFunction(const String& scriptId, int lineNumber, int columnNumbe
r); |
72 void monitorFunction(const String& scriptId, int lineNumber, int columnNumbe
r, const String& functionName); | 75 void monitorFunction(const String& scriptId, int lineNumber, int columnNumbe
r, const String& functionName); |
73 void unmonitorFunction(const String& scriptId, int lineNumber, int columnNum
ber); | 76 void unmonitorFunction(const String& scriptId, int lineNumber, int columnNum
ber); |
74 | 77 |
75 V8DebuggerImpl* debugger() { return m_debugger; } | 78 V8DebuggerImpl* debugger() { return m_debugger; } |
76 | 79 |
77 // FIXME: store this template in per isolate data | 80 // FIXME: store this template in per isolate data |
78 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8:
:Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } | 81 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8:
:Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } |
79 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu
rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } | 82 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu
rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } |
80 | 83 |
81 private: | 84 private: |
82 InjectedScriptHost(V8DebuggerImpl*); | 85 InjectedScriptHost(V8DebuggerImpl*); |
83 | 86 |
84 V8DebuggerImpl* m_debugger; | 87 V8DebuggerImpl* m_debugger; |
85 V8DebuggerAgentImpl* m_debuggerAgent; | 88 V8DebuggerAgentImpl* m_debuggerAgent; |
86 OwnPtr<V8RuntimeAgent::InspectCallback> m_inspectCallback; | 89 OwnPtr<V8RuntimeAgent::InspectCallback> m_inspectCallback; |
87 OwnPtr<V8RuntimeAgent::ClearConsoleCallback> m_clearConsoleCallback; | 90 OwnPtr<V8RuntimeAgent::ClearConsoleCallback> m_clearConsoleCallback; |
88 Vector<OwnPtr<V8RuntimeAgent::Inspectable>> m_inspectedObjects; | 91 Vector<OwnPtr<V8RuntimeAgent::Inspectable>> m_inspectedObjects; |
89 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; | 92 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; |
90 }; | 93 }; |
91 | 94 |
92 } // namespace blink | 95 } // namespace blink |
93 | 96 |
94 #endif // InjectedScriptHost_h | 97 #endif // InjectedScriptHost_h |
OLD | NEW |