* Move LegacyBindingEnabled / JavascriptBindingPropertyName to per browser settings
* Stricter test
---------
Co-authored-by: Alex Maitland <amaitland@users.noreply.github.com>
* Javascript Binding - Add Ability to limit origins
* Move JS binding settings to CefBrowserWrapper and optimize origin validation
* Initialize origins to null
* Normalize allowed origins
* Optimize origin validation
* Add null check for origin compare
* Fix JavaScript Binding API settings for popups
Move the JS binding API configuration block out of the !browser->IsPopup() scope
in OnBrowserCreated. This ensures that IsJavascriptBindingApiAllowed() enforces
configured restrictions for popups as well.
* Fix possible null deref for JavascriptBindingApiAllowOrigins
In IsJavascriptBindingApiAllowed, added a null check for JavascriptBindingApiAllowOrigins
to prevent a potential null dereference if JavascriptBindingApiHasAllowOrigins is true
but the allowOrigins list itself was null.
* Simplify origin normalization and add null check
* Add more test cases
* Refactor IsJavascriptBindingApiAllowed signature
Refactored IsJavascriptBindingApiAllowed to accept a CefBrowserWrapper^ parameter directly, eliminating redundant lookups and improving clarity. Updated all call sites to pass the browser wrapper explicitly.
* Clarify summary for HasJavascriptBindingApiAllowOrigins
Clarify documentation for HasJavascriptBindingApiAllowOrigins method to specify zero or more origins
* Simplify origin comparison logic in CefAppUnmanagedWrapper
Refactored code to directly compare wide string origins using
_wcsicmp, removing unnecessary pointer casts and null checks.
This streamlines the logic and improves readability.
* Add tests for JavaScript binding API behavior across cross-origin navigation
---------
Co-authored-by: amaitland <307872+amaitland@users.noreply.github.com>
Co-authored-by: Luca Sonntag <luca.sonntag@cgm.com>
- JavascriptCallbackRegistry - Get BrowserId From V8Context
- Render Process - Rewrite to store root object wrapper by frame instead of per browser
- Don't store JavascriptRootObjectWrapper in the browserWrapper as CEF is calling destroyed more than it should.
- Revert "Tests - Simplify ShouldFailWhenIsObjectCachedCalledWithInvalidObjectName"
This reverts commit f8a81acf7a.
---------
Co-authored-by: amaitland <307872+amaitland@users.noreply.github.com>
- Start splitting tests out into own files where relevant
- Improve call ordering
- Use Assert.RaisesAsync where possible
- Classes have been renamed (Tests is now the standard suffix)
TODO: Some of the classes still need their method names changed
* Core - added support for property interceptor
* Incorporated the review comments
* Incorporated the review comments 2
* Review comments exclude trygetproperty and trysetproperty for .netcore app
* Added the unit test cases for trygetproperty and trysetproperty
* Fixed .net core app build failure
* Added the separate test case for property interceptor
Co-authored-by: sghanti <santosh_ghanti@intuit.com>
- Initial intention was to have a reusable method that could be used CefSharp.Wpf.HwndHost,
upon further deliberation I've decided to build the functionality into the ChromiumWebBrowser.Partial.cs
and will need to duplicate the functionality in CefSharp.Wpf.HwndHost. This guarantees that the
Task will be resolved in all cases. The previous implementation there was a theoretical change we'd
miss subscribing to the relevant events
- Remove CancellationToken as it's not possible to cancel
Issue #3842
- Use inline data
- Move test into OffScreenBrowserBasicFacts as it's not actually javascript binding
at a later point all the tests should be rearranged so they're not just all lumped into OffScreenBrowserBasicFacts
Issue #3808
Core - Add LoadUrlAsync
- Add IWebBrowser.LoadUrlAsync
- Add LoadUrlAsyncResponse
- Update unit tests to use new method
- Add static method to allow for CefSharp.Wpf.HwndHost to share the same code.
- The Javascript methods that CefSharp provides in relation to JavaScript Binding are
created using a Global (window) Object. Settings this property allows you to disable
the creation of this object. Features like EvaluateScriptAsPromiseAsync that rely on
the creation of this object will no longer function.
- JavascriptObjectRepository generates object ids using a static counter, we need to get the object Id for this
test to be reliable, using an Object Id of 1 will fail if the test order isn't in a very specific order
* fix IsComplexType NullReferenceException
Sometimes, the registered Javascript object does not have a namespace, at this time this function will throw a ```NullReferenceException```.
* add unit test for IsComplexType
* Simplify and remove useless code
* Update CefSharp/Internals/JavascriptObjectRepository.cs
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
Co-authored-by: Alex Maitland <amaitland@users.noreply.github.com>
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
- 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