Invoke WorkerScriptLoader's m_finishedCallback callback safely.
WorkerScriptLoader instance could be deleted in the midst of running a
member method. Here is a bad scenario that could cause a crash.
1. didFail() client method would be called in the midst of processing
ThreadableLoader::create(), e.g. for forbidden cross origin requests.
2. didFail() invokes m_finishedCallback via notifyFinished().
3. m_finishedCallback could delete WorkerScriptLoader instance.
4. members could be touched after the destruction.
This patch changes the class to postpone the callback invocation until
ThreadableLoader::create() returns, and to do nothing after invoking the
callback.
Also this patch stop using |m_finishing| that's vague.
The flag is used only to check if the callback needs invocation.
BUG=504685
Review URL: https://codereview.chromium.org/1213443006
git-svn-id: svn://svn.chromium.org/blink/trunk@198200 bbb929c8-8fbe-4397-9dbb-9b2b20218538
4 files changed