Skip to content

Commit

Permalink
Merge 861f463 into f19a871
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland authored Jun 21, 2019
2 parents f19a871 + 861f463 commit acbeec6
Show file tree
Hide file tree
Showing 102 changed files with 1,922 additions and 1,684 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace CefSharp
bool JavascriptAsyncMethodHandler::Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception)
{
auto context = CefV8Context::GetCurrentContext();
auto browser = context->GetBrowser();
auto frame = context->GetFrame();

CefRefPtr<CefV8Value> promiseData;
CefRefPtr<CefV8Exception> promiseException;
Expand Down Expand Up @@ -59,13 +59,12 @@ namespace CefSharp
SerializeV8Object(arguments[i], params, i, _callbackRegistry);
}

SetInt64(argList, 0, context->GetFrame()->GetIdentifier());
SetInt64(argList, 1, _objectId);
SetInt64(argList, 2, callbackId);
argList->SetString(3, name);
argList->SetList(4, params);
SetInt64(argList, 0, _objectId);
SetInt64(argList, 1, callbackId);
argList->SetString(2, name);
argList->SetList(3, params);

browser->SendProcessMessage(CefProcessId::PID_BROWSER, request);
frame->SendProcessMessage(CefProcessId::PID_BROWSER, request);

return true;
}
Expand Down
250 changes: 117 additions & 133 deletions CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ namespace CefSharp
JavascriptRootObjectWrapper^ GetJsRootObjectWrapper(int browserId, int64 frameId);

virtual DECL CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE;
virtual DECL void OnBrowserCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual DECL void OnBrowserCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefDictionaryValue> extraInfo) OVERRIDE;
virtual DECL void OnBrowserDestroyed(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual DECL void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) OVERRIDE;
virtual DECL void OnContextReleased(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) OVERRIDE;
virtual DECL bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId sourceProcessId, CefRefPtr<CefProcessMessage> message) OVERRIDE;
virtual DECL bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefProcessId sourceProcessId, CefRefPtr<CefProcessMessage> message) OVERRIDE;
virtual DECL void OnRenderThreadCreated(CefRefPtr<CefListValue> extraInfo) OVERRIDE;
virtual DECL void OnWebKitInitialized() OVERRIDE;
virtual DECL void OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) OVERRIDE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\cef.sdk.74.1.13\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.74.1.13\build\cef.sdk.props')" />
<Import Project="..\packages\cef.sdk.75.0.11\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.75.0.11\build\cef.sdk.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand Down
10 changes: 4 additions & 6 deletions CefSharp.BrowserSubprocess.Core/JavascriptPostMessageHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ namespace CefSharp
auto context = CefV8Context::GetCurrentContext();
if (context.get())
{
auto browser = context->GetBrowser();
auto frame = context->GetFrame();

if (context.get() && context->Enter())
if (frame.get() && frame->IsValid() && context->Enter())
{
try
{
Expand All @@ -53,18 +53,16 @@ namespace CefSharp
auto request = CefProcessMessage::Create(kJavascriptMessageReceived);
auto argList = request->GetArgumentList();

SetInt64(argList, 0, context->GetFrame()->GetIdentifier());

auto params = CefListValue::Create();
SerializeV8Object(arguments[0], params, 0, _javascriptCallbackRegistry);

//We're only interested in the first param
if (params->GetSize() > 0)
{
argList->SetValue(1, params->GetValue(0));
argList->SetValue(0, params->GetValue(0));
}

browser->SendProcessMessage(CefProcessId::PID_BROWSER, request);
frame->SendProcessMessage(CefProcessId::PID_BROWSER, request);

retval = CefV8Value::CreateNull();
}
Expand Down
58 changes: 33 additions & 25 deletions CefSharp.BrowserSubprocess.Core/RegisterBoundObjectHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ namespace CefSharp
if (cachedObjects->Count == objectCount && ignoreCache == false)
{
auto frame = context->GetFrame();

if (frame.get())
{
if (Object::ReferenceEquals(_browserWrapper, nullptr))
Expand Down Expand Up @@ -268,45 +269,52 @@ namespace CefSharp
response->SetValue("Message", CefV8Value::CreateString("OK"), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
callback->Success(response);

NotifyObjectBound(browser, objectNamesWithBoundStatus);
NotifyObjectBound(frame, objectNamesWithBoundStatus);
}
}

}
else
{
//Obtain a callbackId then send off the Request for objects
auto callbackId = _callbackRegistry->SaveMethodCallback(callback);
auto frame = context->GetFrame();
if (frame.get() && frame->IsValid())
{
//Obtain a callbackId then send off the Request for objects
auto callbackId = _callbackRegistry->SaveMethodCallback(callback);

argList->SetInt(0, browser->GetIdentifier());
SetInt64(argList, 1, context->GetFrame()->GetIdentifier());
SetInt64(argList, 2, callbackId);
argList->SetList(3, params);
SetInt64(argList, 0, callbackId);
argList->SetList(1, params);

browser->SendProcessMessage(CefProcessId::PID_BROWSER, request);
frame->SendProcessMessage(CefProcessId::PID_BROWSER, request);
}
}
}
else
{
//Objects already bound or ignore cache
auto frame = context->GetFrame();

//Response object has no Accessor or Interceptor
auto response = CefV8Value::CreateObject(NULL, NULL);
if (frame.get() && frame->IsValid())
{
//Objects already bound or ignore cache

//Objects already bound so we immediately resolve the Promise
response->SetValue("Success", CefV8Value::CreateBool(false), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
response->SetValue("Count", CefV8Value::CreateInt(0), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
response->SetValue("Message", CefV8Value::CreateString("Object(s) already bound"), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
//Response object has no Accessor or Interceptor
auto response = CefV8Value::CreateObject(NULL, NULL);

CefV8ValueList returnArgs;
returnArgs.push_back(response);
//If all the requested objects are bound then we immediately execute resolve
//with Success true and Count of 0
resolve->ExecuteFunctionWithContext(context, nullptr, returnArgs);
//Objects already bound so we immediately resolve the Promise
response->SetValue("Success", CefV8Value::CreateBool(false), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
response->SetValue("Count", CefV8Value::CreateInt(0), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
response->SetValue("Message", CefV8Value::CreateString("Object(s) already bound"), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);

if (notifyIfAlreadyBound)
{
NotifyObjectBound(browser, objectNamesWithBoundStatus);
CefV8ValueList returnArgs;
returnArgs.push_back(response);
//If all the requested objects are bound then we immediately execute resolve
//with Success true and Count of 0
resolve->ExecuteFunctionWithContext(context, nullptr, returnArgs);

if (notifyIfAlreadyBound)
{
NotifyObjectBound(frame, objectNamesWithBoundStatus);
}
}
}
}
Expand All @@ -331,7 +339,7 @@ namespace CefSharp
}

private:
void NotifyObjectBound(const CefRefPtr<CefBrowser> browser, List<Tuple<String^, bool, bool>^>^ objectNamesWithBoundStatus)
void NotifyObjectBound(const CefRefPtr<CefFrame> frame, List<Tuple<String^, bool, bool>^>^ objectNamesWithBoundStatus)
{
//Send message notifying Browser Process of which objects were bound
//We do this after the objects have been created in the V8Context to gurantee
Expand All @@ -358,7 +366,7 @@ namespace CefSharp

args->SetList(0, boundObjects);

browser->SendProcessMessage(CefProcessId::PID_BROWSER, msg);
frame->SendProcessMessage(CefProcessId::PID_BROWSER, msg);
}


Expand Down
8 changes: 4 additions & 4 deletions CefSharp.BrowserSubprocess.Core/Resource.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1 VERSIONINFO
FILEVERSION 74.1.130
PRODUCTVERSION 74.1.130
FILEVERSION 75.0.30
PRODUCTVERSION 75.0.30
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -16,10 +16,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "CefSharp.BrowserSubprocess.Core"
VALUE "FileVersion", "74.1.130"
VALUE "FileVersion", "75.0.30"
VALUE "LegalCopyright", "Copyright © 2019 The CefSharp Authors"
VALUE "ProductName", "CefSharp"
VALUE "ProductVersion", "74.1.130"
VALUE "ProductVersion", "75.0.30"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.BrowserSubprocess.Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.sdk" version="74.1.13" targetFramework="native" />
<package id="cef.sdk" version="75.0.11" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion CefSharp.BrowserSubprocess/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<assemblyIdentity version="74.1.130.0" name="CefSharp.BrowserSubprocess.app" />
<assemblyIdentity version="75.0.30.0" name="CefSharp.BrowserSubprocess.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down
41 changes: 35 additions & 6 deletions CefSharp.Core/AbstractCefSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,36 @@ namespace CefSharp
}

/// <summary>
/// The location where cache data will be stored on disk. If empty then
/// browsers will be created in "incognito mode" where in-memory caches are
/// used for storage and no data is persisted to disk. HTML5 databases such as
/// localStorage will only persist across sessions if a cache path is
/// specified. Can be overridden for individual CefRequestContext instances via
/// the RequestContextSettings.CachePath value.
/// The location where data for the global browser cache will be stored on disk.
/// In non-empty this must be either equal to or a child directory of CefSettings.RootCachePath
/// (if RootCachePath is empty it will default to this value).
/// If empty then browsers will be created in "incognito mode" where in-memory caches are used
/// for storage and no data is persisted to disk. HTML5 databases such as localStorage will
/// only persist across sessions if a cache path is specified. Can be overridden for individual
/// RequestContext instances via the RequestContextSettings.CachePath value.
/// </summary>
property String^ CachePath
{
String^ get() { return StringUtils::ToClr(_cefSettings->cache_path); }
void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->cache_path, value); }
}

/// <summary>
/// The root directory that all CefSettings.CachePath and RequestContextSettings.CachePath values
/// must have in common. If this value is empty and CefSettings.CachePath is non-empty then this
/// value will default to the CefSettings.CachePath value. Failure to set this value correctly
/// may result in the sandbox blocking read/write access to the CachePath directory.
/// NOTE: CefSharp does not implement the CHROMIUM SANDBOX.
/// A non-empty RootCachePath can be used in conjuncation with an empty CefSettings.CachePath
/// in instances where you would like browsers attached to the Global RequestContext (the default)
/// created in "incognito mode" and instances created with a custom RequestContext using a disk based cache.
/// </summary>
property String^ RootCachePath
{
String^ get() { return StringUtils::ToClr(_cefSettings->root_cache_path); }
void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->root_cache_path, value); }
}

/// <summary>
/// The location where user data such as spell checking dictionary files will
/// be stored on disk. If empty then the default platform-specific user data
Expand Down Expand Up @@ -384,6 +401,18 @@ namespace CefSharp
void set(uint32 value) { _cefSettings->background_color = value; }
}

/// <summary>
/// GUID string used for identifying the application. This is passed to the
/// system AV function for scanning downloaded files. By default, the GUID
/// will be an empty string and the file will be treated as an untrusted
/// file when the GUID is empty.
/// </summary>
property String^ ApplicationClientIdForFileScanning
{
String^ get() { return StringUtils::ToClr(_cefSettings->application_client_id_for_file_scanning); }
void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->application_client_id_for_file_scanning, value); }
}

/// <summary>
/// Registers a custom scheme using the provided settings.
/// </summary>
Expand Down
22 changes: 1 addition & 21 deletions CefSharp.Core/Cef.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ namespace CefSharp

/// <summary>
/// Returns the global cookie manager. By default data will be stored at CefSettings.CachePath if specified or in memory otherwise.
/// Using this method is equivalent to calling Cef.GetGlobalRequestContext().GetDefaultCookieManager()
/// Using this method is equivalent to calling Cef.GetGlobalRequestContext().GetCookieManager()
/// The earlier possible place to access the ICookieManager is in IBrowserProcessHandler.OnContextInitialized.
/// Alternative use the ChromiumWebBrowser BrowserInitialized (OffScreen) or IsBrowserInitializedChanged (WinForms/WPF) events.
/// </summary>
Expand All @@ -383,26 +383,6 @@ namespace CefSharp
return nullptr;
}

/// <summary>
/// Returns a cookie manager that neither stores nor retrieves cookies. All
/// usage of cookies will be blocked including cookies accessed via the network
/// (request/response headers), via JavaScript (document.cookie), and via
/// CefCookieManager methods. No cookies will be displayed in DevTools. If you
/// wish to only block cookies sent via the network use the IRequestHandler
/// CanGetCookies and CanSetCookie methods instead.
/// </summary>
/// <returns>A blocking cookie manager</returns>
static ICookieManager^ GetBlockingCookieManager()
{
auto cookieManager = CefCookieManager::GetBlockingManager();
if (cookieManager.get())
{
return gcnew CookieManager(cookieManager);
}

return nullptr;
}

/// <summary>
/// Shuts down CefSharp and the underlying CEF infrastructure. This method is safe to call multiple times; it will only
/// shut down CEF on the first call (all subsequent calls will be ignored).
Expand Down
6 changes: 5 additions & 1 deletion CefSharp.Core/CefSharp.Core.vcxproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\cef.sdk.74.1.13\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.74.1.13\build\cef.sdk.props')" />
<Import Project="..\packages\cef.sdk.75.0.11\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.75.0.11\build\cef.sdk.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand Down Expand Up @@ -261,9 +261,13 @@
<ItemGroup>
<ClInclude Include="BrowserSettings.h" />
<ClInclude Include="Cef.h" />
<ClInclude Include="Internals\CefResourceReadCallbackWrapper.h" />
<ClInclude Include="Internals\CefCookieAccessFilterAdapter.h" />
<ClInclude Include="Internals\CefExtensionHandlerAdapter.h" />
<ClInclude Include="Internals\CefExtensionWrapper.h" />
<ClInclude Include="Internals\CefGetExtensionResourceCallbackWrapper.h" />
<ClInclude Include="Internals\CefResourceRequestHandlerAdapter.h" />
<ClInclude Include="Internals\CefResourceSkipCallbackWrapper.h" />
<ClInclude Include="Internals\CefRunFileDialogCallbackAdapter.h" />
<ClInclude Include="Internals\CefSchemeRegistrarWrapper.h" />
<ClInclude Include="Internals\CefValueWrapper.h" />
Expand Down
Loading

0 comments on commit acbeec6

Please sign in to comment.