@@ -98,11 +98,32 @@ namespace v8_inspector {
98
98
}
99
99
}
100
100
}
101
+
101
102
*out_root = std::move (defaultNode);
102
103
}
103
104
104
- void V8DOMAgentImpl::removeNode (ErrorString*, int in_nodeId) {
105
- // TODO: Pete: call modules' View class methods to remove view from parent view
105
+ void V8DOMAgentImpl::removeNode (ErrorString *errorString, int in_nodeId) {
106
+ auto removeNodeFunctionString = " removeNode" ;
107
+ // TODO: Pete: Find a better way to get a hold of the isolate
108
+ auto isolate = v8::Isolate::GetCurrent ();
109
+ auto context = isolate->GetCurrentContext ();
110
+ auto global = context->Global ();
111
+
112
+ auto globalInspectorObject = utils::Common::getGlobalInspectorObject (isolate);
113
+
114
+ if (!globalInspectorObject.IsEmpty ()) {
115
+ auto removeNode = globalInspectorObject->Get (ArgConverter::ConvertToV8String (isolate, removeNodeFunctionString));
116
+
117
+ if (!removeNode.IsEmpty () && removeNode->IsFunction ()) {
118
+ auto removeNodeFunc = removeNode.As <v8::Function>();
119
+ v8::Local<v8::Value> args[] = { v8::Number::New (isolate, in_nodeId) };
120
+ removeNodeFunc->Call (context, global, 1 , args);
121
+
122
+ return ;
123
+ }
124
+ }
125
+
126
+ *errorString = " Couldn't remove the selected DOMNode from the visual tree." ;
106
127
}
107
128
108
129
// Pete: return empty resolved object - prevents crashes when opening the 'properties', 'event listeners' tabs
@@ -114,8 +135,6 @@ namespace v8_inspector {
114
135
*out_object = std::move (resolvedNode);
115
136
}
116
137
117
- V8DOMAgentImpl* V8DOMAgentImpl::Instance = 0 ;
118
-
119
138
void V8DOMAgentImpl::setAttributeValue (ErrorString *, int in_nodeId, const String &in_name,
120
139
const String &in_value) {
121
140
// TODO: Pete: call modules' View class methods to set view's attribute
@@ -156,4 +175,6 @@ namespace v8_inspector {
156
175
void V8DOMAgentImpl::hideHighlight (ErrorString *) {
157
176
158
177
}
178
+
179
+ V8DOMAgentImpl* V8DOMAgentImpl::Instance = 0 ;
159
180
}
0 commit comments