diff --git a/CefSharp.Core.Runtime/ManagedCefBrowserAdapter.h b/CefSharp.Core.Runtime/ManagedCefBrowserAdapter.h index f70dad5c8..aaf8a5e4c 100644 --- a/CefSharp.Core.Runtime/ManagedCefBrowserAdapter.h +++ b/CefSharp.Core.Runtime/ManagedCefBrowserAdapter.h @@ -68,7 +68,7 @@ namespace CefSharp } _webBrowserInternal = webBrowserInternal; - _javaScriptObjectRepository = gcnew CefSharp::Internals::JavascriptObjectRepository(); + _javaScriptObjectRepository = CefSharpSettings::ObjectFactory->CreateJavascriptObjectRepository(_webBrowserInternal); _javascriptCallbackFactory = gcnew CefSharp::Internals::JavascriptCallbackFactory(_clientAdapter->GetPendingTaskRepository()); _methodRunnerQueue = CefSharpSettings::ObjectFactory->CreateMethodRunnerQueue(_webBrowserInternal, _javaScriptObjectRepository); diff --git a/CefSharp/ICefSharpObjectFactory.cs b/CefSharp/ICefSharpObjectFactory.cs index f8aba7ad3..9611b1bd5 100644 --- a/CefSharp/ICefSharpObjectFactory.cs +++ b/CefSharp/ICefSharpObjectFactory.cs @@ -18,5 +18,12 @@ public interface ICefSharpObjectFactory /// Javascript Object Repository /// Returns a new instance of . Cannot be null. IMethodRunnerQueue CreateMethodRunnerQueue(IWebBrowser webBrowser, IJavascriptObjectRepositoryInternal javascriptObjectRepository); + + /// + /// Creates a new instance of + /// The ChromiumWebBrowser instance. + /// Returns a new instance of . Cannot be null. + IJavascriptObjectRepositoryInternal CreateJavascriptObjectRepository(IWebBrowser webBrowser); } } diff --git a/CefSharp/Internals/CefSharpObjectFactory.cs b/CefSharp/Internals/CefSharpObjectFactory.cs index 536b3f4de..d99e094be 100644 --- a/CefSharp/Internals/CefSharpObjectFactory.cs +++ b/CefSharp/Internals/CefSharpObjectFactory.cs @@ -6,6 +6,11 @@ namespace CefSharp.Internals { public sealed class CefSharpObjectFactory : ICefSharpObjectFactory { + public IJavascriptObjectRepositoryInternal CreateJavascriptObjectRepository(IWebBrowser webBrowser) + { + return new JavascriptObjectRepository(); + } + public IMethodRunnerQueue CreateMethodRunnerQueue(IWebBrowser webBrowser, IJavascriptObjectRepositoryInternal javascriptObjectRepository) { if (CefSharpSettings.ConcurrentTaskExecution)