Commit Graph

2231 Commits

Author SHA1 Message Date
amaitland 898ca38e7a Core - Add BindingOptions.NameConverter
- Allows for the user to provide their own IJavascriptNameConverter implementation
- Defaults to using the CamelCaseJavascriptNameConverter (which is exactly the same very basic
naming conversion used by default currently).
- If CamelCaseJavascriptNames is false then no conversion is used

Naming is now separate from the JavascriptObjectRepository and can be tested in isolation.
2020-05-30 20:02:56 +10:00
amaitland ae41e10d71 Core - Javascript Binding Configure Property Name
- Rename settings object to JavascriptBindingSettings
- Validate JavascriptBindingSettings.JsBindingGlobalObjectName in setter to provide immediate
  feedback
- Add FreezableBase which throws exception when frozen (we can reuse this for some other settings classes)
- Add some basic Unit Tests (More would be better)

Follow on from #3126
2020-05-30 19:28:50 +10:00
Geevo 66691105b4 Core - Added ability to configure/customize javascript binding property name. 2020-05-30 18:53:13 +10:00
amaitland e9ca3f58e2 Core - FreezableBase improve error message
Include the instance type instead of FreezableBase
2020-05-23 19:45:22 +10:00
amaitland 880f11410c Core - JavascriptBindingSettings.LegacyBindingEnabled throw if Frozen
Throw exception if attempt to set frozen property.

Issue #2977
2020-05-23 14:28:10 +10:00
amaitland a70abc4437 Core - LegacyBinding is now configured per browser
Previously it was global set using CefSharpSettings.LegacyJavascriptBindingEnabled

Now it's configured through IJavascriptObjectRepository.Settings.LegacyBindingEnabled
which defaults to CefSharpSettings.LegacyJavascriptBindingEnabled (until it's removed).

IJavascriptObjectRepository.ResolveObject is raised with LegacyObjects as the name
to allow for easier binding of objects.

Issue #2977
2020-05-23 14:15:33 +10:00
amaitland 35e207d08b Update version number to 81.3.100 2020-05-23 12:05:06 +10:00
amaitland 99cc2d5030 Core - Cef.GetMimeType custom/fallback mimeType mapping
- return application/octet-stream when no mapping found
- Add custom dictionary with some additional mimeTypes, users can add their own to this dictionary
- Add xunit test

Resolves #3041
2020-05-18 11:47:42 +10:00
amaitland ef590444b4 Core - DefaultBinder InvalidOperationException when binding [1,2,3,1.23] to double[]
- Bind for all elements in a collection, not just when the collection contains list/arrays
- Add additional unit tests

JavaScript array of [1,2,3,1.23] translates to [int, int, int, double], when attempting to Bind
to a double[] an InvalidOperationException was thrown. We now call Bind for each element,
when the type is directly assignable we return the value, for cases like above we perform a
type conversion.

Resolves #3129
2020-05-18 09:13:02 +10:00
amaitland b888c41fb7 Revert "Core - Remove ResourceHandler.GetMimeType"
This reverts commit 1b5e82814d4e49ab3b0ab249ad85c6254515a459.
2020-05-15 20:26:43 +10:00
amaitland 436e565f04 Core - Remove DefaultRequestHandler
Issue #3124
2020-05-15 20:26:42 +10:00
amaitland 5cdc1f747e Core - Remove ResourceHandler.GetMimeType
It's actually made private for now as it's used in one place and
will be removed when that obsolete method is removed.

Resolves #3105
2020-05-15 20:26:42 +10:00
amaitland 99dd3f4273 Upgrade version number to 81.3.20 2020-05-09 05:56:39 +10:00
amaitland 6c29d3b4e6 Core - Update CefErrorCode
Resolves #3106
2020-05-08 10:22:56 +10:00
amaitland c63c301451 Core - Improve IBrowserHost.NotifyMoveOrResizeStarted xml doc 2020-05-05 08:34:48 +10:00
amaitland 1824a0334d WPF/WinForms/OffScreen - CanExecuteJavascriptInMainFrame incorrectly false after loading page with different origin
Proof of concept for a workaround. The frameId for the second OnContextReleased that arrives after the OnContextCreated from
the old render process strangely has a frameId greater than the new frameId

TODO: Unit tests

Issue #3021
2020-05-04 12:34:47 +10:00
amaitland 6b440a84a3 Shutdown - Improve WaitForBrowsersToClose
- Add Cef.PreShutdown
- For WPF hook the DispatcherShutdownStarted and DispatcherShutdownFinished events then call Cef.PreShutdown
- Add NoOpBrowserRefCounter and set as default, needs a little more testing before it's enabled by default.
  Can be enabled by calling Cef.EnableWaitForBrowsersToClose before calling Cef.Initialize

Issue #3047
2020-05-03 21:58:05 +10:00
amaitland 09661c6ac7 Core - PathCheck fix typo in comment 2020-05-03 19:31:51 +10:00
amaitland 98b7abeeea Core - PathCheck rewrite to match Chromium FilePath::IsAbsolute
Resovles #3102
2020-05-03 19:28:32 +10:00
amaitland e1401e7092 Core - Ensure CachePath/RootCachePath/LocalesDirPath/BrowserSubprocessPath are absolute
CEF now requires this to be absolute, we enforce this by throwing exception if non-absolute

Resolves  #3102
2020-05-03 16:59:57 +10:00
amaitland 349c9a938b Core - IResourceRequestHandler implement IDisposible
Add ResourceRequestHandler.Dispose protected virtual method
Instance will be disposed when ref count frees the last instance.
2020-05-02 08:50:16 +10:00
amaitland 46006b4a44 Core - Add DependencyChecker.AssertPathAbsolute
Issue #3102
2020-05-01 11:03:30 +10:00
amaitland bce627097b Upgrade version number to 81.2.210 2020-04-27 17:45:53 +10:00
amaitland 14072b48e3 Core - ResourceHandler.Skip return true on successful seek 2020-04-23 17:07:06 +10:00
amaitland 296e75a775 Core - CefEventFlags fix capitalisation of AltGrDown
Was previously AltgrDown

Issue #3098
2020-04-18 20:31:04 +10:00
amaitland aef48bdd17 Core - CefEventFlags.AltGrDown Typo
Issue #3098
2020-04-18 14:52:41 +10:00
amaitland f46a8a7175 Core - Add CefEventFlags.AltGrDown
Resolves #3098
2020-04-18 10:55:27 +10:00
amaitland 0592d69784 Core - FolderSchemeHandlerFactory add protected virtual Create method
override Create to implement custom behaviour
2020-04-05 05:33:22 +10:00
amaitland 3ba0290676 WPF - Add IWebBrowser.IsBrowserInitialized explicit interface implementation
Can be called from any Thread, the ChromiumWebBrowser.IsBrowserInitialized property remains
as Dependency property.

Issue #3033
2020-03-26 09:10:36 +10:00
amaitland 2b47cf56ce Core - Make ResourceHandler.GetMimeType obsolete
Instead use Cef.GetMimeType to use the Chromium MimeType Mappings

Rather than maintain our own mapping (which is out of date) we'll defer to Chromium.

Make ResourceHandler.FromString(string, string) and ResourceHandler.GetMimeType obsolete, they will be removed at some point
ResourceHandler.FromString uses ResourceHandler.GetMimeType internally, Replacing with ResourceHandler.FromString(resource, mimeType: Cef.GetMimeType(extension));
uses a different overload.

Issue #3041
2020-03-26 08:50:08 +10:00
amaitland 006445df03 MimeType - Add extra checking to Cef.GetMimeType
Also update the ResourceHandler.FromFilePath xml doc to reference Cef.GetMimeType

Issue #3041
2020-03-26 08:50:07 +10:00
Gilberto Stankiewicz 29e6a6d03a Fix a typo in an error message (#3087) 2020-03-26 08:37:02 +10:00
amaitland 30f2204f8e Xml Doc Improvements 2020-02-29 13:16:23 +10:00
amaitland 1761e93741 Core - DependencyChecker remove "natives_blob.bin" reference
Issue #3057
2020-02-28 11:10:23 +10:00
amaitland 2c5b07d2d0 Upgrade version to 80.0.40 2020-02-27 17:38:00 +10:00
amaitland 31c7e9957a Upgrade version number to 79.1.380 2020-02-27 15:24:18 +10:00
campersau 0d46348c20 Core - DomNode consistent code style (#3058) 2020-02-19 06:54:02 +10:00
amaitland 7100c3d0ec Core - Add Cef.WaitForBrowsersToClose helper function
- Add BrowserRefCounter to increment/decrement CefBrowser instance creation
- Add Cef.WaitForBrowsersToClose to dispose of all browser instances and call WaitForBrowsersToClose

Before calling CefShutdown it's important that CEF has finished closing/disposing of all the CefBrowser instances.
If you call CefShutdown before this has finished then you can get the error
"Check failed: !IsCefShutdown(). Object reference incorrectly held at CefShutdown".
This is more a problem when using MultiThreadedMessageLoop where CEF close/dispose happens on a different thread.
Calling ChromiumWebBrowser.Dispose will start to free the resources, CEF internally executes code on it's own thread.

#3047
2020-02-14 19:39:12 +10:00
amaitland 9dcb0ccad2 Core - Add IBrowserHost.TryCloseBrowser 2020-02-11 07:06:50 +10:00
amaitland 0772121f5f Core - ResourceHandler Add MimeType Mappings
Adding some newer video/audio/font mappings

#3041
2020-02-05 11:41:02 +10:00
amaitland 5780fb1f58 Core - ResourceHandler free resources in Dispose instead of Cancel
There is no example of Cancel in the source code and the description in the doc doesn't
really provide a clear explanation of it's intended use case.

See code comment for further details
2020-02-05 10:06:48 +10:00
amaitland bf41aa2d75 Core - ResourceHandler.Read only read as many bytes as can be written to DataOut
Previously we'd read too many bytes and attempting to write them to dataOUt would cause a see System.NotSupportedException

Resolves #3038
2020-02-05 07:12:08 +10:00
amaitland 961fc97c9d WebBrowserExtensions - Add missing semi colon 2020-01-31 08:16:34 +10:00
amaitland 499c6a80db WPF - ChromiumWebBrowser.GetBrowser() Throws InvalidOperationException if called on Non UI Thread.
- Extract error message out into a internal const so it's not duplicated
- Manually check InternalIsBrowserInitialized() method instead of using the extension method

Resolves #3032
2020-01-31 07:51:25 +10:00
amaitland 10d52419f3 xml doc improvements 2020-01-29 10:22:18 +10:00
amaitland 1b1cf522de Core - Update ReferrerPolicy enum values
**Breaking Change**

Resolves #3026
2020-01-29 05:36:55 +10:00
amaitland 39a305cac1 Xml Doc - Improvements and fixes
- Some classes are now excluded
- Many minor fixes should hopefully reduce the number of errors reported by Sandcastle
- Some of the xml doc is generated by Atomineer, usually in cases where CEF lacks documentation
2020-01-29 05:36:54 +10:00
amaitland ad2c1756f9 Core - Add IBrowserHost.GetNavigationEntriesAsync extension method 2020-01-24 10:51:29 +10:00
amaitland 1155ef107c Core - ResourceHandler set Stream.Position = 0 and if CanSeek
- Prior to version 75 the Stream.Position was set to 0 before the ResourceHandler would read the Stream.
This restores that behaviour.
- Minor refactor of if statement for Stream.Can seek, only override ResponseLength with Stream.Length of not already set

Resolves #2903
2020-01-23 07:56:13 +10:00
amaitland 44113d77a4 DevTools - now shown as popup (visible in taskbar).
- Pass null for CefWindowInfo.SetAsPopup parent handle
- Add optional params to IWebBrowser/IBrowser.ShowDevTools extension methods.

Anyone wishing to use the old behaviour can do something like

var host = browser.GetBrowserHost();

var windowInfo = new WindowInfo();
windowInfo.SetAsPopup(host.GetWindowHandle(), "DevTools");

browser.ShowDevTools(windowInfo);

Resolves #2997
2020-01-21 09:06:28 +10:00