Fetching a Worker with url that isn't allowed from a file based test causes DRT to crash.
https://bugs.webkit.org/show_bug.cgi?id=62469

Reviewed by Dmitry Titov.

Source/WebCore:

Test: fast/workers/worker-crash-with-invalid-location.html

* workers/DefaultSharedWorkerRepository.cpp:
(WebCore::SharedWorkerScriptLoader::load): Changed to using the RefCounted version of WorkerScriptLoader.
* workers/Worker.cpp:
(WebCore::Worker::create): Ditto.
* workers/Worker.h: Ditto.
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::importScripts):  Ditto.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::~WorkerScriptLoader): Created to
allow removing some header includes in WorkerScriptLoader.h.
(WebCore::WorkerScriptLoader::loadAsynchronously): Fix the ordering
of setPendingActivity and keep WorkerScriptLoader alive during a
potential callback.
* workers/WorkerScriptLoader.h: Made this RefCounted to allow for
keeping it alive during callbacks. Also, removed unnecessary header
inclusions (and added a destructor to facilitate that).
(WebCore::WorkerScriptLoader::create):

Source/WebKit/chromium:

Test: fast/workers/worker-crash-with-invalid-location.html

* src/SharedWorkerRepository.cpp:
(WebCore::SharedWorkerScriptLoader::SharedWorkerScriptLoader): Changed to using the RefCounted version
of WorkerScriptLoader.
(WebCore::SharedWorkerScriptLoader::load): Rearranged calls as done in similar places,
which allows for SharedWorkerScriptLoader to be deleted during the laodAsynchronously call
and for unsetPendingActivity to be called.
(WebCore::SharedWorkerScriptLoader::notifyFinished): Changed to using the RefCounted version
of WorkerScriptLoader.

LayoutTests:

* fast/workers/worker-crash-with-invalid-location-expected.txt: Added.
* fast/workers/worker-crash-with-invalid-location.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed