Make AMP robust when it is loaded into sandbox or data URI. (#3005)
Make AMP robust when it is loaded into sandbox or data URI. (#3005)

In that case setting or reading a cookie may throw an exception.
See e.g. http://output.jsbin.com/tihozejapi/quiet

Affects #2952
Gregable/amphtml,wjfang/amphtml,wjfang/amphtml,adup-tech/amphtml,sebastianbenz/amphtml,sklobovskaya/amphtml,powdercloud/amphtml,rifler/amphtml,adup-tech/amphtml,gumgum/amphtml,vmarteev/amphtml,rsimha-amp/amphtml,yandex-pcode/amphtml,criteo-forks/amphtml,ADITION/amphtml,dvoytenko/amphtml,spotxchange/amphtml,DarXector/amphtml,kixer-com/amphtml,DistroScale/amphtml,nexxtv/amphtml,rsimha-amp/amphtml,aghassemi/amphtml,cory-work/amphtml,media-net/amphtml,Mobusi-ads/amphtml,aghassemi/amphtml,yevheniiminin/amphtml,sortable/amphtml,jasti/amphtml,donttrustthisbot/amphtml,tlong2/amphtml,mkhatib/amphtml,donttrustthisbot/amphtml,Adtoma/amphtml,britice/amphtml,taboola/amphtml,techhtml/amphtml,jlucero-contentad/amphtml,zhouyx/amphtml,voyagegroup/amphtml,kamtschatka/amphtml,DarXector/amphtml,rifler/amphtml,rsimha-amp/amphtml,DarXector/amphtml,interspacejp/amphtml,kixer-com/amphtml,bpaduch/amphtml,amoad-amoe/amphtml,tlong2/amphtml,sklobovskaya/amphtml,DistroScale/amphtml,rsimha-amp/amphtml,bpaduch/amphtml,danielrozenberg/amphtml,jdelhommeau/amphtml,yevheniiminin/amphtml,ampproject/amphtml,techhtml/amphtml,kixer-com/amphtml,powdercloud/amphtml,media-net/amphtml,BenDz/amphtml-atinternet,sortable/amphtml,bpaduch/amphtml,alanorozco/amphtml,sebastianbenz/amphtml,yandex-pcode/amphtml,sortable/amphtml,aghassemi/amphtml,kmh287/amphtml,widespace-os/amphtml,engtat/amphtml,src-code/amphtml,ericlindley-g/amphtml,Lith/amphtml,adtechnology/amphtml,rlugojr/amphtml,cory-work/amphtml,tdrl/amphtml,chaveznvg/amphtml,alanorozco/amphtml,zhouyx/amphtml,camelburrito/amphtml,sebastianbenz/amphtml,ecoron/amphtml,src-code/amphtml,pedjoni8/amphtml,lannka/amphtml,triplelift/amphtml,zhangsu/amphtml,techhtml/amphtml,yevheniiminin/amphtml,taboola/amphtml,mlb7687/amphtml,Adtoma/amphtml,rlugojr/amphtml,camelburrito/amphtml,adtechnology/amphtml,pedjoni8/amphtml,ampproject/amphtml,prateekbh/amphtml,Gregable/amphtml,mkhatib/amphtml,erwinmombay/amphtml,smartadserver/amphtml,luciancrasovan/amphtml,jdelhommeau/amphtml,sriramkrish85/amphtml,jridgewell/amphtml,donttrustthisbot/amphtml,arealit/amphtml,kixer-com/amphtml,avimehta/amphtml,koshka/amphtml,britice/amphtml,lzanol/amphtml,ampproject/amphtml,alanorozco/amphtml,yevheniiminin/amphtml,erwinmombay/amphtml,rajkumarsrk/amphtml,jdelhommeau/amphtml,yieldmo/amphtml,BrightcoveOS/amphtml,interspacejp/amphtml,mhc-gh/amphtml,Gregable/amphtml,AaronCritchley/amphtml,nexxtv/amphtml,BenDz/amphtml,sriramkrish85/amphtml,Mobusi-ads/amphtml,AaronCritchley/amphtml,jmadler/amphtml,keithwrightbos/amphtml,yieldmo/amphtml,lannka/amphtml,donttrustthisbot/amphtml,prateekbh/amphtml,engtat/amphtml,kamtschatka/amphtml,clawr/amphtml,Mixpo/amphtml,sharethrough/amphtml,rajkumarsrk/amphtml,luciancrasovan/amphtml,cvializ/amphtml,triplelift/amphtml,tdrl/amphtml,JuliusThms/amphtml,prateekbh/amphtml,interspacejp/amphtml,sklobovskaya/amphtml,shawnbuso/amphtml,src-code/amphtml,chaveznvg/amphtml,AaronCritchley/amphtml,zhucl/amphtml,comScore/amphtml,media-net/amphtml,adup-tech/amphtml,mkhatib/amphtml,amoad-amoe/amphtml,cory-work/amphtml,zhucl/amphtml,Mixpo/amphtml,honeybadgerdontcare/amphtml,bpaduch/amphtml,dotandads/amphtml,dotandads/amphtml,voyagegroup/amphtml,sriramkrish85/amphtml,yieldbot/amphtml,camelburrito/amphtml,cvializ/amphtml,ampproject/amphtml,mlb7687/amphtml,sklobovskaya/amphtml,AaronCritchley/amphtml,dvoytenko/amphtml,criteo-forks/amphtml,BrightcoveOS/amphtml,taboola/amphtml,adtechnology/amphtml,arealit/amphtml,jridgewell/amphtml,rajkumarsrk/amphtml,shawnbuso/amphtml,cory-work/amphtml,adup-tech/amphtml,sebastianbenz/amphtml,kmh287/amphtml,koshka/amphtml,Gregable/amphtml,JuliusThms/amphtml,techhtml/amphtml,Mobusi-ads/amphtml,yieldbot/amphtml,avimehta/amphtml,lannka/amphtml,JuliusThms/amphtml,kixer-com/amphtml,BenDz/amphtml,laterpay/amphtml,rlugojr/amphtml,cory-work/amphtml,danielrozenberg/amphtml,adiant/amphtml,jdelhommeau/amphtml,pietergreyling/amphtml,jlucero-contentad/amphtml,jpettitt/amphtml,Mobusi-ads/amphtml,rsimha-amp/amphtml,BenDz/amphtml,dotandads/amphtml,prateekbh/amphtml,ruturajv-media-net/amphtml,kixer-com/amphtml,ADITION/amphtml,yandex-pcode/amphtml,zhangsu/amphtml,amoad-amoe/amphtml,yieldbot/amphtml,mhc-gh/amphtml,media-net/amphtml,lannka/amphtml,zhucl/amphtml,media-net/amphtml,mhc-gh/amphtml,wjfang/amphtml,jmadler/amphtml,ruturajv-media-net/amphtml,cvializ/amphtml,koshka/amphtml,luciancrasovan/amphtml,wjfang/amphtml,tlong2/amphtml,erwinmombay/amphtml,DistroScale/amphtml,pietergreyling/amphtml,dvoytenko/amphtml,sriramkrish85/amphtml,nexxtv/amphtml,yandex-pcode/amphtml,chaveznvg/amphtml,Adtoma/amphtml,luciancrasovan/amphtml,adiant/amphtml,jridgewell/amphtml,wjfang/amphtml,burtcorp/amphtml,tdrl/amphtml,honeybadgerdontcare/amphtml,ecoron/amphtml,DistroScale/amphtml,sortable/amphtml,dotandads/amphtml,zhucl/amphtml,keithwrightbos/amphtml,widespace-os/amphtml,sharethrough/amphtml,dotandads/amphtml,spotxchange/amphtml,adtechnology/amphtml,rifler/amphtml,amoad-amoe/amphtml,JuliusThms/amphtml,jpettitt/amphtml,BenDz/amphtml-atinternet,rajkumarsrk/amphtml,zhangsu/amphtml,jmadler/amphtml,powdercloud/amphtml,jasti/amphtml,vmarteev/amphtml,lzanol/amphtml,src-code/amphtml,cory-work/amphtml,JuliusThms/amphtml,devjsun/amphtml,BrightcoveOS/amphtml,erwinmombay/amphtml,yandex-pcode/amphtml,gumgum/amphtml,yieldbot/amphtml,fullspeed-sp/amphtml,jmadler/amphtml,luciancrasovan/amphtml,DAC-f1h-dev/amphtml,jlucero-contentad/amphtml,fullspeed-sp/amphtml,jpettitt/amphtml,adiant/amphtml,rifler/amphtml,erwinmombay/amphtml,criteo-forks/amphtml,prateekbh/amphtml,widespace-os/amphtml,techhtml/amphtml,donttrustthisbot/amphtml,jridgewell/amphtml,Mixpo/amphtml,sriramkrish85/amphtml,triplelift/amphtml,bpaduch/amphtml,cvializ/amphtml,jdelhommeau/amphtml,honeybadgerdontcare/amphtml,devjsun/amphtml,DarXector/amphtml,camelburrito/amphtml,BrightcoveOS/amphtml,yieldmo/amphtml,ruturajv-media-net/amphtml,ecoron/amphtml,comScore/amphtml,tlong2/amphtml,zhouyx/amphtml,engtat/amphtml,taboola/amphtml,Mixpo/amphtml,sklobovskaya/amphtml,sriramkrish85/amphtml,adiant/amphtml,DistroScale/amphtml,adtechnology/amphtml,zhangsu/amphtml,mlb7687/amphtml,mlb7687/amphtml,spotxchange/amphtml,jmadler/amphtml,tdrl/amphtml,Lith/amphtml,interspacejp/amphtml,devjsun/amphtml,rsimha-amp/amphtml,camelburrito/amphtml,vmarteev/amphtml,BrightcoveOS/amphtml,AaronCritchley/amphtml,lannka/amphtml,keithwrightbos/amphtml,Mixpo/amphtml,lzanol/amphtml,kmh287/amphtml,sortable/amphtml,chaveznvg/amphtml,gumgum/amphtml,engtat/amphtml,DAC-f1h-dev/amphtml,alanorozco/amphtml,pietergreyling/amphtml,luciancrasovan/amphtml,danielrozenberg/amphtml,dvoytenko/amphtml,gumgum/amphtml,ampproject/amphtml,ecoron/amphtml,adiant/amphtml,jridgewell/amphtml,mhc-gh/amphtml,media-net/amphtml,zhucl/amphtml,prateekbh/amphtml,alanorozco/amphtml,BrightcoveOS/amphtml,jlucero-contentad/amphtml,ADITION/amphtml,alanorozco/amphtml,jpettitt/amphtml,ericlindley-g/amphtml,amoad-amoe/amphtml,cory-work/amphtml,yandex-pcode/amphtml,mlb7687/amphtml,devjsun/amphtml,kixer-com/amphtml,jasti/amphtml,koshka/amphtml,nexxtv/amphtml,powdercloud/amphtml,jasti/amphtml,ampproject/amphtml,comScore/amphtml,fullspeed-sp/amphtml,yieldmo/amphtml,smartadserver/amphtml,ecoron/amphtml,tlong2/amphtml,keithwrightbos/amphtml,spotxchange/amphtml,camelburrito/amphtml,avimehta/amphtml,honeybadgerdontcare/amphtml,arealit/amphtml,rlugojr/amphtml,pedjoni8/amphtml,keithwrightbos/amphtml,Adtoma/amphtml,clawr/amphtml,cvializ/amphtml,lzanol/amphtml,lannka/amphtml,lzanol/amphtml,engtat/amphtml,smartadserver/amphtml,ruturajv-media-net/amphtml,rifler/amphtml,pedjoni8/amphtml,jridgewell/amphtml,adiant/amphtml,widespace-os/amphtml,burtcorp/amphtml,danielrozenberg/amphtml,prateekbh/amphtml,nexxtv/amphtml,Lith/amphtml,bpaduch/amphtml,vmarteev/amphtml,interspacejp/amphtml,mhc-gh/amphtml,yieldbot/amphtml,voyagegroup/amphtml,Adtoma/amphtml,techhtml/amphtml,shawnbuso/amphtml,Mobusi-ads/amphtml,src-code/amphtml,arealit/amphtml,jpettitt/amphtml,devjsun/amphtml,donttrustthisbot/amphtml,jpettitt/amphtml,avimehta/amphtml,kmh287/amphtml,jdelhommeau/amphtml,ADITION/amphtml,yieldbot/amphtml,clawr/amphtml,burtcorp/amphtml,nexxtv/amphtml,smartadserver/amphtml,Lith/amphtml,ampproject/amphtml,criteo-forks/amphtml,mhc-gh/amphtml,zhouyx/amphtml,sharethrough/amphtml,jpettitt/amphtml,alanorozco/amphtml,dvoytenko/amphtml,avimehta/amphtml,ericlindley-g/amphtml,yevheniiminin/amphtml,kamtschatka/amphtml,laterpay/amphtml,cvializ/amphtml,burtcorp/amphtml,pedjoni8/amphtml,arealit/amphtml,shawnbuso/amphtml,sklobovskaya/amphtml,sortable/amphtml,danielrozenberg/amphtml,dotandads/amphtml,vmarteev/amphtml,powdercloud/amphtml,clawr/amphtml,laterpay/amphtml,chaveznvg/amphtml,tdrl/amphtml,wjfang/amphtml,ericlindley-g/amphtml,kamtschatka/amphtml,britice/amphtml,taboola/amphtml,Gregable/amphtml,voyagegroup/amphtml,laterpay/amphtml,voyagegroup/amphtml,donttrustthisbot/amphtml,voyagegroup/amphtml,dvoytenko/amphtml,taboola/amphtml,shawnbuso/amphtml,zhouyx/amphtml,fullspeed-sp/amphtml,mkhatib/amphtml,honeybadgerdontcare/amphtml,spotxchange/amphtml,JuliusThms/amphtml,shawnbuso/amphtml,mhc-gh/amphtml,pietergreyling/amphtml,alanorozco/amphtml,DarXector/amphtml,zhucl/amphtml,yandex-pcode/amphtml,vmarteev/amphtml,AaronCritchley/amphtml,pietergreyling/amphtml,jasti/amphtml,smartadserver/amphtml,tdrl/amphtml,pedjoni8/amphtml,jmadler/amphtml,sebastianbenz/amphtml,engtat/amphtml,jlucero-contentad/amphtml,ruturajv-media-net/amphtml,kamtschatka/amphtml,powdercloud/amphtml,criteo-forks/amphtml,bpaduch/amphtml,arealit/amphtml,zhouyx/amphtml,ericlindley-g/amphtml,avimehta/amphtml,ruturajv-media-net/amphtml,comScore/amphtml,powdercloud/amphtml,aghassemi/amphtml,yieldmo/amphtml,burtcorp/amphtml,comScore/amphtml,gumgum/amphtml,chaveznvg/amphtml,media-net/amphtml,BenDz/amphtml-atinternet,DAC-f1h-dev/amphtml,BenDz/amphtml,smartadserver/amphtml,lannka/amphtml,yieldmo/amphtml,nexxtv/amphtml,camelburrito/amphtml,ampproject/amphtml,DAC-f1h-dev/amphtml,laterpay/amphtml,yevheniiminin/amphtml,taboola/amphtml,rlugojr/amphtml,mhc-gh/amphtml,triplelift/amphtml,interspacejp/amphtml,rajkumarsrk/amphtml,koshka/amphtml,Lith/amphtml,widespace-os/amphtml,Gregable/amphtml,mkhatib/amphtml,amoad-amoe/amphtml,zhangsu/amphtml,adup-tech/amphtml,sharethrough/amphtml,voyagegroup/amphtml,Gregable/amphtml,fullspeed-sp/amphtml,kamtschatka/amphtml,rajkumarsrk/amphtml,honeybadgerdontcare/amphtml,Mixpo/amphtml,arealit/amphtml,aghassemi/amphtml,zhucl/amphtml,BenDz/amphtml,erwinmombay/amphtml,gumgum/amphtml,britice/amphtml,shawnbuso/amphtml,clawr/amphtml,Adtoma/amphtml,BenDz/amphtml,triplelift/amphtml,sklobovskaya/amphtml,luciancrasovan/amphtml,wjfang/amphtml,rlugojr/amphtml,jasti/amphtml,keithwrightbos/amphtml,gumgum/amphtml,honeybadgerdontcare/amphtml,clawr/amphtml,vmarteev/amphtml,mlb7687/amphtml,triplelift/amphtml,danielrozenberg/amphtml,jpettitt/amphtml,danielrozenberg/amphtml,zhangsu/amphtml,pietergreyling/amphtml,zhouyx/amphtml,DistroScale/amphtml,devjsun/amphtml,kmh287/amphtml,jridgewell/amphtml,yieldmo/amphtml,sebastianbenz/amphtml,widespace-os/amphtml,danielrozenberg/amphtml,clawr/amphtml,laterpay/amphtml,engtat/amphtml,aghassemi/amphtml,adtechnology/amphtml,fullspeed-sp/amphtml,adup-tech/amphtml,media-net/amphtml,koshka/amphtml,rajkumarsrk/amphtml,spotxchange/amphtml,lzanol/amphtml,burtcorp/amphtml,mkhatib/amphtml,Mobusi-ads/amphtml,jlucero-contentad/amphtml,tlong2/amphtml,sharethrough/amphtml,sharethrough/amphtml,rifler/amphtml,ecoron/amphtml,ericlindley-g/amphtml,comScore/amphtml,DAC-f1h-dev/amphtml,kmh287/amphtml,rsimha-amp/amphtml,src-code/amphtml,DarXector/amphtml,keithwrightbos/amphtml,DAC-f1h-dev/amphtml,comScore/amphtml,Lith/amphtml,criteo-forks/amphtml,Gregable/amphtml,ADITION/amphtml,adiant/amphtml