2010-12-27 yury semikhatsky <yurys@chromium.org>
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 09:28:54 +0000 (09:28 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 09:28:54 +0000 (09:28 +0000)
commitea63e2f08ff53170de6156ea3eb6b346714acab0
tree08e1ba1679b290d9f4a920edb358a69227a481e5
parent17f295be439ad170929213e1a34e7e3fb51f2cce
2010-12-27  yury semikhatsky  <yurys@chromium.org>

        reviewed by pavel feldman.

        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-onerror12.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/js/jseventlistener.h:
        * 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/v8eventlistener.h:
        * bindings/v8/v8windowerrorhandler.cpp: renamed from webcore/bindings/js/jsworkercontexterrorhandler.h.
        (webcore::v8windowerrorhandler::v8windowerrorhandler):
        (webcore::v8windowerrorhandler::calllistenerfunction):
        * bindings/v8/v8windowerrorhandler.h: copied from webcore/dom/errorevent.cpp.
        (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):
        (webcore::document::addmessage):
        * dom/document.h:
        * dom/errorevent.cpp:
        * dom/errorevent.h:
        * dom/event.cpp:
        (webcore::event::iserrorevent):
        * dom/event.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:
        * websockets/websocket.cpp:
        (webcore::websocket::connect):
        * websockets/websocketchannel.cpp:
        (webcore::websocketchannel::didopen):
        (webcore::websocketchannel::didfail):
        (webcore::websocketchannel::appendtobuffer):
        * websockets/websockethandshake.cpp:
        (webcore::websockethandshake::readserverhandshake):
        (webcore::websockethandshake::readstatusline):
        (webcore::websockethandshake::readhttpheaders):
        (webcore::websockethandshake::checkresponseheaders):
        * workers/defaultsharedworkerrepository.cpp:
        (webcore::postexceptiontask):
        (webcore::postconsolemessagetask):
        * workers/workercontext.cpp:
        (webcore::workercontext::workercontext):
        (webcore::workercontext::erroreventtarget):
        (webcore::workercontext::logexceptiontoconsole):
        (webcore::workercontext::addmessage):
        * workers/workercontext.h:
        * workers/workermessagingproxy.cpp:
        (webcore::workerexceptiontask::performtask):
        (webcore::postconsolemessagetask):
        * xml/xmlhttprequest.cpp:
        (webcore::reportunsafeusage):

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

        Reviewed by Pavel Feldman.

        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-onerror12-expected.txt: Added.
        * fast/events/window-onerror12.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.
        * platform/gtk/Skipped:
        * 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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
92 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/resources/window-onerror.js [new file with mode: 0644]
LayoutTests/fast/events/window-onerror1-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror1.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror10-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror10.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror11-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror11.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror12-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror12.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror2-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror2.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror3-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror3.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror4-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror4.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror5-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror5.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror6-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror6.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror7-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror7.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror8-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror8.html [new file with mode: 0644]
LayoutTests/fast/events/window-onerror9-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/window-onerror9.html [new file with mode: 0644]
LayoutTests/fast/workers/worker-script-error-expected.txt
LayoutTests/http/tests/security/resources/onerror-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/security/window-onerror-exception-in-iframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/security/window-onerror-exception-in-iframe.html [new file with mode: 0644]
LayoutTests/platform/chromium-win/fast/workers/worker-script-error-expected.txt
LayoutTests/platform/chromium/fast/events/window-onerror1-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror10-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror11-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror2-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror3-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror4-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror5-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror6-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror7-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror8-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/fast/events/window-onerror9-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/http/tests/security/window-onerror-exception-in-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/userscripts/window-onerror-for-isolated-world-1-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/userscripts/window-onerror-for-isolated-world-2-expected.txt [new file with mode: 0644]
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/gtk/fast/events/window-onerror2-expected.txt [new file with mode: 0755]
LayoutTests/userscripts/window-onerror-for-isolated-world-1-expected.txt [new file with mode: 0644]
LayoutTests/userscripts/window-onerror-for-isolated-world-1.html [new file with mode: 0644]
LayoutTests/userscripts/window-onerror-for-isolated-world-2-expected.txt [new file with mode: 0644]
LayoutTests/userscripts/window-onerror-for-isolated-world-2.html [new file with mode: 0644]
Source/WebCore/Android.jscbindings.mk
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.order
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSErrorHandler.cpp [moved from Source/WebCore/bindings/js/JSWorkerContextErrorHandler.cpp with 86% similarity]
Source/WebCore/bindings/js/JSErrorHandler.h [moved from Source/WebCore/bindings/js/JSWorkerContextErrorHandler.h with 69% similarity]
Source/WebCore/bindings/js/JSEventListener.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/v8/V8ConsoleMessage.cpp
Source/WebCore/bindings/v8/V8ConsoleMessage.h
Source/WebCore/bindings/v8/V8EventListener.h
Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp [new file with mode: 0644]
Source/WebCore/bindings/v8/V8WindowErrorHandler.h [new file with mode: 0644]
Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
Source/WebCore/bindings/v8/WorkerScriptController.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ErrorEvent.cpp
Source/WebCore/dom/ErrorEvent.h
Source/WebCore/dom/Event.cpp
Source/WebCore/dom/Event.h
Source/WebCore/dom/ScriptExecutionContext.cpp
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/websockets/WebSocket.cpp
Source/WebCore/websockets/WebSocketChannel.cpp
Source/WebCore/websockets/WebSocketHandshake.cpp
Source/WebCore/workers/DefaultSharedWorkerRepository.cpp
Source/WebCore/workers/WorkerContext.cpp
Source/WebCore/workers/WorkerContext.h
Source/WebCore/workers/WorkerMessagingProxy.cpp
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebWorkerClientImpl.cpp