Skip to content

Commit

Permalink
RegisterJsObject and RegisterAsyncJsObject can now only be used when …
Browse files Browse the repository at this point in the history
…CefSharpSettings.LegacyJavascriptBindingEnabled = true

See cefsharp#2246 for details
  • Loading branch information
amaitland committed Jan 22, 2018
1 parent 1aafd39 commit 6afccb2
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CefSharp.OffScreen/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,15 @@ public void Load(string url)
/// called before the underlying CEF browser is created.</exception>
public void RegisterJsObject(string name, object objectToBind, BindingOptions options = null)
{
if (!CefSharpSettings.LegacyJavascriptBindingEnabled)
{
throw new Exception(@"CefSharpSettings.LegacyJavascriptBindingEnabled is curretly false,
for legacy binding you must set CefSharpSettings.LegacyJavascriptBindingEnabled = true
before registering your first object see https://github.com/cefsharp/CefSharp/issues/2246
for details on the new binding options. If you perform cross-site navigations bound objects will
no longer be registered and you will have to migrate to the new method.");
}

if (IsBrowserInitialized)
{
throw new Exception("Browser is already initialized. RegisterJsObject must be" +
Expand Down Expand Up @@ -593,6 +602,15 @@ public void RegisterJsObject(string name, object objectToBind, BindingOptions op
/// object will be a standard javascript Promise object which is usable to wait for completion or failure.</remarks>
public void RegisterAsyncJsObject(string name, object objectToBind, BindingOptions options = null)
{
if (!CefSharpSettings.LegacyJavascriptBindingEnabled)
{
throw new Exception(@"CefSharpSettings.LegacyJavascriptBindingEnabled is curretly false,
for legacy binding you must set CefSharpSettings.LegacyJavascriptBindingEnabled = true
before registering your first object see https://github.com/cefsharp/CefSharp/issues/2246
for details on the new binding options. If you perform cross-site navigations bound objects will
no longer be registered and you will have to migrate to the new method.");
}

if (IsBrowserInitialized)
{
throw new Exception("Browser is already initialized. RegisterJsObject must be" +
Expand Down
18 changes: 18 additions & 0 deletions CefSharp.WinForms/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,15 @@ public void Load(String url)
/// called before the underlying CEF browser is created.</exception>
public void RegisterJsObject(string name, object objectToBind, BindingOptions options = null)
{
if (!CefSharpSettings.LegacyJavascriptBindingEnabled)
{
throw new Exception(@"CefSharpSettings.LegacyJavascriptBindingEnabled is curretly false,
for legacy binding you must set CefSharpSettings.LegacyJavascriptBindingEnabled = true
before registering your first object see https://github.com/cefsharp/CefSharp/issues/2246
for details on the new binding options. If you perform cross-site navigations bound objects will
no longer be registered and you will have to migrate to the new method.");
}

if (IsBrowserInitialized)
{
throw new Exception("Browser is already initialized. RegisterJsObject must be" +
Expand Down Expand Up @@ -520,6 +529,15 @@ public void RegisterJsObject(string name, object objectToBind, BindingOptions op
/// object will be a standard javascript Promise object which is usable to wait for completion or failure.</remarks>
public void RegisterAsyncJsObject(string name, object objectToBind, BindingOptions options = null)
{
if (!CefSharpSettings.LegacyJavascriptBindingEnabled)
{
throw new Exception(@"CefSharpSettings.LegacyJavascriptBindingEnabled is curretly false,
for legacy binding you must set CefSharpSettings.LegacyJavascriptBindingEnabled = true
before registering your first object see https://github.com/cefsharp/CefSharp/issues/2246
for details on the new binding options. If you perform cross-site navigations bound objects will
no longer be registered and you will have to migrate to the new method.");
}

if (IsBrowserInitialized)
{
throw new Exception("Browser is already initialized. RegisterJsObject must be" +
Expand Down
18 changes: 18 additions & 0 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,15 @@ public void UseLegacyKeyboardHandler()
/// called before the underlying CEF browser is created.</exception>
public void RegisterJsObject(string name, object objectToBind, BindingOptions options = null)
{
if(!CefSharpSettings.LegacyJavascriptBindingEnabled)
{
throw new Exception(@"CefSharpSettings.LegacyJavascriptBindingEnabled is curretly false,
for legacy binding you must set CefSharpSettings.LegacyJavascriptBindingEnabled = true
before registering your first object see https://github.com/cefsharp/CefSharp/issues/2246
for details on the new binding options. If you perform cross-site navigations bound objects will
no longer be registered and you will have to migrate to the new method.");
}

if (InternalIsBrowserInitialized())
{
throw new Exception("Browser is already initialized. RegisterJsObject must be" +
Expand Down Expand Up @@ -2226,6 +2235,15 @@ public void RegisterJsObject(string name, object objectToBind, BindingOptions op
/// object will be a standard javascript Promise object which is usable to wait for completion or failure.</remarks>
public void RegisterAsyncJsObject(string name, object objectToBind, BindingOptions options = null)
{
if (!CefSharpSettings.LegacyJavascriptBindingEnabled)
{
throw new Exception(@"CefSharpSettings.LegacyJavascriptBindingEnabled is curretly false,
for legacy binding you must set CefSharpSettings.LegacyJavascriptBindingEnabled = true
before registering your first object see https://github.com/cefsharp/CefSharp/issues/2246
for details on the new binding options. If you perform cross-site navigations bound objects will
no longer be registered and you will have to migrate to the new method.");
}

if (InternalIsBrowserInitialized())
{
throw new Exception("Browser is already initialized. RegisterJsObject must be" +
Expand Down

0 comments on commit 6afccb2

Please sign in to comment.