evaluateScriptInMainWorld() should check if the target context exists before evaluating a script
evaluateScriptInMainWorld() should check if the target context exists before evaluating a script

This is a speculative fix of bug 393137 (I cannot reproduce it).

It's possible that evaluateScriptInMainWorld() is called in a state where toV8Context(m_frame, mainWorld()) returns NULL. For example, this can happen when the m_frame is already detached from the window object (but I don't figure out the exact call path that causes the issue).

Either way, evaluateScriptInMainWorld() should check if the target context exists or not before starting evaluating a script. This CL makes the change.

BUG=393137

Review URL: https://codereview.chromium.org/388913004

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@178047 bbb929c8-8fbe-4397-9dbb-9b2b20218538

PeterWangIntel/blink-crosswalk,jtg-gg/blink,kurli/blink-crosswalk,Bysmyyr/blink-crosswalk,modulexcite/blink,smishenk/blink-crosswalk,ondra-novak/blink,XiaosongWei/blink-crosswalk,nwjs/blink,Bysmyyr/blink-crosswalk,hgl888/blink-crosswalk-efl,ondra-novak/blink,jtg-gg/blink,Pluto-tv/blink-crosswalk,Pluto-tv/blink-crosswalk,PeterWangIntel/blink-crosswalk,PeterWangIntel/blink-crosswalk,ondra-novak/blink,hgl888/blink-crosswalk-efl,crosswalk-project/blink-crosswalk-efl,kurli/blink-crosswalk,modulexcite/blink,smishenk/blink-crosswalk,nwjs/blink,Pluto-tv/blink-crosswalk,modulexcite/blink,XiaosongWei/blink-crosswalk,modulexcite/blink,hgl888/blink-crosswalk-efl,XiaosongWei/blink-crosswalk,crosswalk-project/blink-crosswalk-efl,smishenk/blink-crosswalk,kurli/blink-crosswalk,smishenk/blink-crosswalk,crosswalk-project/blink-crosswalk-efl,kurli/blink-crosswalk,kurli/blink-crosswalk,nwjs/blink,XiaosongWei/blink-crosswalk,Pluto-tv/blink-crosswalk,Pluto-tv/blink-crosswalk,kurli/blink-crosswalk,jtg-gg/blink,modulexcite/blink,PeterWangIntel/blink-crosswalk,ondra-novak/blink,modulexcite/blink,Bysmyyr/blink-crosswalk,Bysmyyr/blink-crosswalk,smishenk/blink-crosswalk,hgl888/blink-crosswalk-efl,ondra-novak/blink,Pluto-tv/blink-crosswalk,hgl888/blink-crosswalk-efl,XiaosongWei/blink-crosswalk,ondra-novak/blink,XiaosongWei/blink-crosswalk,nwjs/blink,smishenk/blink-crosswalk,nwjs/blink,jtg-gg/blink,Pluto-tv/blink-crosswalk,smishenk/blink-crosswalk,Bysmyyr/blink-crosswalk,modulexcite/blink,jtg-gg/blink,nwjs/blink,kurli/blink-crosswalk,PeterWangIntel/blink-crosswalk,hgl888/blink-crosswalk-efl,Bysmyyr/blink-crosswalk,kurli/blink-crosswalk,Bysmyyr/blink-crosswalk,jtg-gg/blink,jtg-gg/blink,jtg-gg/blink,hgl888/blink-crosswalk-efl,jtg-gg/blink,crosswalk-project/blink-crosswalk-efl,nwjs/blink,XiaosongWei/blink-crosswalk,kurli/blink-crosswalk,Pluto-tv/blink-crosswalk,Bysmyyr/blink-crosswalk,hgl888/blink-crosswalk-efl,XiaosongWei/blink-crosswalk,smishenk/blink-crosswalk,hgl888/blink-crosswalk-efl,ondra-novak/blink,PeterWangIntel/blink-crosswalk,crosswalk-project/blink-crosswalk-efl,jtg-gg/blink,kurli/blink-crosswalk,PeterWangIntel/blink-crosswalk,ondra-novak/blink,Pluto-tv/blink-crosswalk,crosswalk-project/blink-crosswalk-efl,nwjs/blink,crosswalk-project/blink-crosswalk-efl,PeterWangIntel/blink-crosswalk,Bysmyyr/blink-crosswalk,nwjs/blink,XiaosongWei/blink-crosswalk,smishenk/blink-crosswalk,PeterWangIntel/blink-crosswalk,crosswalk-project/blink-crosswalk-efl,modulexcite/blink,modulexcite/blink,hgl888/blink-crosswalk-efl,Bysmyyr/blink-crosswalk,nwjs/blink,ondra-novak/blink,XiaosongWei/blink-crosswalk,PeterWangIntel/blink-crosswalk,smishenk/blink-crosswalk,modulexcite/blink,Pluto-tv/blink-crosswalk,crosswalk-project/blink-crosswalk-efl