Er... Eval is blacklisted because it allows the execution of code that will be 
determined at runtime (so you could read a string from some source and execute 
it as JavaScript). And there's not a good way to make that secure, so that's 
why it's blacklisted.

But defining a complete anonymous function in code should work. What's the CSP 
error you're getting?

Un saludo,

Antonio


On 29/11/2013, at 15:41, "Joshua Smith" <[email protected]> wrote:

> This is blocked by the apps CSP.
>
> A better way (that is compatible with the CSP) would be:
>
> ***************************
> function make_alert() {
>  alert('hola');
>  setTimeout(make_alert, 1000);
> }
>
> function start() {
>  make_alert();
> }
>
> start();
> ****************************
>
> You can pass the function name as the first parameter to the setTimeout 
> function, and it will be called.  Passing complete functions to the timeout 
> is blacklisted for the same reasons as eval().
>
> Hope this helps!
>
> - Josh
>
>
> On 11/29/13, 9:20 AM, [email protected] wrote:
>> i have remove jquery and changed main.js to this one:
>>
>> ***************************
>>
>>    function make_alert(){
>>        alert('hola');
>>        setTimeout(function(){make_alert();},1000);
>>    }
>>
>>    function start(){
>>
>>        make_alert();
>>    }
>>
>>    start();
>>
>> ****************************
>>
>> and still does not work... :S
>>
>>
>>
>> On Friday, November 29, 2013 1:24:33 PM UTC+1, [email protected] wrote:
>>> Hi,
>>>
>>>
>>>
>>> It was impsoible for me to make work setTimeout on FirefoxOS. I have tested 
>>> on Firefox and chrome laptop browsers and works fine.. so i have made a 
>>> little example like this..
>>>
>>>
>>>
>>> index.html
>>>
>>> -------------
>>>
>>> <html>
>>>
>>>    <head>
>>>
>>>    </head>
>>>
>>>    <body>
>>>
>>>        <script src="jquery.min.js"></script>
>>>
>>>        <script src="main.js"></script>
>>>
>>>    </body>
>>>
>>> </html>
>>>
>>>
>>>
>>>
>>>
>>> main.js
>>>
>>> --------------
>>>
>>> $(function(){
>>>
>>>
>>>
>>>    function make_alert(){
>>>
>>>        alert('hola');
>>>
>>>        setTimeout(function(){make_alert();},1000);
>>>
>>>    }
>>>
>>>
>>>
>>>    function start(){
>>>
>>>
>>>
>>>        make_alert();
>>>
>>>    }
>>>
>>>
>>>
>>>    start();
>>>
>>>
>>>
>>> });
>>>
>>>
>>>
>>>
>>>
>>> this is a very simple example, that should run an alert every 1 second. 
>>> This runs on all browsers but not in FirefoxOS..
>>>
>>>
>>>
>>> i have read about security issues but i do not know how to do it work or 
>>> something similar.
>>>
>>>
>>>
>>> Regards.
>> _______________________________________________
>> dev-b2g mailing list
>> [email protected]
>> https://lists.mozilla.org/listinfo/dev-b2g
>
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g

________________________________

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar 
nuestra política de envío y recepción de correo electrónico en el enlace 
situado más abajo.
This message is intended exclusively for its addressee. We only send and 
receive email on the basis of the terms set out at:
http://www.tid.es/ES/PAGINAS/disclaimer.aspx
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to