WebCore:
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jul 2009 23:15:40 +0000 (23:15 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jul 2009 23:15:40 +0000 (23:15 +0000)
commitf1af35b1bacfda5fd883da35052a5cf28631ab7b
tree2f68474cdd6dfa24526b5e0165574ab38d173028
parent66d8b8d9e6540da7d2f94a6030234c99dd7f4fc4
WebCore:

2009-07-15  Jian Li  <jianli@chromium.org>

        Reviewed by David Levin.

        Bug 25151 - workers that fail to load scripts not firing error event.
        https://bugs.webkit.org/show_bug.cgi?id=25151

        This fixes the problem that an error event is not fired when the worker
        script fails to load. Some reasons this may occur are an invalid URL for
        the worker script or a cross-origin redirect.

        We also moves the code to complete the URL and check its origin from
        Worker constructor to WorkerScriptLoader loading functions in order to
        move the exception throwing logic out of the scope of Worker constructor.
        Due to this change, we also remove the output ExceptionCode parameter
        in the worker constructor. Corresponding JS/V8 binding codes have been
        updated to reflect this change.

        * bindings/js/JSWorkerConstructor.cpp:
        (WebCore::constructWorker):
        * bindings/v8/custom/V8WorkerCustom.cpp:
        (WebCore::CALLBACK_FUNC_DECL):
        * workers/Worker.cpp:
        (WebCore::Worker::Worker):
        (WebCore::Worker::notifyFinished):
        * workers/Worker.h:
        (WebCore::Worker::create):
        * workers/WorkerContext.cpp:
        (WebCore::WorkerContext::importScripts):
        * workers/WorkerScriptLoader.cpp:
        (WebCore::toCrossOriginRedirectPolicy):
        (WebCore::WorkerScriptLoader::loadSynchronously):
        (WebCore::WorkerScriptLoader::loadAsynchronously):
        (WebCore::notifyLoadErrorTask):
        (WebCore::WorkerScriptLoader::createResourceRequest):
        (WebCore::WorkerScriptLoader::didFail):
        (WebCore::WorkerScriptLoader::didFailRedirectCheck):
        (WebCore::WorkerScriptLoader::didReceiveAuthenticationCancellation):
        (WebCore::WorkerScriptLoader::notifyError):
        * workers/WorkerScriptLoader.h:
        (WebCore::):
        (WebCore::WorkerScriptLoader::url):

LayoutTests:

2009-07-15  Jian Li  <jianli@chromium.org>

        Reviewed by David Levin.

        Bug 25151 - workers that fail to load scripts not firing error event.
        https://bugs.webkit.org/show_bug.cgi?id=25151

        Updates layout test cases for bug 25151.

        * fast/workers/worker-constructor-expected.txt:
        * fast/workers/worker-constructor.html:
        * http/tests/workers/worker-redirect-expected.txt:
        * http/tests/workers/worker-redirect.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@45958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/workers/worker-constructor-expected.txt
LayoutTests/fast/workers/worker-constructor.html
LayoutTests/http/tests/workers/worker-redirect-expected.txt
LayoutTests/http/tests/workers/worker-redirect.html
WebCore/ChangeLog
WebCore/bindings/js/JSWorkerConstructor.cpp
WebCore/bindings/v8/custom/V8WorkerCustom.cpp
WebCore/workers/Worker.cpp
WebCore/workers/Worker.h
WebCore/workers/WorkerContext.cpp
WebCore/workers/WorkerScriptLoader.cpp
WebCore/workers/WorkerScriptLoader.h