2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef InspectorRuntimeAgent_h
33 #define InspectorRuntimeAgent_h
37 #include "InspectorJSBackendDispatchers.h"
38 #include "InspectorJSFrontendDispatchers.h"
39 #include "inspector/InspectorAgentBase.h"
40 #include <wtf/Forward.h>
41 #include <wtf/Noncopyable.h>
50 class InjectedScriptManager
;
52 class ScriptDebugServer
;
53 typedef String ErrorString
;
55 class JS_EXPORT_PRIVATE InspectorRuntimeAgent
: public InspectorAgentBase
, public InspectorRuntimeBackendDispatcherHandler
{
56 WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent
);
58 virtual ~InspectorRuntimeAgent();
60 virtual void enable(ErrorString
*) override
{ m_enabled
= true; }
61 virtual void disable(ErrorString
*) override
{ m_enabled
= false; }
62 virtual void parse(ErrorString
*, const String
& expression
, Inspector::TypeBuilder::Runtime::SyntaxErrorType::Enum
* result
, Inspector::TypeBuilder::OptOutput
<String
>* message
, RefPtr
<Inspector::TypeBuilder::Runtime::ErrorRange
>&) override final
;
63 virtual void evaluate(ErrorString
*, const String
& expression
, const String
* objectGroup
, const bool* includeCommandLineAPI
, const bool* doNotPauseOnExceptionsAndMuteConsole
, const int* executionContextId
, const bool* returnByValue
, const bool* generatePreview
, RefPtr
<Inspector::TypeBuilder::Runtime::RemoteObject
>& result
, Inspector::TypeBuilder::OptOutput
<bool>* wasThrown
) override final
;
64 virtual void callFunctionOn(ErrorString
*, const String
& objectId
, const String
& expression
, const RefPtr
<Inspector::InspectorArray
>* optionalArguments
, const bool* doNotPauseOnExceptionsAndMuteConsole
, const bool* returnByValue
, const bool* generatePreview
, RefPtr
<Inspector::TypeBuilder::Runtime::RemoteObject
>& result
, Inspector::TypeBuilder::OptOutput
<bool>* wasThrown
) override final
;
65 virtual void releaseObject(ErrorString
*, const ErrorString
& objectId
) override final
;
66 virtual void getProperties(ErrorString
*, const String
& objectId
, const bool* ownProperties
, RefPtr
<Inspector::TypeBuilder::Array
<Inspector::TypeBuilder::Runtime::PropertyDescriptor
>>& result
, RefPtr
<Inspector::TypeBuilder::Array
<Inspector::TypeBuilder::Runtime::InternalPropertyDescriptor
>>& internalProperties
) override final
;
67 virtual void releaseObjectGroup(ErrorString
*, const String
& objectGroup
) override final
;
68 virtual void run(ErrorString
*) override
;
70 void setScriptDebugServer(ScriptDebugServer
* scriptDebugServer
) { m_scriptDebugServer
= scriptDebugServer
; }
72 bool enabled() const { return m_enabled
; }
75 InspectorRuntimeAgent(InjectedScriptManager
*);
77 InjectedScriptManager
* injectedScriptManager() { return m_injectedScriptManager
; }
79 virtual JSC::VM
& globalVM() = 0;
80 virtual InjectedScript
injectedScriptForEval(ErrorString
*, const int* executionContextId
) = 0;
82 virtual void muteConsole() = 0;
83 virtual void unmuteConsole() = 0;
86 InjectedScriptManager
* m_injectedScriptManager
;
87 ScriptDebugServer
* m_scriptDebugServer
;
91 } // namespace Inspector
93 #endif // ENABLE(INSPECTOR)
94 #endif // InspectorRuntimeAgent_h