[whatwg] Side effects free scripts
alexey at feldgendler.ru
Sun May 28 03:23:07 PDT 2006
On Sun, 28 May 2006 17:05:45 +0700, Sjoerd Visscher <sjoerd at w3future.com>
>> When a script thread is in side effect free mode:
>> 1. It stays in this mode until the thread completes.
>> 2. It can call any non-native function, but the same restrictions
>> 3. It cannot assign any variables except locals.
>> 4. It cannot call any native function except those specifically marked
>> by the spec as side effects free. For example, sin() is side effects
>> free, and window.open() is not.
>> 5. It can read any property that can be normally read.
>> 6. It cannot assign any property for which a native setter function is
> Ok, here you make it clear that with side effects you only mean visible
> side effects?
No, all side effects in the mathematical sense. The script is not allowed
to alter the state of the world in any way.
No, that's included in "It cannot assign any variables except locals".
Maybe I should make it explicit that it also applies to properties of
>> 7. It cannot create new object instances except those specifically
>> marked by the spec as side effects free. For example, RegExp is side
>> effects free, and Image is not.
> Creating an Image should be allowed. It might be needed for
> measurements. Appending it to the document shouldn't.
Creating an Image may initiate a download. That's a side effect, and, in
fact, creating Image objects is widely used to steal cookies.
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com
More information about the whatwg