[Mono-winforms-list] Mono webBrowser1.Document.InvokeScript Error on Linux

Andreia Gaita shana.ufie at gmail.com
Wed May 13 17:45:49 EDT 2009


So you hit two problems here: one is a bug on the WebBrowser control
itself, and the other is a threading problem on gluezilla. Nice shot!
Both are fixed on svn.

andreia|gaita

On Wed, May 6, 2009 at 3:35 AM, Miller.HE <hhw-eboy at 163.com> wrote:
>
>
>
> Andreia Gaita wrote:
>>
>> A bit more info would be helpful. What are you trying to do, exactly?
>> Do you have a test case handy?
>>
>> andreia|gaita
>>
>> On Wed, Apr 15, 2009 at 9:35 AM, Miller.HE <hhw-eboy at 163.com> wrote:
>>>
>>>  at (wrapper runtime-invoke)
>>> TestMono.Form1.runtime_invoke_void__this___string
>>> (object,intptr,intptr,intptr) <0xffffffff>
>>>  at (wrapper managed-to-native)
>>> System.Reflection.MonoMethod.InternalInvoke
>>> (object,object[],System.Exception&) <0x00004>
>>>  at (wrapper managed-to-native)
>>> System.Reflection.MonoMethod.InternalInvoke
>>> (object,object[],System.Exception&) <0xffffffff>
>>>  at System.Reflection.MonoMethod.Invoke
>>> (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
>>> <0x000a6>
>>>  at System.Reflection.MethodBase.Invoke (object,object[]) <0x0001a>
>>>  at System.Delegate.DynamicInvokeImpl (object[]) <0x00170>
>>>  at System.MulticastDelegate.DynamicInvokeImpl (object[]) <0x0002a>
>>>  at System.Delegate.DynamicInvoke (object[]) <0x0000e>
>>>  at System.Windows.Forms.Control.Invoke (System.Delegate,object[])
>>> <0x00036>
>>>  at TestMono.Form1.SetButton (string) <0x0008b>
>>>
>>> Help me!
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Mono-webBrowser1.Document.InvokeScript-Error-on-Linux-tp23054940p23054940.html
>>> Sent from the Mono - WinForms mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>>>
>>
>> <div><br></div>
>> _______________________________________________
>> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>>
>>
>
> They complete code
>
> ------------------------------------------------------------------------------------------------
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Text;
> using System.Windows.Forms;
>
> namespace TestMono
> {
>    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
>    public partial class Form1 : Form
>    {
>        //ÉèÖÃÌøת
>        delegate void SetUrlCallback(string _url);
>
>        public void SetUrl(string _url)
>        {
>            //this.webBrowser1.Url = new Uri(_url);
>
>            if (this.webBrowser1.InvokeRequired)
>            {
>                SetUrlCallback d = new SetUrlCallback(SetUrl);
>                this.Invoke(d, new object[] { _url });
>            }
>            else
>            {
>                this.webBrowser1.Navigate(_url);
>            }
>        }
>
>        //ÉèÖù¦ÄÜ°´¼ü
>        delegate void SetButtonCallback(string _code);
>
>        public void SetButton(string _code)
>        {
>            if (this.webBrowser1.InvokeRequired)
>            {
>                SetButtonCallback d = new SetButtonCallback(SetButton);
>                this.Invoke(d, new object[] { _code });
>            }
>            else
>            {
>                object[] objects = new object[1];
>
>                objects[0] = (Object)_code;
>
>                webBrowser1.Document.InvokeScript("SetButton", objects);
>            }
>        }
>
>        public Form1()
>        {
>            InitializeComponent();
>        }
>
>        private void Form1_Load(object sender, EventArgs e)
>        {
>            webBrowser1.ObjectForScripting = this;
>
>            string _app = Application.StartupPath;
>
>            SetUrl(_app + "//indexA.html");
>
>        }
>
>        private void webBrowser1_DocumentCompleted(object sender,
> WebBrowserDocumentCompletedEventArgs e)
>        {
>            SetButton("Hello World!");
>        }
>    }
> }
>
> ------------------------------------------------------------------------------------------------------------
>
> Html code
>
> <html>
> <head>
> <script language="javascript">
> function SetButton(_msg)
> {
>  IE=(document.all) ? 1 : 0;
>
>  if(IE)
>  {
>    document.getElementById("Content").innerHTML= _msg;
>    return false;
>  }
>
>  document.getElementById("Content").innerHTML= _msg;
> }
> </script>
> </head>
> <body>
> <div id="Content"></div>
> </body>
> </html>
>
> -------------------------------------------------------------------------
> MoMA scan report
>
> Scan Date: 2009-5-6 10:34:27
> MoMA Definitions: Mono 2.4 (Revised)
>
> For descriptions of issues, see MoMA Issue Descriptions.
>  Assembly Version Missing Not Implemented Todo P/Invoke
>  TestMono.exe 1.0.0.0 0 0 2 0
>  Calling Method Method with [MonoTodo] Reason
> void InitializeComponent () void WebBrowser..ctor () Stub, not implemented
> void Form1_Load (Object, EventArgs) void WebBrowser.set_ObjectForScripting
> (Object) Stub, not implemented
>
>
> --
> View this message in context: http://www.nabble.com/Mono-webBrowser1.Document.InvokeScript-Error-on-Linux-tp23054940p23399075.html
> Sent from the Mono - WinForms mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>


More information about the Mono-winforms-list mailing list