What does while(1) in Gmail do [duplicate]
Possib开发者_C百科le Duplicate:
Why have “while(1);” in XmlHttpRequest response?
If you take a peek at the XHR POST requests that Gmail makes to the server when it updates the list of your email, you will see that each response starts with:
while(1);
[[["v","CKbPYpt__Vc.en.","8","d7634f09ff9e61c8"]
,["di",342]
,["ub",[["^i",1296218266987]
,["^f",1296218266987]
(...)
Why does Google start each response with endless loop?
I read that it is a security trick http://my.opera.com/hallvors/blog/show.dml/260127 but I am not sure how it is supposed to be a good security measure.
Taking a guess... So that any malicious attempt to eval
the response or point a <script>
block at the resource, rather than parsing it properly, will fail.
精彩评论