When JavaScript call WebSocket.close() before onopen event happens, IPCWebSocketStreamHandleBridge::Close() run ahead of DoConnect(). In this case, DoClose() do nothing because the object doesn't have a correct socket_id_. This change move actual Close() handling to DoClose(), then make Close() post DoClose() as delayed task to keep execution ordering.
When JavaScript call WebSocket.close() before onopen event happens,
IPCWebSocketStreamHandleBridge::Close() run ahead of DoConnect(). In this case,
DoClose() do nothing because the object doesn't have a correct socket_id_.
This change move actual Close() handling to DoClose(), then make Close() post
DoClose() as delayed task to keep execution ordering.

BUG=93698
TEST=chrome LayoutTests/http/tests/websocket/tests/hybi/close-before-open.html

Review URL: http://codereview.chromium.org/7703008

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@97852 0039d316-1c4b-4281-b951-d872f2087c98

robclark/chromium,Just-D/chromium-1,M4sse/chromium.src,nacl-webkit/chrome_deps,pozdnyakov/chromium-crosswalk,patrickm/chromium.src,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,nacl-webkit/chrome_deps,M4sse/chromium.src,littlstar/chromium.src,rogerwang/chromium,Just-D/chromium-1,ltilve/chromium,keishi/chromium,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,mogoweb/chromium-crosswalk,zcbenz/cefode-chromium,bright-sparks/chromium-spacewalk,patrickm/chromium.src,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk-efl,timopulkkinen/BubbleFish,rogerwang/chromium,junmin-zhu/chromium-rivertrail,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,Just-D/chromium-1,Jonekee/chromium.src,patrickm/chromium.src,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,mogoweb/chromium-crosswalk,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,dushu1203/chromium.src,littlstar/chromium.src,axinging/chromium-crosswalk,littlstar/chromium.src,dushu1203/chromium.src,Just-D/chromium-1,ChromiumWebApps/chromium,keishi/chromium,M4sse/chromium.src,junmin-zhu/chromium-rivertrail,axinging/chromium-crosswalk,ondra-novak/chromium.src,nacl-webkit/chrome_deps,hujiajie/pa-chromium,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,robclark/chromium,M4sse/chromium.src,ltilve/chromium,M4sse/chromium.src,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,fujunwei/chromium-crosswalk,hujiajie/pa-chromium,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,timopulkkinen/BubbleFish,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,pozdnyakov/chromium-crosswalk,Pluto-tv/chromium-crosswalk,axinging/chromium-crosswalk,Chilledheart/chromium,bright-sparks/chromium-spacewalk,Chilledheart/chromium,ltilve/chromium,dednal/chromium.src,Jonekee/chromium.src,markYoungH/chromium.src,littlstar/chromium.src,jaruba/chromium.src,dednal/chromium.src,zcbenz/cefode-chromium,hujiajie/pa-chromium,dushu1203/chromium.src,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,keishi/chromium,Fireblend/chromium-crosswalk,nacl-webkit/chrome_deps,Chilledheart/chromium,timopulkkinen/BubbleFish,mogoweb/chromium-crosswalk,ChromiumWebApps/chromium,Chilledheart/chromium,markYoungH/chromium.src,ondra-novak/chromium.src,patrickm/chromium.src,anirudhSK/chromium,robclark/chromium,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,ondra-novak/chromium.src,nacl-webkit/chrome_deps,rogerwang/chromium,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,Chilledheart/chromium,ondra-novak/chromium.src,zcbenz/cefode-chromium,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,timopulkkinen/BubbleFish,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,bright-sparks/chromium-spacewalk,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,ondra-novak/chromium.src,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,anirudhSK/chromium,ChromiumWebApps/chromium,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,keishi/chromium,nacl-webkit/chrome_deps,robclark/chromium,hgl888/chromium-crosswalk,hujiajie/pa-chromium,patrickm/chromium.src,dednal/chromium.src,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,Chilledheart/chromium,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,M4sse/chromium.src,dushu1203/chromium.src,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,timopulkkinen/BubbleFish,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,fujunwei/chromium-crosswalk,mogoweb/chromium-crosswalk,ltilve/chromium,zcbenz/cefode-chromium,Chilledheart/chromium,M4sse/chromium.src,patrickm/chromium.src,ChromiumWebApps/chromium,pozdnyakov/chromium-crosswalk,chuan9/chromium-crosswalk,dushu1203/chromium.src,rogerwang/chromium,mogoweb/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Jonekee/chromium.src,anirudhSK/chromium,ltilve/chromium,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,keishi/chromium,chuan9/chromium-crosswalk,zcbenz/cefode-chromium,ondra-novak/chromium.src,nacl-webkit/chrome_deps,littlstar/chromium.src,markYoungH/chromium.src,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,junmin-zhu/chromium-rivertrail,hujiajie/pa-chromium,crosswalk-project/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,chuan9/chromium-crosswalk,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,zcbenz/cefode-chromium,markYoungH/chromium.src,Jonekee/chromium.src,zcbenz/cefode-chromium,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,hgl888/chromium-crosswalk-efl,ondra-novak/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,anirudhSK/chromium,junmin-zhu/chromium-rivertrail,pozdnyakov/chromium-crosswalk,jaruba/chromium.src,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,Just-D/chromium-1,littlstar/chromium.src,ltilve/chromium,jaruba/chromium.src,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,Fireblend/chromium-crosswalk,Just-D/chromium-1,krieger-od/nwjs_chromium.src,patrickm/chromium.src,markYoungH/chromium.src,Fireblend/chromium-crosswalk,mogoweb/chromium-crosswalk,Jonekee/chromium.src,markYoungH/chromium.src,keishi/chromium,dednal/chromium.src,rogerwang/chromium,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,anirudhSK/chromium,dednal/chromium.src,rogerwang/chromium,dushu1203/chromium.src,jaruba/chromium.src,Jonekee/chromium.src,jaruba/chromium.src,bright-sparks/chromium-spacewalk,keishi/chromium,Chilledheart/chromium,nacl-webkit/chrome_deps,anirudhSK/chromium,junmin-zhu/chromium-rivertrail,Fireblend/chromium-crosswalk,timopulkkinen/BubbleFish,robclark/chromium,ondra-novak/chromium.src,markYoungH/chromium.src,rogerwang/chromium,Pluto-tv/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,junmin-zhu/chromium-rivertrail,TheTypoMaster/chromium-crosswalk,junmin-zhu/chromium-rivertrail,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,ChromiumWebApps/chromium,ltilve/chromium,keishi/chromium,mogoweb/chromium-crosswalk,pozdnyakov/chromium-crosswalk,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,ChromiumWebApps/chromium,markYoungH/chromium.src,M4sse/chromium.src,keishi/chromium,Jonekee/chromium.src,hujiajie/pa-chromium,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk,littlstar/chromium.src,Chilledheart/chromium,ChromiumWebApps/chromium,axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,robclark/chromium,fujunwei/chromium-crosswalk,dushu1203/chromium.src,mogoweb/chromium-crosswalk,patrickm/chromium.src,dednal/chromium.src,timopulkkinen/BubbleFish,ltilve/chromium,krieger-od/nwjs_chromium.src,robclark/chromium,bright-sparks/chromium-spacewalk,anirudhSK/chromium,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,PeterWangIntel/chromium-crosswalk,Pluto-tv/chromium-crosswalk,dednal/chromium.src,nacl-webkit/chrome_deps,markYoungH/chromium.src,krieger-od/nwjs_chromium.src,robclark/chromium,Pluto-tv/chromium-crosswalk,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,robclark/chromium,timopulkkinen/BubbleFish,hujiajie/pa-chromium,axinging/chromium-crosswalk,keishi/chromium,Fireblend/chromium-crosswalk,zcbenz/cefode-chromium,junmin-zhu/chromium-rivertrail,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,pozdnyakov/chromium-crosswalk,rogerwang/chromium,bright-sparks/chromium-spacewalk,chuan9/chromium-crosswalk,hujiajie/pa-chromium,bright-sparks/chromium-spacewalk,patrickm/chromium.src,hgl888/chromium-crosswalk,dednal/chromium.src,ltilve/chromium,anirudhSK/chromium,junmin-zhu/chromium-rivertrail,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,dednal/chromium.src,robclark/chromium,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,jaruba/chromium.src,littlstar/chromium.src,fujunwei/chromium-crosswalk,keishi/chromium,hujiajie/pa-chromium,dednal/chromium.src,jaruba/chromium.src,pozdnyakov/chromium-crosswalk,timopulkkinen/BubbleFish,anirudhSK/chromium,axinging/chromium-crosswalk,rogerwang/chromium,krieger-od/nwjs_chromium.src,rogerwang/chromium,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,ondra-novak/chromium.src,dushu1203/chromium.src,mohamed--abdel-maksoud/chromium.src