mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 12:09:40 +00:00
LegacyJavascriptBinding - Enabled field was overwritten when a popup was opened
Popups don't transmit their own bound object information, _legacyBindingEnabled was being set to false
This commit is contained in:
@@ -55,28 +55,34 @@ namespace CefSharp
|
||||
//Multiple CefBrowserWrappers created when opening popups
|
||||
_browserWrappers->TryAdd(browser->GetIdentifier(), wrapper);
|
||||
|
||||
_legacyBindingEnabled = extraInfo->GetBool("LegacyBindingEnabled");
|
||||
|
||||
if (_legacyBindingEnabled)
|
||||
//For the main browser only we check LegacyBindingEnabled and
|
||||
//load the objects. Popups don't send this information and checking
|
||||
//will override the _legacyBindingEnabled field
|
||||
if (!browser->IsPopup())
|
||||
{
|
||||
auto objects = extraInfo->GetList("LegacyBindingObjects");
|
||||
if (objects.get() && objects->IsValid())
|
||||
{
|
||||
auto javascriptObjects = DeserializeJsObjects(objects, 0);
|
||||
_legacyBindingEnabled = extraInfo->GetBool("LegacyBindingEnabled");
|
||||
|
||||
for each (JavascriptObject^ obj in Enumerable::OfType<JavascriptObject^>(javascriptObjects))
|
||||
if (_legacyBindingEnabled)
|
||||
{
|
||||
auto objects = extraInfo->GetList("LegacyBindingObjects");
|
||||
if (objects.get() && objects->IsValid())
|
||||
{
|
||||
//Using LegacyBinding with multiple ChromiumWebBrowser instances that share the same
|
||||
//render process and using LegacyBinding will cause problems for the limited caching implementation
|
||||
//that exists at the moment, for now we'll remove an object if already exists, same behaviour
|
||||
//as the new binding method.
|
||||
//TODO: This should be removed when https://github.com/cefsharp/CefSharp/issues/2306
|
||||
//Is complete as objects will be stored at the browser level
|
||||
if (_javascriptObjects->ContainsKey(obj->JavascriptName))
|
||||
auto javascriptObjects = DeserializeJsObjects(objects, 0);
|
||||
|
||||
for each (JavascriptObject^ obj in Enumerable::OfType<JavascriptObject^>(javascriptObjects))
|
||||
{
|
||||
_javascriptObjects->Remove(obj->JavascriptName);
|
||||
//Using LegacyBinding with multiple ChromiumWebBrowser instances that share the same
|
||||
//render process and using LegacyBinding will cause problems for the limited caching implementation
|
||||
//that exists at the moment, for now we'll remove an object if already exists, same behaviour
|
||||
//as the new binding method.
|
||||
//TODO: This should be removed when https://github.com/cefsharp/CefSharp/issues/2306
|
||||
//Is complete as objects will be stored at the browser level
|
||||
if (_javascriptObjects->ContainsKey(obj->JavascriptName))
|
||||
{
|
||||
_javascriptObjects->Remove(obj->JavascriptName);
|
||||
}
|
||||
_javascriptObjects->Add(obj->JavascriptName, obj);
|
||||
}
|
||||
_javascriptObjects->Add(obj->JavascriptName, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user