2010-12-13  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Adam Barth.

        WebCore doesn't fire window.onerror event when uncaught JavaScript exceptions are thrown
        https://bugs.webkit.org/show_bug.cgi?id=8519

        Uncaught exceptions are propagated to window.onerror hander if one is present.
        The handler is expected to be a function accepting three arguments: error message,
        resource url and line number where the exception occured.

        * fast/events/resources/window-onerror.js: Added.
        (throwException):
        * fast/events/window-onerror1-expected.txt: Added.
        * fast/events/window-onerror1.html: Added.
        * fast/events/window-onerror10-expected.txt: Added.
        * fast/events/window-onerror10.html: Added.
        * fast/events/window-onerror11-expected.txt: Added.
        * fast/events/window-onerror11.html: Added.
        * fast/events/window-onerror2-expected.txt: Added.
        * fast/events/window-onerror2.html: Added.
        * fast/events/window-onerror3-expected.txt: Added.
        * fast/events/window-onerror3.html: Added.
        * fast/events/window-onerror4-expected.txt: Added.
        * fast/events/window-onerror4.html: Added.
        * fast/events/window-onerror5-expected.txt: Added.
        * fast/events/window-onerror5.html: Added.
        * fast/events/window-onerror6-expected.txt: Added.
        * fast/events/window-onerror6.html: Added.
        * fast/events/window-onerror7-expected.txt: Added.
        * fast/events/window-onerror7.html: Added.
        * fast/events/window-onerror8-expected.txt: Added.
        * fast/events/window-onerror8.html: Added.
        * fast/events/window-onerror9-expected.txt: Added.
        * fast/events/window-onerror9.html: Added.
        * fast/workers/worker-script-error-expected.txt:
        * http/tests/security/resources/onerror-iframe.html: Added.
        * http/tests/security/window-onerror-exception-in-iframe-expected.txt: Added.
        * http/tests/security/window-onerror-exception-in-iframe.html: Added.
        * platform/chromium-win/fast/workers/worker-script-error-expected.txt:
        * platform/chromium/fast/events/window-onerror1-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror10-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror11-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror2-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror3-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror4-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror5-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror6-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror7-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror8-expected.txt: Added.
        * platform/chromium/fast/events/window-onerror9-expected.txt: Added.
        * platform/chromium/http/tests/security/window-onerror-exception-in-iframe-expected.txt: Added.
        * platform/chromium/userscripts/window-onerror-for-isolated-world-1-expected.txt: Added.
        * platform/chromium/userscripts/window-onerror-for-isolated-world-2-expected.txt: Added.
        * userscripts/window-onerror-for-isolated-world-1-expected.txt: Added.
        * userscripts/window-onerror-for-isolated-world-1.html: Added.
        * userscripts/window-onerror-for-isolated-world-2-expected.txt: Added.
        * userscripts/window-onerror-for-isolated-world-2.html: Added.
2010-12-13  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Adam Barth.

        WebCore doesn't fire window.onerror event when uncaught JavaScript exceptions are thrown
        https://bugs.webkit.org/show_bug.cgi?id=8519

        Uncaught exceptions are propagated to window.onerror hander if one is present.
        The handler is expected to be a function accepting three arguments: error message,
        resource url and line number where the exception occured.

        It was decided to dispatch ErrorEvent to all listeners/handlers no matter if they
        were created in the same isolated world where the exception occured or not.

        Tests: fast/events/window-onerror1.html
               fast/events/window-onerror10.html
               fast/events/window-onerror11.html
               fast/events/window-onerror2.html
               fast/events/window-onerror3.html
               fast/events/window-onerror4.html
               fast/events/window-onerror5.html
               fast/events/window-onerror6.html
               fast/events/window-onerror7.html
               fast/events/window-onerror8.html
               fast/events/window-onerror9.html
               http/tests/security/window-onerror-exception-in-iframe.html
               userscripts/window-onerror-for-isolated-world-1.html
               userscripts/window-onerror-for-isolated-world-2.html

        * Android.jscbindings.mk:
        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.order:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSBindingsAllInOne.cpp:
        * bindings/js/JSDOMBinding.cpp:
        (WebCore::reportException):
        * bindings/js/JSErrorHandler.cpp: Renamed from WebCore/bindings/js/JSWorkerContextErrorHandler.cpp.
        (WebCore::JSErrorHandler::JSErrorHandler):
        (WebCore::JSErrorHandler::~JSErrorHandler):
        (WebCore::JSErrorHandler::handleEvent):
        * bindings/js/JSErrorHandler.h: Copied from WebCore/bindings/js/JSWorkerContextErrorHandler.h.
        (WebCore::JSErrorHandler::create):
        (WebCore::createJSErrorHandler):
        * bindings/scripts/CodeGeneratorJS.pm:
        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/v8/V8ConsoleMessage.cpp:
        (WebCore::V8ConsoleMessage::dispatchNow):
        (WebCore::V8ConsoleMessage::handler): the method was changed to use generic WebCore exception
        reporting mechanism which is also used by JSC bindings.
        * bindings/v8/V8ConsoleMessage.h:
        * bindings/v8/V8WindowErrorHandler.cpp: Copied from WebCore/bindings/js/JSWorkerContextErrorHandler.h.
        (WebCore::V8WindowErrorHandler::V8WindowErrorHandler):
        (WebCore::V8WindowErrorHandler::callListenerFunction):
        * bindings/v8/V8WindowErrorHandler.h: Renamed from WebCore/bindings/js/JSWorkerContextErrorHandler.h.
        (WebCore::V8WindowErrorHandler::create):
        * bindings/v8/WorkerContextExecutionProxy.cpp:
        (WebCore::v8MessageHandler):
        * bindings/v8/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::evaluate):
        * dom/Document.cpp:
        (WebCore::Document::errorEventTarget):
        (WebCore::Document::logExceptionToConsole):
        * dom/Document.h:
        * dom/ScriptExecutionContext.cpp:
        (WebCore::ScriptExecutionContext::PendingException::PendingException):
        (WebCore::ScriptExecutionContext::ScriptExecutionContext):
        (WebCore::ScriptExecutionContext::reportException): this method is not virtual anymore to
        ensure that error event dispatching algorithm is the same in WorkerContext and in Document.
        (WebCore::ScriptExecutionContext::dispatchErrorEvent):
        * dom/ScriptExecutionContext.h:
        * workers/DefaultSharedWorkerRepository.cpp:
        (WebCore::postExceptionTask):
        * workers/WorkerContext.cpp:
        (WebCore::WorkerContext::WorkerContext):
        (WebCore::WorkerContext::errorEventTarget):
        (WebCore::WorkerContext::logExceptionToConsole):
        * workers/WorkerContext.h:
        * workers/WorkerMessagingProxy.cpp:
        (WebCore::WorkerExceptionTask::performTask):
2010-12-13  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Adam Barth.

        WebCore doesn't fire window.onerror event when uncaught JavaScript exceptions are thrown
        https://bugs.webkit.org/show_bug.cgi?id=8519

        Uncaught exceptions are propagated to window.onerror hander if one is present.
        The handler is expected to be a function accepting three arguments: error message,
        resource url and line number where the exception occured.

        * src/WebWorkerClientImpl.cpp:
        (WebKit::WebWorkerClientImpl::postExceptionToWorkerObject):
        (WebKit::WebWorkerClientImpl::postExceptionToWorkerObjectTask):

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