WebCore:
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jul 2009 17:45:04 +0000 (17:45 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jul 2009 17:45:04 +0000 (17:45 +0000)
commit96c4e12661e96b6086ca5509ea62fcf9cee6cd1e
tree1441ce08cf04aeb37866bf6d6cdf689f717aaaff
parentafc980795778f93b04ffcf20a118c49ccb60e1d8
WebCore:

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

        Reviewed by David Levin.

        Fix error handling in dedicated worker and worker context.
        https://bugs.webkit.org/show_bug.cgi?id=27525

        The following problems have been fixed:
        1) The uncaught runtime script error is not reported using the
        WorkerGlobalScope object's onerror attribute.
        2) If the error is still not handled afterwards (onerror attribute
        is not defined as a function or it returns true), the error should
        be reported back to the associated Worker object by firing an
        ErrorEvent.
        3) If the error is still not handled by the associated Worker
        object, the error should be reported to the user.

        Test: fast/workers/worker-script-error.html

        * bindings/js/JSEventListener.cpp:
        (WebCore::JSEventListener::reportError):
        * bindings/js/JSEventListener.h:
        * dom/EventListener.h:
        (WebCore::EventListener::reportError): adds a function to call
        EventListener as a function with 3 arguments to report an error.
        * workers/AbstractWorker.cpp:
        (WebCore::AbstractWorker::dispatchScriptErrorEvent):
        * workers/AbstractWorker.h:
        * workers/DedicatedWorkerContext.cpp:
        (WebCore::DedicatedWorkerContext::reportException):
        * workers/WorkerContext.cpp:
        (WebCore::WorkerContext::reportException):
        * workers/WorkerContext.h:
        * workers/WorkerMessagingProxy.cpp:
        (WebCore::WorkerExceptionTask::performTask):
        * workers/WorkerMessagingProxy.h:

LayoutTests:

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

        Reviewed by David Levin.

        Layout tests for fixing error handling in dedicated worker and worker
        context.
        https://bugs.webkit.org/show_bug.cgi?id=27525

        * fast/workers/resources/worker-error-in-handling-script-error.js: Added
        * fast/workers/resources/worker-invalid-syntax.js: Added.
        * fast/workers/resources/worker-script-error-bubbled.js: Added.
        * fast/workers/resources/worker-script-error-handled.js: Added.
        * fast/workers/resources/worker-script-error-unhandled.js: Added.
        * fast/workers/worker-constructor.html:
        * fast/workers/worker-script-error-expected.txt: Added.
        * fast/workers/worker-script-error.html: Added.
        Add test cases to cover different script error handling scenarios.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@46419 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/workers/resources/worker-error-in-handling-script-error.js [new file with mode: 0644]
LayoutTests/fast/workers/resources/worker-invalid-syntax.js [new file with mode: 0644]
LayoutTests/fast/workers/resources/worker-script-error-bubbled.js [new file with mode: 0644]
LayoutTests/fast/workers/resources/worker-script-error-handled.js [new file with mode: 0644]
LayoutTests/fast/workers/resources/worker-script-error-unhandled.js [new file with mode: 0644]
LayoutTests/fast/workers/worker-constructor.html
LayoutTests/fast/workers/worker-script-error-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/worker-script-error.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/JSEventListener.cpp
WebCore/bindings/js/JSEventListener.h
WebCore/dom/EventListener.h
WebCore/workers/AbstractWorker.cpp
WebCore/workers/AbstractWorker.h
WebCore/workers/DedicatedWorkerContext.cpp
WebCore/workers/WorkerContext.cpp
WebCore/workers/WorkerContext.h
WebCore/workers/WorkerMessagingProxy.cpp
WebCore/workers/WorkerMessagingProxy.h