MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / OnExecuteScript

Method OnExecuteScript

cpp/iedriver/AsyncScriptExecutor.cpp:176–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176LRESULT AsyncScriptExecutor::OnExecuteScript(UINT uMsg,
177 WPARAM wParam,
178 LPARAM lParam,
179 BOOL& bHandled) {
180 LOG(TRACE) << "Entering AsyncScriptExecutor::OnExecuteScript";
181 Script script_to_execute(this->script_host_,
182 this->script_source_code_,
183 this->script_argument_count_);
184 this->status_code_ = script_to_execute.AddArguments(this,
185 this->script_args_);
186
187 if (this->status_code_ == WD_SUCCESS) {
188 this->status_code_ = script_to_execute.Execute();
189 }
190
191 if (!this->is_listener_attached_) {
192 ::PostMessage(this->m_hWnd, WM_CLOSE, NULL, NULL);
193 } else {
194 if (this->status_code_ == WD_SUCCESS) {
195 if (this->polling_script_source_code_.size() > 0) {
196 bool polling_script_succeeded = this->WaitForPollingScript();
197 if (!polling_script_succeeded) {
198 // The polling script either detected a page reload, or it timed out.
199 // In either case, this script execution is completed.
200 this->is_execution_completed_ = true;
201 return 0;
202 }
203 } else {
204 this->status_code_ = script_to_execute.ConvertResultToJsonValue(this,
205 &this->script_result_);
206 }
207 if (this->element_id_list_.size() > 0) {
208 // There are newly discovered elements to be managed, and they
209 // need to be marshaled back to the main executor thread. Note
210 // that we return without setting execution complete, because
211 // execution isn't done until the marshalling is done.
212 TransferReturnedElements();
213 return 0;
214 }
215 } else {
216 if (script_to_execute.ResultIsString()) {
217 script_to_execute.ConvertResultToJsonValue(this,
218 &this->script_result_);
219 }
220 }
221 }
222 this->is_execution_completed_ = true;
223 return 0;
224}
225
226LRESULT AsyncScriptExecutor::OnDetachListener(UINT uMsg,
227 WPARAM wParam,

Callers

nothing calls this directly

Calls 7

WaitForPollingScriptMethod · 0.95
ResultIsStringMethod · 0.80
LOGClass · 0.50
AddArgumentsMethod · 0.45
ExecuteMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected