mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 12:09:40 +00:00
ScriptCore: throw exceptions correctly
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CefSharp.Test
|
||||
{
|
||||
@@ -15,7 +14,6 @@ namespace CefSharp.Test
|
||||
Assert.AreEqual(result, Fixture.Browser.EvaluateScript(script));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[TestCase("!!!")]
|
||||
public void EvaluateScriptExceptionTest(string script)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace CefSharp
|
||||
if (exception)
|
||||
{
|
||||
CefString message = exception->GetMessage();
|
||||
_exception = gcnew ScriptException(toClr(message));
|
||||
_exception = toClr(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -40,9 +40,9 @@ namespace CefSharp
|
||||
{
|
||||
_result = convertFromCef(result);
|
||||
}
|
||||
catch (...)
|
||||
catch (Exception^ ex)
|
||||
{
|
||||
|
||||
_exception = ex->Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,9 +69,8 @@ namespace CefSharp
|
||||
gcroot<Object^> ScriptCore::Evaluate(CefRefPtr<CefFrame> frame, CefString script, double timeout)
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
//_result = nullptr;
|
||||
//_exception = nullptr;
|
||||
_result = nullptr;
|
||||
_exception = nullptr;
|
||||
|
||||
if (CefCurrentlyOn(TID_UI))
|
||||
{
|
||||
@@ -90,7 +89,7 @@ namespace CefSharp
|
||||
|
||||
if (_exception)
|
||||
{
|
||||
throw _exception;
|
||||
throw gcnew ScriptException(_exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CefSharp
|
||||
HANDLE _event;
|
||||
|
||||
gcroot<Object^> _result;
|
||||
gcroot<Exception^> _exception;
|
||||
gcroot<String^> _exception;
|
||||
|
||||
void UIT_Execute(CefRefPtr<CefFrame> frame, CefString script);
|
||||
void UIT_Evaluate(CefRefPtr<CefFrame> frame, CefString script);
|
||||
|
||||
@@ -13,5 +13,4 @@ namespace CefSharp
|
||||
: Exception(message)
|
||||
{}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user