| 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 28 matching lines...) Expand all Loading... |
| 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 | 47 |
| 48 typedef String ErrorString; | 48 typedef String ErrorString; |
| 49 PassRefPtr<JSONValue> toJSONValue(const ScriptValue&); | |
| 50 | 49 |
| 51 class InjectedScript final { | 50 class InjectedScript final { |
| 52 USING_FAST_MALLOC(InjectedScript); | 51 USING_FAST_MALLOC(InjectedScript); |
| 53 public: | 52 public: |
| 54 InjectedScript(); | |
| 55 ~InjectedScript(); | 53 ~InjectedScript(); |
| 56 | 54 |
| 57 ScriptState* scriptState() const | 55 ScriptState* scriptState() const |
| 58 { | 56 { |
| 59 return m_injectedScriptObject.scriptState(); | 57 return m_injectedScriptObject.scriptState(); |
| 60 } | 58 } |
| 61 | 59 |
| 62 void evaluate( | 60 void evaluate( |
| 63 ErrorString*, | 61 ErrorString*, |
| 64 const String& expression, | 62 const String& expression, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 void releaseObjectGroup(const String&); | 109 void releaseObjectGroup(const String&); |
| 112 | 110 |
| 113 void setCustomObjectFormatterEnabled(bool); | 111 void setCustomObjectFormatterEnabled(bool); |
| 114 int contextId() { return m_contextId; } | 112 int contextId() { return m_contextId; } |
| 115 | 113 |
| 116 private: | 114 private: |
| 117 friend InjectedScript* InjectedScriptManager::injectedScriptFor(ScriptState*
); | 115 friend InjectedScript* InjectedScriptManager::injectedScriptFor(ScriptState*
); |
| 118 using InspectedStateAccessCheck = bool (*)(ScriptState*); | 116 using InspectedStateAccessCheck = bool (*)(ScriptState*); |
| 119 InjectedScript(ScriptValue, InspectedStateAccessCheck, PassRefPtr<InjectedSc
riptNative>, int contextId); | 117 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 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
| 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 |