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 21, 2018
1 parent 5f43bb4 commit f97d198
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 @@ -579,6 +579,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 @@ -611,6 +620,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 @@ -2272,6 +2272,15 @@ private void ZoomReset()
/// 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 @@ -2304,6 +2313,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 f97d198

Please sign in to comment.