发布日期 2020年09月09日
DotNetBrowser 2.2
In this update we improved the rendering performance in the off-screen rendering mode, restored functionality that allows disabling the internal Chromium traffic, and extended your options in managing data and user interaction with the browser.
What’s New
Rendering Performance
The off-screen rendering performance has been improved on all supported platforms and UI toolkits.
The results of the rendering performance testing on the different platforms on an HTML5 video in Frame Per Second (FPS) are the following:
-
Intel Core i5 8400H 2.5 GHz with integrated video Intel UHD Graphics 630
Video dimension: 1920x1080WinForms
WPF
-
Intel Core i7 7700HQ 2.8 GHz with GPU NVIDIA GeForce MX150
Video dimension: 1920x1080WinForms
WPF
Chromium Traffic
It is now possible to save on unnecessary traffic to such Chromium services as Google Cloud Messaging, Translate Ranker, Extensions Updater, Safe Browsing, etc. These services are related to the features that are not currently supported in DotNetBrowser.
It can be done as follows:
EngineOptions engineOptions = new EngineOptions.Builder
{
GoogleTrafficDisabled = true
}.Build();
Disabling PDF Viewer
You can now choose whether to display PDF documents in the PDF Viewer or download them. By default, they will be displayed in the PDF Viewer. Here is how to switch to downloading the PDFs:
Engine.Plugins.Settings.PdfViewerEnabled = false;
Clearing HTTP Cache
With this update you get more control over the memory usage. You can now mark all HTTP cache entries stored in both disk and memory for deletion.
Important: The IHttpCache.ClearDiskCache()
method is marked as Obsolete and will be removed in one of the next versions. Use the IHttpCache.Clear()
method instead.
Overscroll History Navigation
DotNetBrowser now allows navigating back/forward with a left/right swipe on devices with the touch screen. By default, the overscroll navigation is disabled. You can enable it as follows:
Browser.Settings.OverscrollHistoryNavigationEnabled = true;
Focused DOM Element
It is now possible to get the currently focused DOM element in the document. Here is a sample:
IElement focusedElement = Browser.MainFrame.Document.FocusedElement;
IPC Message Order
In the previous versions the IPC message order could be changed when any handler was invoked. For example, raising the keyboard events method when a handler is invoked could lead to an issue when the text field on a web page contained randomly mixed letters.
Explanation: when a handler is invoked, we start a nested loop processing incoming IPC messages. The problem is that there is a window between we get into the method invoking the handler and the moment when we actually start the nested loop. As a result, we can get a situation when some of the incoming messages are posted to the Chromium thread queue and those messages will be processed only after the method returns. At the same time, those messages that arrive when the nested loop is started will be processed before the method returns, and this affects the order in which the messages were sent.
In this version we improved the internal IPC logic to get rid of such situations. This improvement introduces one important requirement on how you should process the code inside a handler. If you execute some logic that makes synchronous calls to the library in a separate thread inside of a handler and blocks the handler waiting until the logic has been executed, you might get a deadlock. For example:
// Register a handler.
browser.SomeHandler = new Handler<Parameters, Response>(p =>
{
// Invoke some logic in a separate thread and block the current
// thread execution until the logic has been executed.
InvokeInSeparateThreadAndWait(() =>
{
// Invoke a synchronousmethod.
browser.SomeSyncMethod(); // <-- Deadlock: this method will never return.
});
return Response.Proceed();
});
To get rid of the possible deadlocks, use the following approach instead:
// Register a handler.
browser.SomeHandler = new Handler<Parameters, Response>(p =>
{
// Invoke a blocking method.
browser.SomeSyncMethod();
return Response.Proceed();
});
Improvements
In the previous versions, the same user data directory is used for all the IEngine
instances that have no custom user data directory specified. This directory usually contained previously saved data such as proxy settings, cookies, cache, etc.
In this release, a separate temporary user data directory is created each time when an IEngine
instance is created without specifying the custom user data directory. This directory is deleted automatically during disposing the IEngine
instance.
Fixed Issues
- The overridden HTTP headers causing ‘400 Bad Request’ error.
- The
ArgumentException
error when moving a child form withBrowserView
instance out of the main WinForms form using hardware-accelerated rendering mode. - The SpellChecker functionality not working after migration to Chromium 79.
- The second
BrowserView
instance not showing the webpage when using hardware-accelerated rendering mode in WinForms applications. - Getting a DOM node from the XPathResult leading to hang.
- Wrong
IKeyTypedEventArgs.VirtualKey
value when using hardware-accelerated rendering mode. - The
NullReferenceException
error when the MIME type is not set in OnHeadersReceived callback. - The popup window not being closed properly.
Request evaluation license
Download DotNetBrowser 2.2 (.NET Framework)
Download DotNetBrowser 2.2 (.NET Core)
关注 @DotNetBrowser ,获取库的更新动态。
订阅我们的 RSS feed ,获取最新版本动态。