diff --git a/CefSharp/ScriptCore.cpp b/CefSharp/ScriptCore.cpp index 5b0830f8a..47d22bfb7 100644 --- a/CefSharp/ScriptCore.cpp +++ b/CefSharp/ScriptCore.cpp @@ -31,21 +31,6 @@ namespace CefSharp } } - void ScriptCore::UIT_Evaluate(CefRefPtr browser, CefString script) - { - CefRefPtr mainFrame; - if (TryGetMainFrame(browser, mainFrame)) - { - // TODO: fails, most likely because we are not in the render process. - } - else - { - _exceptionMessage = "Failed to obtain reference to main frame"; - } - - SetEvent(_event); - } - void ScriptCore::Execute(CefRefPtr browser, CefString script) { if (CefCurrentlyOn(TID_UI)) @@ -54,42 +39,7 @@ namespace CefSharp } else { - CefPostTask(TID_UI, NewCefRunnableMethod(this, &ScriptCore::UIT_Execute, - browser, script)); - } - } - - gcroot ScriptCore::Evaluate(CefRefPtr browser, CefString script, DWORD timeout) - { - AutoLock lock_scope(this); - _result = nullptr; - _exceptionMessage = nullptr; - - if (CefCurrentlyOn(TID_UI)) - { - UIT_Evaluate(browser, script); - } - else - { - CefPostTask(TID_UI, NewCefRunnableMethod(this, &ScriptCore::UIT_Evaluate, browser, script)); - } - - switch (WaitForSingleObject(_event, timeout)) - { - case WAIT_TIMEOUT: - throw gcnew ScriptException("Script timed out"); - case WAIT_ABANDONED: - case WAIT_FAILED: - throw gcnew ScriptException("Script error"); - } - - if (_exceptionMessage) - { - throw gcnew ScriptException(_exceptionMessage); - } - else - { - return _result; + CefPostTask(TID_UI, NewCefRunnableMethod(this, &ScriptCore::UIT_Execute, browser, script)); } } } \ No newline at end of file diff --git a/CefSharp/ScriptCore.h b/CefSharp/ScriptCore.h index f2e7fa688..58abf27a8 100644 --- a/CefSharp/ScriptCore.h +++ b/CefSharp/ScriptCore.h @@ -18,7 +18,6 @@ namespace CefSharp bool TryGetMainFrame(CefRefPtr browser, CefRefPtr& frame); void UIT_Execute(CefRefPtr browser, CefString script); - void UIT_Evaluate(CefRefPtr browser, CefString script); public: ScriptCore() @@ -27,7 +26,6 @@ namespace CefSharp } DECL void Execute(CefRefPtr browser, CefString script); - DECL gcroot Evaluate(CefRefPtr browser, CefString script, DWORD timeout); IMPLEMENT_LOCKING(ScriptCore); IMPLEMENT_REFCOUNTING(ScriptCore);