mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
70de3a6d9c
* WinForms/WPF - Dispose of IFrame after calling LoadUrl * BrowserProcess - Add initial implementation of IRenderProcessHandler.OnContextCreated/OnContextReleased - IV8Context.Execute is the only method to be implemented so far (execute script without returning a result) - Wrappers for CefFrame and CefBrowser have yet to be imported yet, still need to determine if they should be included individually or reference to CefSharp.Core added * BrowserProcess - Add wrappers for Browser and Frame Ultimately we should probably remove the CefSharp.BrowserSubprocess.Core project and move all the code into a folder/namespace within CefSharp.Core This would allow us to share the a lot of existing code, major refactor required * CefSharp.Common.props - Add CefSharpBrowserProcessCore32/64 properties Make creating your own custom browser process easier * BrowserProcess - Remove example and add comments about creating your own custom version
67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
// Copyright © 2019 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
#pragma once
|
|
|
|
#include "Stdafx.h"
|
|
|
|
#include "include\cef_v8.h"
|
|
|
|
using namespace System::Runtime::InteropServices;
|
|
using namespace CefSharp::RenderProcess;
|
|
|
|
namespace CefSharp
|
|
{
|
|
namespace BrowserSubprocess
|
|
{
|
|
private ref class V8Context : public IV8Context
|
|
{
|
|
private:
|
|
MCefRefPtr<CefV8Context> _context;
|
|
|
|
public:
|
|
V8Context(CefRefPtr<CefV8Context> &context)
|
|
: _context(context)
|
|
{
|
|
}
|
|
|
|
!V8Context()
|
|
{
|
|
_context = NULL;
|
|
}
|
|
|
|
~V8Context()
|
|
{
|
|
this->!V8Context();
|
|
}
|
|
|
|
virtual bool Execute(String^ code, String^ scriptUrl, int startLine, [Out] V8Exception^ %exception)
|
|
{
|
|
exception = nullptr;
|
|
|
|
CefRefPtr<CefV8Value> result;
|
|
CefRefPtr<CefV8Exception> ex;
|
|
|
|
if (_context->Eval(StringUtils::ToNative(code), StringUtils::ToNative(scriptUrl), startLine, result, ex))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
exception = gcnew V8Exception(ex->GetEndColumn(),
|
|
ex->GetEndPosition(),
|
|
ex->GetLineNumber(),
|
|
StringUtils::ToClr(ex->GetMessage()),
|
|
StringUtils::ToClr(ex->GetScriptResourceName()),
|
|
StringUtils::ToClr(ex->GetSourceLine()),
|
|
ex->GetStartColumn(),
|
|
ex->GetStartPosition());
|
|
|
|
return false;
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
|