In Firefox OS setTimeout and setInterval method does not support for Firefox OS content security policy ( https://developer.mozilla.org/Apps/CSP ). But if i want to use this type of method then what will be the process instead of this method.
Asked
Active
Viewed 1,560 times
1 Answers
7
"Dynamic code execution with setTimeout and setInterval is banned"
"You MUST pass callable objects (i.e.: functions) to the setTimeout and setInterval functions. Passing strings will not create the timer and the function will return 0."
It doesn't disallow setTimeout
and setInterval
. It only bans passing strings to them, ie the following won't work
setTimeout('x = 5', 500);
but this will still work
setTimeout(function() { x = 5; }, 500);
Seriously, who would ban that?

Khanh Nguyen
- 11,112
- 10
- 52
- 65
-
This is a very good idea, if this dynamic code were allowed all kinds of crapware could be added without an ability to verify the integrity of the code, in fact every other similar API (android, ios) has something similar. – John Smith Jun 22 '15 at 22:28