This project is read-only.
1
Vote

Issue in CallJavaScriptFunction wrapper method

description

After creating a Collection<JSValue> with a string value and calling CallJavaScriptFunction method on the WebView object the following exception is thrown:
 
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=AwesomiumDotNet
StackTrace:
   at AwesomiumDotNet.WebView.CallJavaScriptFunction(String objectName, String functionName, Collection`1 args)
   at Program.AddJQueryReference(WebView webView) in C:\Projects\Program.cs:line 89
   at Program.<>c__DisplayClass4.<NavigateToPage>b__0(Object a, FinishLoadingEventArgs b) in C:\Projects\Program.cs:line 51
   at AwesomiumDotNet.WebView.raise_FinishLoading(Object value0, FinishLoadingEventArgs value1)
   at AwesomiumDotNet.WebView.OnFinishLoading(FinishLoadingEventArgs args)
   at AwesomiumDotNet.WebViewListenerWrapper.onFinishLoading(WebViewListenerWrapper* , WebView* caller)
   at Awesomium.WebCore.update(WebCore* )
   at AwesomiumDotNet.WebCore.Update()
   at Program.NavigateToPage(WebCore webCore, WebView webView, String url, Int32 timeoutDuration) in C:\Projects\Program.cs:line 60
   at Program.NavigateToPage(WebCore webCore, WebView webView, String url) in C:\Projects\Program.cs:line 42
   at Program.Main(String[] args) in C:\Projects\Program.cs:line 26
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
InnerException:
 
Code:
Collection<JSValue> values = new Collection<JSValue>();
values.Add(new JSValue("document.bgColor = '#000099'"));
 
webView.CallJavaScriptFunction("", "eval", values);

comments

DanDixon wrote Aug 10, 2010 at 9:27 PM

You might try making sure webview.isdirty = false before you use CallJavaScriptFunction.

I believe I ran into something similar but haven't had any problems after injecting javascript calls after 'clearing' the webview.

Sleepyhead wrote Aug 12, 2010 at 4:24 AM

No luck there even after 'clearing'... Oddly enough any javascript calls don't seem to work for me. Do you have a code sample I might be able to use?

Sleepyhead wrote Aug 12, 2010 at 4:26 AM

Btw, this is with the latest checkin and 1.6 beta code

freedompeace wrote Jan 26, 2011 at 3:30 AM

I get this too ):

Please help!

wrote Feb 14, 2013 at 2:38 AM