Hi antoine,
could you give me a peace of your code for how to create/add a new
class/function, please ?
i'm currently working on javascript functions.
And my question is : what's the purpose to add javascript functions while a
document is loading ?
Thanks.
--
Béatrice Philippe-Derbez
--
Béatrice Philippe-Derbez
Urbilog.
80, rue d'Iéna.
59000 Lille.
01-69-88-08-11
06-77-88-92-51
"Antoine Viau" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Finally i got a solution. Here it is :
> You cannot add a new class/function until the document has been loaded.
> But you cannot use your new class/function while loading.
> So what to do ?
> Find the "moment" where the document is initialized and empty, then add
> your class/function.
> This "moment" is in OnStateChange (nsIProgressListener) when the flag is
> STATE_START.
> So :
> NS_IMETHODIMP WebBrowserChrome::OnStateChange(nsIWebProgress *progress,
> nsIRequest *request,
> PRUint32 progressStateFlags, nsresult status)
> {
> if ( progressStateFlags & STATE_START )
> {
> CreateMyClassAndFunctions();
> }
> ...
> }
>
> Antoine
>
> "Antoine Viau" <[EMAIL PROTECTED]> a écrit dans le message de news:
> [EMAIL PROTECTED]
>> Hi there,
>>
>> I have embedded Gecko in my app and I am able do extend the Javascript
>> functions and classes.
>> BUT...
>> The functions and classes are recognized only when the page is full
>> loaded.
>> Means that I cannot use my functions/classes until the onload event has
>> fired.
>> I would like to call my functions/classes at "loading-runtime".
>> This should works with something like this :
>> <html>
>> <body>
>> <div>This is a div</div>
>> <script language="javascript">
>> My_Function_Written_In_C(some_param);
>> </script>
>> </body>
>> </html>
>>
>> To create classes and add functions, I read this :
>> http://users.skynet.be/saw/SpiderMonkey.htm (classes)
>> and this :
>> http://orange.kame.net/dev/cvsweb.cgi/mozilla/js/ref/README?cvsroot=mozilla6&rev=1.1.1.2
>>
>> (functions)
>>
>> I tried to put the code which initialize the new functions at STATE_START
>> in the Chrome::OnProgressChange handler. But it does not work.
>>
>> Any idea ?
>>
>> Thx
>> Antoine
>>
>
>
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding