[Project_owners] methods and fields in XBL bindings

Eric Jung grimholtz at yahoo.com
Sat Apr 30 14:51:48 EDT 2005


Disclaimer: I know next to nothing about XBL.

Anytime I get JS errors that occur only sometimes, it's inevitably a
"timing" issue. In other words, sometimes the referred object has
been created before it's used, other times not.

The way I get around this is using setTimeout(fcn, msecs). You can
see firefox's browser.js does this in delayedOpenWindow() -- called,
I think, when you select file->open location.

So maybe you can move the code in your CDATA section into a function,
replacing the code within <body/> with setTimeout(fcn, 50) or the
like?


--- Philip Chee <philip at aleytys.pc.my> wrote:
> Flashbock uses userContent.css to bind flash objects to our XBL.
> We are trying to refactor the XBL but are running into several
> errors.
> However the errors don't ALWAYS occur, only about 50% of the time.
> 
> In our test XBL we have the following:
> 
> <binding id="flash">
>   <implementation>
>     <field name="test">
>       "test"
>     </field>
>     <method name="block">
>       <parameter name="type" />
>       <body>
>         <![CDATA[
> //...some code to do our bit.
>         ]]>
>       </body>
>     </method>
> 
>     <constructor>
>         this.block("flash");
>     </constructor>
>   </implementation>
> </binding>
> 
> The JS error we get is "this.block is not a function", however
> putting some
> alert boxes I find that SOMETIMES it's undefined, sometimes it
> works as
> expected.  Similarly the "test" field is sometimes undefined and
> sometimes
> returns the expected value.  What am I doing wrong?
> 
> Phil
> 
> -- 
> Philip Chee <philip at aleytys.pc.my>
> Guard us from the she-wolf and the wolf, and guard us from the
> thief,
> oh Night, and so be good for us to pass.
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Project_owners mailing list