Oh, I thought anonymous functions were blocked. Sorry for the error, must not be good at reading documentation.

- Josh


On 11/30/13, 12:00 AM, Jonas Sicking wrote:

Anonymous functions are not blocked by the CSP policy.

Only passing a string to setTimeout is blocked, but none of the examples here do that.

What error messages are you getting?

/ Jonas

On Nov 29, 2013 8:41 AM, "Joshua Smith" <[email protected] <mailto:[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]
    <mailto:[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] <mailto:[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] <mailto:[email protected]>
        https://lists.mozilla.org/listinfo/dev-b2g


    _______________________________________________
    dev-b2g mailing list
    [email protected] <mailto:[email protected]>
    https://lists.mozilla.org/listinfo/dev-b2g


_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to