| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class DictionaryValue; | 46 class DictionaryValue; |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 using protocol::Maybe; | 50 using protocol::Maybe; |
| 51 | 51 |
| 52 class InjectedScript final { | 52 class InjectedScript final { |
| 53 public: | 53 public: |
| 54 ~InjectedScript(); | 54 ~InjectedScript(); |
| 55 | 55 |
| 56 void callFunctionOn( | |
| 57 ErrorString*, | |
| 58 const String16& objectId, | |
| 59 const String16& expression, | |
| 60 const String16& arguments, | |
| 61 bool returnByValue, | |
| 62 bool generatePreview, | |
| 63 OwnPtr<protocol::Runtime::RemoteObject>* result, | |
| 64 Maybe<bool>* wasThrown); | |
| 65 void getFunctionDetails(ErrorString*, const String16& functionId, OwnPtr<pro
tocol::Debugger::FunctionDetails>* result); | 56 void getFunctionDetails(ErrorString*, const String16& functionId, OwnPtr<pro
tocol::Debugger::FunctionDetails>* result); |
| 66 void getCollectionEntries(ErrorString*, const String16& objectId, OwnPtr<pro
tocol::Array<protocol::Debugger::CollectionEntry>>* result); | 57 void getCollectionEntries(ErrorString*, const String16& objectId, OwnPtr<pro
tocol::Array<protocol::Debugger::CollectionEntry>>* result); |
| 67 void getProperties(ErrorString*, const String16& objectId, bool ownPropertie
s, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<protocol::Array<pro
tocol::Runtime::PropertyDescriptor>>* result, Maybe<protocol::Runtime::Exception
Details>*); | 58 void getProperties(ErrorString*, const String16& objectId, bool ownPropertie
s, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<protocol::Array<pro
tocol::Runtime::PropertyDescriptor>>* result, Maybe<protocol::Runtime::Exception
Details>*); |
| 68 void getInternalProperties(ErrorString*, const String16& objectId, Maybe<pro
tocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* result, Maybe<prot
ocol::Runtime::ExceptionDetails>*); | 59 void getInternalProperties(ErrorString*, const String16& objectId, Maybe<pro
tocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* result, Maybe<prot
ocol::Runtime::ExceptionDetails>*); |
| 69 void releaseObject(const String16& objectId); | 60 void releaseObject(const String16& objectId); |
| 70 | 61 |
| 71 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> wrapCallFrames(v8
::Local<v8::Object>); | 62 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> wrapCallFrames(v8
::Local<v8::Object>); |
| 72 | 63 |
| 73 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(ErrorString*, v8::Loc
al<v8::Value>, const String16& groupName, bool forceValueType = false, bool gene
ratePreview = false) const; | 64 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(ErrorString*, v8::Loc
al<v8::Value>, const String16& groupName, bool forceValueType = false, bool gene
ratePreview = false) const; |
| 74 bool wrapObjectProperty(ErrorString*, v8::Local<v8::Object>, v8::Local<v8::V
alue> key, const String16& groupName, bool forceValueType = false, bool generate
Preview = false) const; | 65 bool wrapObjectProperty(ErrorString*, v8::Local<v8::Object>, v8::Local<v8::V
alue> key, const String16& groupName, bool forceValueType = false, bool generate
Preview = false) const; |
| 75 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value> t
able, v8::Local<v8::Value> columns) const; | 66 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value> t
able, v8::Local<v8::Value> columns) const; |
| 76 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; | 67 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; |
| 77 String16 objectGroupName(const RemoteObjectId&) const; | 68 String16 objectGroupName(const RemoteObjectId&) const; |
| 78 void releaseObjectGroup(const String16&); | 69 void releaseObjectGroup(const String16&); |
| 79 | 70 |
| 80 void setCustomObjectFormatterEnabled(bool); | 71 void setCustomObjectFormatterEnabled(bool); |
| 81 int contextId() { return m_contextId; } | 72 int contextId() { return m_contextId; } |
| 82 String16 origin() const { return m_origin; } | 73 String16 origin() const { return m_origin; } |
| 83 void setOrigin(const String16& origin) { m_origin = origin; } | 74 void setOrigin(const String16& origin) { m_origin = origin; } |
| 84 | 75 |
| 85 v8::Isolate* isolate() { return m_isolate; } | 76 v8::Isolate* isolate() { return m_isolate; } |
| 86 v8::Local<v8::Context> context() const; | 77 v8::Local<v8::Context> context() const; |
| 87 void dispose(); | 78 void dispose(); |
| 88 bool canAccessInspectedWindow() const; | 79 bool canAccessInspectedWindow() const; |
| 89 | 80 |
| 90 bool setLastEvaluationResult(ErrorString*, v8::Local<v8::Value>); | 81 bool setLastEvaluationResult(ErrorString*, v8::Local<v8::Value>); |
| 91 v8::MaybeLocal<v8::Value> resolveCallArgument(ErrorString*, protocol::Runtim
e::CallArgument*); | 82 v8::MaybeLocal<v8::Value> resolveCallArgument(ErrorString*, protocol::Runtim
e::CallArgument*); |
| 92 | 83 |
| 93 v8::MaybeLocal<v8::Object> commandLineAPI(ErrorString*); | 84 v8::MaybeLocal<v8::Object> commandLineAPI(ErrorString*) const; |
| 85 v8::MaybeLocal<v8::Object> remoteObjectAPI(ErrorString*, const String16& gro
upName) const; |
| 94 | 86 |
| 95 PassOwnPtr<protocol::Runtime::ExceptionDetails> createExceptionDetails(v8::L
ocal<v8::Message>); | 87 PassOwnPtr<protocol::Runtime::ExceptionDetails> createExceptionDetails(v8::L
ocal<v8::Message>); |
| 96 void wrapEvaluateResult(ErrorString*, | 88 void wrapEvaluateResult(ErrorString*, |
| 97 v8::MaybeLocal<v8::Value> maybeResultValue, | 89 v8::MaybeLocal<v8::Value> maybeResultValue, |
| 98 const v8::TryCatch&, | 90 const v8::TryCatch&, |
| 99 const String16& objectGroup, | 91 const String16& objectGroup, |
| 100 bool returnByValue, | 92 bool returnByValue, |
| 101 bool generatePreview, | 93 bool generatePreview, |
| 102 OwnPtr<protocol::Runtime::RemoteObject>* result, | 94 OwnPtr<protocol::Runtime::RemoteObject>* result, |
| 103 Maybe<bool>* wasThrown, | 95 Maybe<bool>* wasThrown, |
| 104 Maybe<protocol::Runtime::ExceptionDetails>*); | 96 Maybe<protocol::Runtime::ExceptionDetails>*); |
| 105 | 97 |
| 106 private: | 98 private: |
| 107 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8
::Context>); | 99 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8
::Context>); |
| 108 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8:
:Object>, PassOwnPtr<InjectedScriptNative>, int contextId); | 100 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8:
:Object>, PassOwnPtr<InjectedScriptNative>, int contextId); |
| 109 | 101 |
| 110 v8::Local<v8::Value> v8Value() const; | 102 v8::Local<v8::Value> v8Value() const; |
| 111 v8::Local<v8::Value> callFunctionWithEvalEnabled(V8FunctionCall&, bool& hadE
xception) const; | 103 v8::Local<v8::Value> callFunctionWithEvalEnabled(V8FunctionCall&, bool& hadE
xception) const; |
| 112 PassOwnPtr<protocol::Value> makeCall(V8FunctionCall&); | 104 PassOwnPtr<protocol::Value> makeCall(V8FunctionCall&); |
| 113 PassOwnPtr<protocol::Runtime::RemoteObject> makeEvalCall(ErrorString*, V8Fun
ctionCall&, Maybe<bool>* wasThrown); | |
| 114 PassOwnPtr<protocol::Value> makeCallWithExceptionDetails(V8FunctionCall&, Ma
ybe<protocol::Runtime::ExceptionDetails>*); | 105 PassOwnPtr<protocol::Value> makeCallWithExceptionDetails(V8FunctionCall&, Ma
ybe<protocol::Runtime::ExceptionDetails>*); |
| 115 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; | 106 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; |
| 107 v8::MaybeLocal<v8::Object> callFunctionReturnObject(ErrorString*, V8Function
Call&) const; |
| 116 | 108 |
| 117 InjectedScriptManager* m_manager; | 109 InjectedScriptManager* m_manager; |
| 118 v8::Isolate* m_isolate; | 110 v8::Isolate* m_isolate; |
| 119 v8::Global<v8::Context> m_context; | 111 v8::Global<v8::Context> m_context; |
| 120 v8::Global<v8::Value> m_value; | 112 v8::Global<v8::Value> m_value; |
| 121 OwnPtr<InjectedScriptNative> m_native; | 113 OwnPtr<InjectedScriptNative> m_native; |
| 122 int m_contextId; | 114 int m_contextId; |
| 123 String16 m_origin; | 115 String16 m_origin; |
| 124 }; | 116 }; |
| 125 | 117 |
| 126 } // namespace blink | 118 } // namespace blink |
| 127 | 119 |
| 128 #endif | 120 #endif |
| OLD | NEW |