1. 25 Jan, 2011 1 commit
    • inferno@chromium.org's avatar
      2011-01-25 Cris Neckar <cdn@chromium.org> · 49aa540c
      inferno@chromium.org authored
              Reviewed by Adam Barth.
      
              Test for crash when a window's location changes before creating an object URL.
              https://bugs.webkit.org/show_bug.cgi?id=53038
      
              * fast/dom/window-domurl-crash-expected.txt: Added.
              * fast/dom/window-domurl-crash.html: Added.
      2011-01-25  Cris Neckar  <cdn@chromium.org>
      
              Reviewed by Adam Barth.
      
              Add a hashset of DOMURLs to ScriptExecutionContext to track back references.
              https://bugs.webkit.org/show_bug.cgi?id=53038
      
              Test: fast/dom/window-domurl-crash.html
      
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
              (WebCore::ScriptExecutionContext::createdDomUrl):
              (WebCore::ScriptExecutionContext::destroyedDomUrl):
              * dom/ScriptExecutionContext.h:
              (WebCore::ScriptExecutionContext::domUrls):
              * html/DOMURL.cpp:
              (WebCore::DOMURL::DOMURL):
              (WebCore::DOMURL::~DOMURL):
              (WebCore::DOMURL::contextDestroyed):
              * html/DOMURL.h:
              (WebCore::DOMURL::scriptExecutionContext):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76652 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      49aa540c
  2. 21 Jan, 2011 1 commit
    • abarth@webkit.org's avatar
      2011-01-21 Yury Semikhatsky <yurys@chromium.org> · 3a2486e3
      abarth@webkit.org authored
              Reviewed by Adam Barth.
      
              Regression: new window.onerror() implementation leaks cross-origin Javascript errors
              https://bugs.webkit.org/show_bug.cgi?id=52903
      
              In case of an exception in a script from different domain only generic message
              will be passed to window.onerror hander.
      
              Tests: http/tests/security/cross-origin-script-window-onerror-redirected.html
                     http/tests/security/cross-origin-script-window-onerror.html
      
              * bindings/js/CachedScriptSourceProvider.h: use URL from the resource response to make sure we do all
              cross origin checks agains real script URL, not the original URL which may have resulted in a sequence
              of redirects to different domains.
              (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
              * bindings/v8/ScriptSourceCode.h: same for v8.
              (WebCore::ScriptSourceCode::url):
              * dom/ScriptExecutionContext.cpp:
              (We...
      3a2486e3
  3. 20 Jan, 2011 2 commits
    • ossy@webkit.org's avatar
      Refactoring of the custom allocation framework · 95c1bc42
      ossy@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=49897
      
      Patch by Zoltan Horvath <zoltan@webkit.org> on 2011-01-20
      Reviewed by Csaba Osztrogonác.
      
      Source/JavaScriptCore:
      
      Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
      The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
      equivalent macro implementation at the necessary places.
      
      * wtf/FastAllocBase.h: Turn FastAllocBase's implementation into a macro.
      
      Source/WebCore:
      
      Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
      The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
      equivalent macro implementation at the necessary places.
      
      Source/WebKit:
      
      Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
      The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
      equivalent macro implementation at the necessary places.
      
      Source/WebKit2:
      
      Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
      The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
      equivalent macro implementation at the necessary places.
      
      Tools:
      
      Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
      The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
      equivalent macro implementation at the necessary places.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      95c1bc42
    • yurys@chromium.org's avatar
      2010-12-27 yury semikhatsky <yurys@chromium.org> · c8a06eb9
      yurys@chromium.org authored
              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: http://svn.webkit.org/repository/webkit/trunk@76216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c8a06eb9
  4. 08 Jan, 2011 1 commit
  5. 13 Dec, 2010 3 commits
    • yurys@chromium.org's avatar
      2010-12-13 Yury Semikhatsky <yurys@chromium.org> · e42c177c
      yurys@chromium.org authored
              Unreviewed. Rollout 73914, 73915, 73917, 73920 and 73921.
      
              REGRESSION(r73914): "Chromium page_cycler_morejs fails" (Requested by yurys on #webkit).
              https://bugs.webkit.org/show_bug.cgi?id=50950
      
              * fast/events/resources/window-onerror.js: Removed.
              * fast/events/window-onerror1-expected.txt: Removed.
              * fast/events/window-onerror1.html: Removed.
              * fast/events/window-onerror10-expected.txt: Removed.
              * fast/events/window-onerror10.html: Removed.
              * fast/events/window-onerror11-expected.txt: Removed.
              * fast/events/window-onerror11.html: Removed.
              * fast/events/window-onerror2-expected.txt: Removed.
              * fast/events/window-onerror2.html: Removed.
              * fast/events/window-onerror3-expected.txt: Removed.
              * fast/events/window-onerror3.html: Removed.
              * fast/events/window-onerror4-expected.txt: Removed.
              * fast/events/window-onerror4.html: Removed.
              * fast/events/window-onerror5-expected.txt: Removed.
              * fast/events/window-onerror5.html: Removed.
              * fast/events/window-onerror6-expected.txt: Removed.
              * fast/events/window-onerror6.html: Removed.
              * fast/events/window-onerror7-expected.txt: Removed.
              * fast/events/window-onerror7.html: Removed.
              * fast/events/window-onerror8-expected.txt: Removed.
              * fast/events/window-onerror8.html: Removed.
              * fast/events/window-onerror9-expected.txt: Removed.
              * fast/events/window-onerror9.html: Removed.
              * fast/workers/worker-script-error-expected.txt:
              * http/tests/security/resources/onerror-iframe.html: Removed.
              * http/tests/security/window-onerror-exception-in-iframe-expected.txt: Removed.
              * http/tests/security/window-onerror-exception-in-iframe.html: Removed.
              * platform/chromium-win/fast/workers/worker-script-error-expected.txt:
              * platform/chromium/fast/events/window-onerror1-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror10-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror11-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror2-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror3-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror4-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror5-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror6-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror7-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror8-expected.txt: Removed.
              * platform/chromium/fast/events/window-onerror9-expected.txt: Removed.
              * platform/chromium/http/tests/security/window-onerror-exception-in-iframe-expected.txt: Removed.
              * platform/chromium/userscripts/window-onerror-for-isolated-world-1-expected.txt: Removed.
              * platform/chromium/userscripts/window-onerror-for-isolated-world-2-expected.txt: Removed.
              * platform/gtk/Skipped:
              * userscripts/window-onerror-for-isolated-world-1-expected.txt: Removed.
              * userscripts/window-onerror-for-isolated-world-1.html: Removed.
              * userscripts/window-onerror-for-isolated-world-2-expected.txt: Removed.
              * userscripts/window-onerror-for-isolated-world-2.html: Removed.
      2010-12-13  Yury Semikhatsky  <yurys@chromium.org>
      
              Unreviewed. Rollout 73914, 73915, 73917, 73920 and 73921.
      
              REGRESSION(r73914): "Chromium page_cycler_morejs fails" (Requested by yurys on #webkit).
              https://bugs.webkit.org/show_bug.cgi?id=50950
      
              * 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/JSWorkerContextErrorHandler.cpp: Renamed from WebCore/bindings/js/JSErrorHandler.cpp.
              (WebCore::JSWorkerContextErrorHandler::JSWorkerContextErrorHandler):
              (WebCore::JSWorkerContextErrorHandler::~JSWorkerContextErrorHandler):
              (WebCore::JSWorkerContextErrorHandler::handleEvent):
              * bindings/js/JSWorkerContextErrorHandler.h: Renamed from WebCore/bindings/js/JSErrorHandler.h.
              (WebCore::JSWorkerContextErrorHandler::create):
              (WebCore::createJSWorkerContextErrorHandler):
              * bindings/scripts/CodeGeneratorJS.pm:
              * bindings/scripts/CodeGeneratorV8.pm:
              * bindings/v8/V8ConsoleMessage.cpp:
              (WebCore::V8ConsoleMessage::dispatchNow):
              (WebCore::V8ConsoleMessage::handler):
              * bindings/v8/V8ConsoleMessage.h:
              * bindings/v8/V8WindowErrorHandler.cpp: Removed.
              * bindings/v8/V8WindowErrorHandler.h: Removed.
              * bindings/v8/WorkerContextExecutionProxy.cpp:
              (WebCore::v8MessageHandler):
              * bindings/v8/WorkerScriptController.cpp:
              (WebCore::WorkerScriptController::evaluate):
              * dom/Document.cpp:
              (WebCore::Document::reportException):
              (WebCore::Document::addMessage):
              * dom/Document.h:
              * dom/ErrorEvent.cpp:
              * dom/ErrorEvent.h:
              * dom/Event.cpp:
              * dom/Event.h:
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::ScriptExecutionContext):
              * dom/ScriptExecutionContext.h:
              * websockets/WebSocket.cpp:
              (WebCore::WebSocket::connect):
              * websockets/WebSocketChannel.cpp:
              (WebCore::WebSocketChannel::didOpen):
              (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::reportException):
              (WebCore::WorkerContext::addMessage):
              * workers/WorkerContext.h:
              * workers/WorkerMessagingProxy.cpp:
              (WebCore::WorkerExceptionTask::performTask):
              (WebCore::postConsoleMessageTask):
              * xml/XMLHttpRequest.cpp:
              (WebCore::reportUnsafeUsage):
      2010-12-13  Yury Semikhatsky  <yurys@chromium.org>
      
              Unreviewed. Rollout 73914, 73915, 73917, 73920 and 73921.
      
              REGRESSION(r73914): "Chromium page_cycler_morejs fails" (Requested by yurys on #webkit).
              https://bugs.webkit.org/show_bug.cgi?id=50950
      
              * src/WebWorkerClientImpl.cpp:
              (WebKit::WebWorkerClientImpl::postExceptionToWorkerObject):
              (WebKit::WebWorkerClientImpl::postConsoleMessageToWorkerObject):
              (WebKit::WebWorkerClientImpl::postExceptionToWorkerObjectTask):
              (WebKit::WebWorkerClientImpl::postConsoleMessageToWorkerObjectTask):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73939 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e42c177c
    • yurys@chromium.org's avatar
      2010-12-13 Yury Semikhatsky <yurys@chromium.org> · 0c8f115d
      yurys@chromium.org authored
              Unreviewed. Qt build fix.
      
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::ScriptExecutionContext):
              * dom/ScriptExecutionContext.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0c8f115d
    • yurys@chromium.org's avatar
      2010-12-13 Yury Semikhatsky <yurys@chromium.org> · 68b2822e
      yurys@chromium.org authored
              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
      68b2822e
  6. 17 Sep, 2010 1 commit
  7. 16 Sep, 2010 1 commit
    • commit-queue@webkit.org's avatar
      2010-09-16 Eric Uhrhane <ericu@chromium.org> · 577efa8e
      commit-queue@webkit.org authored
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * configure.ac:
      2010-09-16  Eric Uhrhane  <ericu@chromium.org>
      
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * Configurations/FeatureDefines.xcconfig:
      2010-09-16  Eric Uhrhane  <ericu@chromium.org>
      
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * CMakeLists.txt:
              * Configurations/FeatureDefines.xcconfig:
              * GNUmakefile.am:
              * WebCore.pro:
              * dom/EventTarget.cpp:
              * dom/EventTarget.h:
              * dom/ExceptionCode.h:
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
              * dom/ScriptExecutionContext.h:
              * fileapi/AsyncFileWriter.h:
              * fileapi/FileEntry.cpp:
              * fileapi/FileEntry.h:
              * fileapi/FileEntry.idl:
              * fileapi/FileError.h:
              * fileapi/FileError.idl:
              * fileapi/FileException.h:
              * fileapi/FileException.idl:
              * fileapi/FileStreamProxy.cpp:
              * fileapi/FileStreamProxy.h:
              * fileapi/FileThread.cpp:
              * fileapi/FileThread.h:
              * fileapi/FileWriter.cpp:
              * fileapi/FileWriter.h:
              * fileapi/FileWriter.idl:
              * fileapi/FileWriterCallback.h:
              * fileapi/FileWriterCallback.idl:
              * fileapi/FileWriterClient.h:
              * page/DOMWindow.idl:
              * platform/AsyncFileStream.h:
              * platform/FileStream.cpp:
              * platform/FileStream.h:
              * platform/FileStreamClient.h:
      2010-09-16  Eric Uhrhane  <ericu@chromium.org>
      
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * src/AsyncFileWriterChromium.h:
              * src/AsyncFileWriterChromium.cpp:
      2010-09-16  Eric Uhrhane  <ericu@chromium.org>
      
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * Configurations/FeatureDefines.xcconfig:
      2010-09-16  Eric Uhrhane  <ericu@chromium.org>
      
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * Configurations/FeatureDefines.xcconfig:
      2010-09-16  Eric Uhrhane  <ericu@chromium.org>
      
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * win/tools/vsprops/FeatureDefines.vsprops:
              * win/tools/vsprops/FeatureDefinesCairo.vsprops:
      2010-09-16  Eric Uhrhane  <ericu@chromium.org>
      
              Reviewed by Jian Li.
      
              Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
              https://bugs.webkit.org/show_bug.cgi?id=45798
      
              * Scripts/build-webkit:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      577efa8e
  8. 13 Sep, 2010 1 commit
    • eric.carlson@apple.com's avatar
      2010-09-13 Eric Carlson <eric.carlson@apple.com> · 097ca95f
      eric.carlson@apple.com authored
              Reviewed by Geoff Garen.
      
              JavaScript dialog should not deactivate media element
              https://bugs.webkit.org/show_bug.cgi?id=45688
      
              Test: http/tests/media/reload-after-dialog.html
      
              * bindings/generic/ActiveDOMCallback.cpp:
              (WebCore::ActiveDOMObjectCallbackImpl::suspend): Add ReasonForSuspension parameter.
      
              * bindings/js/ScriptDebugServer.cpp:
              (WebCore::ScriptDebugServer::setJavaScriptPaused): Pass new parameter to suspendActiveDOMObjects.
      
              * dom/ActiveDOMObject.cpp:
              (WebCore::ActiveDOMObject::suspend): Add ReasonForSuspension parameter.
              * dom/ActiveDOMObject.h:
      
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): Ditto.
              * dom/ScriptExecutionContext.h:
      
              * history/CachedFrame.cpp:
              (WebCore::CachedFrame::CachedFrame): Pass new parameter to suspendActiveDOMObjects.
      
              * html/HTMLMarqueeElement.cpp:
              (WebCore::HTMLMarqueeElement::suspend): Add ReasonForSuspension parameter.
              * html/HTMLMarqueeElement.h:
      
              * html/HTMLMediaElement.cpp:
              (WebCore::HTMLMediaElement::stop): Deal with element being suspended.
              (WebCore::HTMLMediaElement::suspend): Do nothing unless reason for suspension is document
              becoming inactive.
              * html/HTMLMediaElement.h:
      
              * page/PageGroupLoadDeferrer.cpp:
              (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): Pass WillShowDialog to suspendActiveDOMObjects.
      
              * page/SuspendableTimer.cpp:
              (WebCore::SuspendableTimer::suspend): Add ReasonForSuspension parameter.
              * page/SuspendableTimer.h:
      
              * websockets/WebSocket.cpp:
              (WebCore::WebSocket::suspend): Ditto.
              * websockets/WebSocket.h:
      
              * xml/XMLHttpRequest.cpp:
              (WebCore::XMLHttpRequest::suspend): Ditto.
              * xml/XMLHttpRequest.h:
      
      2010-09-13  Eric Carlson  <eric.carlson@apple.com>
      
              Reviewed by Geoff Garen.
      
              JavaScript dialog should not deactivate media element
              https://bugs.webkit.org/show_bug.cgi?id=45688
      
              * http/tests/media/reload-after-dialog-expected.txt: Added.
              * http/tests/media/reload-after-dialog.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      097ca95f
  9. 10 Sep, 2010 1 commit
    • commit-queue@webkit.org's avatar
      2010-09-10 Michael Nordman <michaeln@google.com> · fa990e91
      commit-queue@webkit.org authored
              Reviewed by Dumitru Daniliuc.
      
              Decouple Blob from ScriptExecutionContext.
              https://bugs.webkit.org/show_bug.cgi?id=45410
      
              - Removed ScriptExecutionContext pointers from Blob and File constructors.
              - Removed ScriptExecutionContext's collection of Blobs instance in that context.
              - Refactored BlobURL to make a distinction between 'public' blob urls and 'internal'
                urls that are used solely as identifiers. The former requires a SecurityOrigin to
                to manufacture, the latter does not.
              - Added a constant and accessor for the blob protocol scheme on the BlobURL class.
      
              No new tests are added since this is a cleanup.
      
              * bindings/js/SerializedScriptValue.cpp:
              (WebCore::CloneDeserializer::readFile):
              (WebCore::CloneDeserializer::readTerminal):
              * bindings/v8/SerializedScriptValue.cpp:
              (WebCore::ZigZag::Reader::readBlob):
              (WebCore::ZigZag::Reader::readFile):
              (WebCore::ZigZag::Reader::readFileList):
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
              (WebCore::ScriptExecutionContext::createPublicBlobURL):
              (WebCore::ScriptExecutionContext::revokePublicBlobURL):
              * dom/ScriptExecutionContext.h:
              * fileapi/Blob.cpp:
              (WebCore::Blob::Blob):
              (WebCore::Blob::~Blob):
              (WebCore::Blob::slice):
              * fileapi/Blob.h:
              (WebCore::Blob::create):
              (WebCore::Blob::url):
              * fileapi/Blob.idl:
              * fileapi/BlobBuilder.cpp:
              (WebCore::BlobBuilder::getBlob):
              * fileapi/BlobBuilder.h:
              * fileapi/BlobBuilder.idl:
              * fileapi/BlobURL.cpp:
              (WebCore::BlobURL::createPublicURL):
              (WebCore::BlobURL::createInternalURL):
              (WebCore::BlobURL::getOrigin):
              (WebCore::BlobURL::getIdentifier):
              (WebCore::BlobURL::createBlobURL):
              * fileapi/BlobURL.h:
              (WebCore::BlobURL::blobProtocol):
              (WebCore::BlobURL::BlobURL):
              * fileapi/File.cpp:
              (WebCore::File::File):
              * fileapi/File.h:
              (WebCore::File::create):
              * fileapi/FileReader.cpp: Register a public url to perform the read.
              (WebCore::FileReader::cleanup):
              (WebCore::FileReader::start):
              (WebCore::FileReader::didFinishLoading):
              (WebCore::FileReader::failed):
              * fileapi/FileReader.h: Added m_urlForReading data member.
              * fileapi/FileReaderSync.cpp:
              (WebCore::FileReaderSync::read): Register a public url to perform the read.
              * fileapi/ThreadableBlobRegistry.cpp:
              (WebCore::ThreadableBlobRegistry::registerBlobURL):
              (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
              * fileapi/ThreadableBlobRegistry.h:
              * html/HTMLInputElement.cpp:
              (WebCore::HTMLInputElement::appendFormData):
              (WebCore::HTMLInputElement::setFileListFromRenderer):
              * page/SecurityOrigin.cpp: Use BlobURL.blobProtocol().
              (WebCore::SecurityOrigin::create):
              (WebCore::SecurityOrigin::canRequest):
              (WebCore::SecurityOrigin::canDisplay):
              * platform/chromium/ClipboardChromium.cpp:
              (WebCore::ClipboardChromium::files):
              * platform/gtk/ClipboardGtk.cpp:
              (WebCore::ClipboardGtk::files):
              * platform/mac/ClipboardMac.mm:
              (WebCore::ClipboardMac::files):
              * platform/win/ClipboardWin.cpp:
              (WebCore::ClipboardWin::files):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      fa990e91
  10. 17 Aug, 2010 1 commit
    • dimich@chromium.org's avatar
      MessagePort.close() crashes if the owning context was destroyed. · 7770b894
      dimich@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=43140
      
      Reviewed by David Levin.
      
      WebCore:
      
      Test: fast/events/message-port-context-destroyed.html
      
      * dom/MessagePort.cpp:
      (WebCore::MessagePort::postMessage):
      (WebCore::MessagePort::start):
      (WebCore::MessagePort::close):
      (WebCore::MessagePort::contextDestroyed):
      Use isEntangled() method to gate various operations on MessagePort. This method also takes into account m_closed bit.
      
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
      (WebCore::ScriptExecutionContext::closeMessagePorts):
      * dom/ScriptExecutionContext.h:
      Add closeMessagePorts() method that closes message ports at the same moments when other ActiveDOMObjects are stopped.
      
      LayoutTests:
      
      * fast/events/message-port-context-destroyed-expected.txt: Added.
      * fast/events/message-port-context-destroyed.html: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7770b894
  11. 12 Aug, 2010 1 commit
    • jianli@chromium.org's avatar
      Add ThreadableBlobRegistry to support calling BlobRegistry methods in · ab8d91a8
      jianli@chromium.org authored
      main thread.
      https://bugs.webkit.org/show_bug.cgi?id=43874
      
      Reviewed by David Levin.
      
      * Android.mk:
      * CMakeLists.txt:
      * GNUmakefile.am:
      * WebCore.gypi:
      * WebCore.pro:
      * WebCore.vcproj/WebCore.vcproj:
      * WebCore.xcodeproj/project.pbxproj:
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
      (WebCore::ScriptExecutionContext::addBlob):
      (WebCore::ScriptExecutionContext::removeBlob):
      (WebCore::ScriptExecutionContext::createPublicBlobURL):
      (WebCore::ScriptExecutionContext::revokePublicBlobURL):
      * dom/ScriptExecutionContext.h:
      * html/Blob.cpp:
      (WebCore::Blob::Blob):
      (WebCore::Blob::~Blob):
      (WebCore::Blob::contextDestroyed):
      * html/Blob.h:
      * html/BlobRegistryImpl.cpp:
      (WebCore::BlobRegistryImpl::registerBlobURL):
      (WebCore::BlobRegistryImpl::unregisterBlobURL):
      (WebCore::BlobRegistryImpl::getBlobDataFromURL):
      * html/ThreadableBlobRegistry.cpp: Added.
      * html/ThreadableBlobRegistry.h: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65271 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ab8d91a8
  12. 10 Aug, 2010 2 commits
    • jianli@chromium.org's avatar
      Fix more build break. · ae2b8815
      jianli@chromium.org authored
      * bindings/v8/SerializedScriptValue.cpp:
      (WebCore::ZigZag::Reader::readBlob):
      (WebCore::ZigZag::Reader::readFile):
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
      (WebCore::ScriptExecutionContext::revokeBlobURL):
      * dom/ScriptExecutionContext.h:
      * html/Blob.cpp:
      (WebCore::Blob::slice):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ae2b8815
    • jianli@chromium.org's avatar
      Add the support to register the blob data. · 51ceb756
      jianli@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=43600
      
      Reviewed by David Levin.
      
      This is the first step towards adding Blob URL support. The blob has
      an internal URL (used by FileReader) and public URLs (used by Blob.url).
      The URL and its associated data are managed by BlobRegistry interface.
      
      This patch does not remove the usage of BlobItem. It will be removed
      when all the blob data support is hooked up and the new tests will be
      added then.
      
      * CMakeLists.txt:
      * GNUmakefile.am:
      * WebCore.gypi:
      * WebCore.pro:
      * WebCore.vcproj/WebCore.vcproj:
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/SerializedScriptValue.cpp:
      (WebCore::SerializedBlob::create):
      (WebCore::SerializedBlob::url):
      (WebCore::SerializedBlob::type):
      (WebCore::SerializedBlob::size):
      (WebCore::SerializedBlob::SerializedBlob):
      (WebCore::SerializedFile::create):
      (WebCore::SerializedFile::path):
      (WebCore::SerializedFile::url):
      (WebCore::SerializedFile::type):
      (WebCore::SerializedFile::SerializedFile):
      (WebCore::SerializedFileList::item):
      (WebCore::SerializedFileList::SerializedFileList):
      (WebCore::SerializedScriptValueData::SerializedScriptValueData):
      (WebCore::SharedSerializedData::asBlob):
      (WebCore::SharedSerializedData::asFile):
      (WebCore::SerializingTreeWalker::convertIfTerminal):
      (WebCore::DeserializingTreeWalker::convertIfTerminal):
      (WebCore::TeardownTreeWalker::convertIfTerminal):
      * bindings/js/SerializedScriptValue.h:
      (WebCore::SerializedScriptValueData::):
      (WebCore::SerializedScriptValueData::asString):
      (WebCore::SerializedScriptValueData::asBlob):
      (WebCore::SerializedScriptValueData::asFile):
      * bindings/v8/SerializedScriptValue.cpp:
      (WebCore::ZigZag::Writer::writeBlob):
      (WebCore::ZigZag::Writer::writeFile):
      (WebCore::ZigZag::Writer::writeFileList):
      (WebCore::ZigZag::Writer::doWriteUintHelper):
      (WebCore::ZigZag::Writer::doWriteUint32):
      (WebCore::ZigZag::Writer::doWriteUint64):
      (WebCore::ZigZag::Serializer::writeBlob):
      (WebCore::ZigZag::Serializer::writeFile):
      (WebCore::ZigZag::Reader::readBlob):
      (WebCore::ZigZag::Reader::readFile):
      (WebCore::ZigZag::Reader::readFileList):
      (WebCore::ZigZag::Reader::doReadUintHelper):
      (WebCore::ZigZag::Reader::doReadUint32):
      (WebCore::ZigZag::Reader::doReadUint64):
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
      (WebCore::ScriptExecutionContext::trackBlobURL):
      (WebCore::ScriptExecutionContext::revokeBlobURL):
      * dom/ScriptExecutionContext.h:
      * html/Blob.cpp:
      (WebCore::Blob::Blob):
      (WebCore::Blob::~Blob):
      (WebCore::Blob::createPublicURL):
      * html/Blob.h:
      (WebCore::Blob::create):
      (WebCore::Blob::url):
      * html/BlobRegistryImpl.cpp: Added.
      * html/BlobRegistryImpl.h: Added.
      * html/BlobStorageData.h: Added.
      * html/BlobURL.cpp: Added.
      * html/BlobURL.h: Added.
      * html/File.cpp:
      (WebCore::File::File):
      * html/File.h:
      (WebCore::File::create):
      * platform/BlobData.cpp: Added.
      * platform/BlobData.h: Added.
      * platform/BlobRegistry.h: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      51ceb756
  13. 05 Aug, 2010 1 commit
    • jianli@chromium.org's avatar
      Unify blob related feature defines to ENABLE(BLOB). · 30ebbd3e
      jianli@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=43081
      
      Reviewed by David Levin.
      
      .:
      
      * cmakeconfig.h.cmake:
      * configure.ac:
      
      JavaScriptCore:
      
      * Configurations/FeatureDefines.xcconfig:
      
      WebCore:
      
      * Configurations/FeatureDefines.xcconfig:
      * GNUmakefile.am:
      * WebCore.pri:
      * bindings/js/JSEventTarget.cpp:
      (WebCore::toJS):
      * bindings/v8/V8DOMWrapper.cpp:
      (WebCore::V8DOMWrapper::convertEventTargetToV8Object):
      * dom/EventTarget.cpp:
      * dom/EventTarget.h:
      * dom/ExceptionCode.h:
      (WebCore::):
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
      * dom/ScriptExecutionContext.h:
      * html/Blob.cpp:
      * html/Blob.h:
      * html/Blob.idl:
      * html/FileError.h:
      * html/FileError.idl:
      * html/FileReader.cpp:
      * html/FileReader.h:
      * html/FileReader.idl:
      * html/FileStream.cpp:
      (WebCore::FileStream::openForRead):
      * html/FileStream.h:
      * html/FileStreamClient.h:
      * html/FileStreamProxy.cpp:
      * html/FileStreamProxy.h:
      * html/FileThread.cpp:
      * html/FileThread.h:
      *...
      30ebbd3e
  14. 02 Jul, 2010 1 commit
    • dumi@chromium.org's avatar
      WebCore: DB clean up. · 2cdc316a
      dumi@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=41404
      
      Reviewed by Darin Fisher.
      
      1. Made all DatabaseTasks internal classes of Database and made
         the Database methods called by those tasks private.
      2. Removed the Database::stop{ed}() methods.
      3. Removed the code that kept track of open databases from
         ScriptExecutionContext (no longer needed).
      4. Made minor changes to Database::closeImmediately() to make it
         possible for DatabaseThread to call that method instead of
         close().
      5. Minor fix to DatabaseTracker: addOpenDatabase() should call
         OriginQuotaManager::addDatabase() if the origin quota manager
         is not tracking this origin.
      6. Removed Database::performPolicyChecks(). We already update the
         DB size after each transaction, and we enforce a max size for
         the DB at the beginning of each transaction.
      
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContext::stopDatabases):
      * dom/ScriptExecutionContext.h:
      (WebCore::ScriptExecutionContext::hasOpenDatabases):
      * storage/Database.cpp:
      (WebCore::Database::openDatabase):
      (WebCore::Database::Database):
      (WebCore::Database::markAsDeletedAndClose):
      (WebCore::Database::close):
      (WebCore::Database::closeImmediately):
      * storage/Database.h:
      * storage/DatabaseTask.cpp:
      (WebCore::DatabaseTask::performTask):
      (WebCore::Database::DatabaseOpenTask::DatabaseOpenTask):
      (WebCore::Database::DatabaseOpenTask::doPerformTask):
      (WebCore::Database::DatabaseOpenTask::debugTaskName):
      (WebCore::Database::DatabaseCloseTask::DatabaseCloseTask):
      (WebCore::Database::DatabaseCloseTask::doPerformTask):
      (WebCore::Database::DatabaseCloseTask::debugTaskName):
      (WebCore::Database::DatabaseTransactionTask::DatabaseTransactionTask):
      (WebCore::Database::DatabaseTransactionTask::doPerformTask):
      (WebCore::Database::DatabaseTransactionTask::debugTaskName):
      (WebCore::Database::DatabaseTableNamesTask::DatabaseTableNamesTask):
      (WebCore::Database::DatabaseTableNamesTask::doPerformTask):
      (WebCore::Database::DatabaseTableNamesTask::debugTaskName):
      * storage/DatabaseTask.h:
      (WebCore::Database::DatabaseOpenTask::create):
      (WebCore::Database::DatabaseCloseTask::create):
      (WebCore::Database::DatabaseTransactionTask::create):
      (WebCore::Database::DatabaseTableNamesTask::create):
      * storage/DatabaseThread.cpp:
      (WebCore::DatabaseThread::databaseThread):
      * storage/DatabaseTracker.cpp:
      (WebCore::DatabaseTracker::addOpenDatabase):
      * storage/SQLTransaction.cpp:
      (WebCore::SQLTransaction::executeSQL):
      (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
      
      LayoutTests: Minor change to a DB test to make it run correctly with run-webkit-tests --iterations N.
      https://bugs.webkit.org/show_bug.cgi?id=41404
      
      Reviewed by Darin Fisher.
      
      * storage/open-database-creation-callback.html:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@62411 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2cdc316a
  15. 01 Jul, 2010 2 commits
    • dumi@chromium.org's avatar
      2010-07-01 Sheriff Bot <webkit.review.bot@gmail.com> · 8da9433c
      dumi@chromium.org authored
              Unreviewed, rolling out r62321.
              http://trac.webkit.org/changeset/62321
              https://bugs.webkit.org/show_bug.cgi?id=41494
      
              Broke the non-win builds. (Requested by dumi on #webkit).
      
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::addOpenDatabase):
              (WebCore::ScriptExecutionContext::removeOpenDatabase):
              (WebCore::ScriptExecutionContext::stopDatabases):
              * dom/ScriptExecutionContext.h:
              * storage/Database.cpp:
              (WebCore::Database::openDatabase):
              (WebCore::Database::Database):
              (WebCore::Database::markAsDeletedAndClose):
              (WebCore::ContextRemoveOpenDatabaseTask::create):
              (WebCore::ContextRemoveOpenDatabaseTask::performTask):
              (WebCore::ContextRemoveOpenDatabaseTask::isCleanupTask):
              (WebCore::ContextRemoveOpenDatabaseTask::ContextRemoveOpenDatabaseTask):
              (WebCore::Database::close):
              (WebCore::Database::closeImmediately):
              (WebCore::Database::stop):
              (WebCore::Database::performPolicyChecks):
              * storage/Database.h:
              (WebCore::Database::):
              (WebCore::Database::stopped):
              * storage/DatabaseTask.cpp:
              (WebCore::DatabaseTask::performTask):
              (WebCore::DatabaseOpenTask::DatabaseOpenTask):
              (WebCore::DatabaseOpenTask::doPerformTask):
              (WebCore::DatabaseOpenTask::debugTaskName):
              (WebCore::DatabaseCloseTask::DatabaseCloseTask):
              (WebCore::DatabaseCloseTask::doPerformTask):
              (WebCore::DatabaseCloseTask::debugTaskName):
              (WebCore::DatabaseTransactionTask::DatabaseTransactionTask):
              (WebCore::DatabaseTransactionTask::~DatabaseTransactionTask):
              (WebCore::DatabaseTransactionTask::doPerformTask):
              (WebCore::DatabaseTransactionTask::debugTaskName):
              (WebCore::DatabaseTableNamesTask::DatabaseTableNamesTask):
              (WebCore::DatabaseTableNamesTask::doPerformTask):
              (WebCore::DatabaseTableNamesTask::debugTaskName):
              * storage/DatabaseTask.h:
              (WebCore::DatabaseOpenTask::create):
              (WebCore::DatabaseCloseTask::create):
              (WebCore::DatabaseTransactionTask::create):
              (WebCore::DatabaseTableNamesTask::create):
              * storage/DatabaseThread.cpp:
              (WebCore::DatabaseThread::databaseThread):
              * storage/DatabaseTracker.cpp:
              (WebCore::DatabaseTracker::addOpenDatabase):
              * storage/SQLTransaction.cpp:
              (WebCore::SQLTransaction::executeSQL):
              (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
      2010-07-01  Sheriff Bot  <webkit.review.bot@gmail.com>
      
              Unreviewed, rolling out r62321.
              http://trac.webkit.org/changeset/62321
              https://bugs.webkit.org/show_bug.cgi?id=41494
      
              Broke the non-win builds. (Requested by dumi on #webkit).
      
              * storage/open-database-creation-callback.html:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@62335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8da9433c
    • dumi@chromium.org's avatar
      WebCore: DB clean up. · 31969709
      dumi@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=41404
      
      Reviewed by Darin Fisher.
      
      1. Made all DatabaseTasks internal classes of Database and made
         the Database methods called by those tasks private.
      2. Removed the Database::stop{ed}() methods.
      3. Removed the code that kept track of open databases from
         ScriptExecutionContext (no longer needed).
      4. Made minor changes to Database::closeImmediately() to make it
         possible for DatabaseThread to call that method instead of
         close().
      5. Minor fix to DatabaseTracker: addOpenDatabase() should call
         OriginQuotaManager::addDatabase() if the origin quota manager
         is not tracking this origin.
      6. Removed Database::performPolicyChecks(). We already update the
         DB size after each transaction, and we enforce a max size for
         the DB at the beginning of each transaction.
      
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContext::stopDatabases):
      * dom/ScriptExecutionContext.h:
      (WebCore::ScriptExecutionContext::hasOpenDatabases):
      * storage/Database.cpp:
      (WebCore::Database::openDatabase):
      (WebCore::Database::Database):
      (WebCore::Database::markAsDeletedAndClose):
      (WebCore::Database::close):
      (WebCore::Database::closeImmediately):
      * storage/Database.h:
      * storage/DatabaseTask.cpp:
      (WebCore::DatabaseTask::performTask):
      (WebCore::Database::DatabaseOpenTask::DatabaseOpenTask):
      (WebCore::Database::DatabaseOpenTask::doPerformTask):
      (WebCore::Database::DatabaseOpenTask::debugTaskName):
      (WebCore::Database::DatabaseCloseTask::DatabaseCloseTask):
      (WebCore::Database::DatabaseCloseTask::doPerformTask):
      (WebCore::Database::DatabaseCloseTask::debugTaskName):
      (WebCore::Database::DatabaseTransactionTask::DatabaseTransactionTask):
      (WebCore::Database::DatabaseTransactionTask::doPerformTask):
      (WebCore::Database::DatabaseTransactionTask::debugTaskName):
      (WebCore::Database::DatabaseTableNamesTask::DatabaseTableNamesTask):
      (WebCore::Database::DatabaseTableNamesTask::doPerformTask):
      (WebCore::Database::DatabaseTableNamesTask::debugTaskName):
      * storage/DatabaseTask.h:
      (WebCore::Database::DatabaseOpenTask::create):
      (WebCore::Database::DatabaseCloseTask::create):
      (WebCore::Database::DatabaseTransactionTask::create):
      (WebCore::Database::DatabaseTableNamesTask::create):
      * storage/DatabaseThread.cpp:
      (WebCore::DatabaseThread::databaseThread):
      * storage/DatabaseTracker.cpp:
      (WebCore::DatabaseTracker::addOpenDatabase):
      * storage/SQLTransaction.cpp:
      (WebCore::SQLTransaction::executeSQL):
      (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
      
      LayoutTests: Minor change to a DB test to make it run correctly with run-webkit-tests --iterations N.
      https://bugs.webkit.org/show_bug.cgi?id=41404
      
      Reviewed by Darin Fisher.
      
      * storage/open-database-creation-callback.html:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@62321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      31969709
  16. 01 Apr, 2010 1 commit
  17. 22 Jan, 2010 1 commit
  18. 21 Jan, 2010 1 commit
  19. 20 Jan, 2010 1 commit
    • eric@webkit.org's avatar
      2010-01-20 Eric Uhrhane <ericu@chromium.org> · a1d89653
      eric@webkit.org authored
              Reviewed by Dmitry Titov.
      
              Refactoring and plumbing to get the HTML5 SQL Database API accessible to
              web workers.  No new functionality is exposed yet; this just gets the
              infrastructure in place.  It touches a lot of files in small ways; here
              are the main changes:
      
              1) Database members and methods move from Document up to
              ScriptExecutionContext.  Each of Document and WorkerContext must
              implement a few virtual methods where the Database code requires
              differentiation.
              2) Worker thread shutdown got changed a bunch to handle Database cleanup
              and thread synchronization issues.  Database cleanup tasks need to post
              some cleanup tasks to the JavaScript thread.  However, since database
              cleanup may happen due to the destruction of the WorkerThread, I added a
              handshake [involving WorkerThreadShutdownStartTask,
              WorkerThreadShutdownFinishTask, and a DatabaseTaskSynchronizer] between
              the Database thread and WorkerThread that cleans up all the Database
              stuff before the WorkerThread's runLoop can exit.
              3) The runtime enabler for the Database moved to a static variable
              accessible through Database::isAvailable, following the model used by
              WebSocket.
              4) Worker threads don't run their JavaScript on the Main thread, so
              Database code that differentiated between the Main thread and the
              Database thread now need to deal with a third possibility.
              5) Most of the other changes have to do with having a
              ScriptExecutionContext pointer instead of a Document pointer when
              dealing with a Database.  In many cases it's just a string replacement,
              but in some it required the creation of a new virtual function [e.g.
              databaseExceededQuota, isDatabaseReadOnly]
      
              https://bugs.webkit.org/show_bug.cgi?id=22725
      
              No new tests; in a future patch I'll add JSC and V8 bindings and new
              layout tests to exercise them.
      
              * bindings/v8/custom/V8DOMWindowCustom.cpp:
              (WebCore::V8DOMWindow::OpenDatabaseEnabled):
              * dom/Document.cpp:
              (WebCore::Document::Document):
              (WebCore::Document::~Document):
              (WebCore::Document::isDatabaseReadOnly):
              (WebCore::Document::databaseExceededQuota):
              (WebCore::Document::isContextThread):
              * dom/Document.h:
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::ScriptExecutionContext):
              (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
              (WebCore::ScriptExecutionContext::databaseThread):
              (WebCore::ScriptExecutionContext::addOpenDatabase):
              (WebCore::ScriptExecutionContext::removeOpenDatabase):
              (WebCore::ScriptExecutionContext::stopDatabases):
              * dom/ScriptExecutionContext.h:
              (WebCore::ScriptExecutionContext::setHasOpenDatabases):
              (WebCore::ScriptExecutionContext::hasOpenDatabases):
              (WebCore::ScriptExecutionContext::Task::isCleanupTask):
              * loader/FrameLoader.cpp:
              (WebCore::FrameLoader::stopLoading):
              * storage/Database.cpp:
              (WebCore::Database::setIsAvailable):
              (WebCore::Database::isAvailable):
              (WebCore::Database::openDatabase):
              (WebCore::Database::Database):
              (WebCore::DerefContextTask::create):
              (WebCore::DerefContextTask::performTask):
              (WebCore::DerefContextTask::isCleanupTask):
              (WebCore::Database::~Database):
              (WebCore::Database::openAndVerifyVersion):
              (WebCore::Database::markAsDeletedAndClose):
              (WebCore::ContextRemoveOpenDatabaseTask::create):
              (WebCore::ContextRemoveOpenDatabaseTask::performTask):
              (WebCore::ContextRemoveOpenDatabaseTask::isCleanupTask):
              (WebCore::ContextRemoveOpenDatabaseTask::ContextRemoveOpenDatabaseTask):
              (WebCore::Database::close):
              (WebCore::Database::performOpenAndVerify):
              (WebCore::Database::scheduleTransaction):
              (WebCore::Database::scheduleTransactionStep):
              (WebCore::DeliverPendingCallbackTask::create):
              (WebCore::DeliverPendingCallbackTask::performTask):
              (WebCore::DeliverPendingCallbackTask::DeliverPendingCallbackTask):
              (WebCore::Database::scheduleTransactionCallback):
              (WebCore::Database::transactionClient):
              (WebCore::Database::transactionCoordinator):
              (WebCore::Database::tableNames):
              (WebCore::Database::securityOrigin):
              * storage/Database.h:
              (WebCore::Database::scriptExecutionContext):
              * storage/DatabaseTask.h:
              * storage/DatabaseThread.cpp:
              (WebCore::DatabaseThread::DatabaseThread):
              (WebCore::DatabaseThread::~DatabaseThread):
              (WebCore::DatabaseThread::requestTermination):
              (WebCore::DatabaseThread::databaseThread):
              (WebCore::DatabaseThread::unscheduleDatabaseTasks):
              * storage/DatabaseThread.h:
              * storage/DatabaseTracker.cpp:
              (WebCore::DatabaseTracker::canEstablishDatabase):
              (WebCore::DatabaseTracker::getMaxSizeForDatabase):
              * storage/DatabaseTracker.h:
              * storage/SQLTransaction.cpp:
              (WebCore::SQLTransaction::executeSQL):
              * storage/SQLTransactionClient.cpp:
              (WebCore::SQLTransactionClient::didCommitTransaction):
              (WebCore::SQLTransactionClient::didExecuteStatement):
              (WebCore::SQLTransactionClient::didExceedQuota):
              * storage/chromium/DatabaseTrackerChromium.cpp:
              (WebCore::DatabaseTracker::canEstablishDatabase):
              (WebCore::DatabaseTracker::addOpenDatabase):
              (WebCore::TrackerRemoveOpenDatabaseTask::create):
              (WebCore::TrackerRemoveOpenDatabaseTask::performTask):
              (WebCore::TrackerRemoveOpenDatabaseTask::TrackerRemoveOpenDatabaseTask):
              (WebCore::DatabaseTracker::removeOpenDatabase):
              (WebCore::DatabaseTracker::getMaxSizeForDatabase):
              * storage/chromium/SQLTransactionClientChromium.cpp:
              (WebCore::NotifyDatabaseChangedTask::create):
              (WebCore::NotifyDatabaseChangedTask::performTask):
              (WebCore::NotifyDatabaseChangedTask::NotifyDatabaseChangedTask):
              (WebCore::SQLTransactionClient::didCommitTransaction):
              (WebCore::SQLTransactionClient::didExecuteStatement):
              (WebCore::SQLTransactionClient::didExceedQuota):
              * workers/WorkerContext.cpp:
              (WebCore::WorkerContext::openDatabase):
              (WebCore::WorkerContext::isContextThread):
              * workers/WorkerContext.h:
              (WebCore::WorkerContext::clearScript):
              (WebCore::WorkerContext::thread):
              (WebCore::WorkerContext::isDatabaseReadOnly):
              (WebCore::WorkerContext::databaseExceededQuota):
              * workers/WorkerRunLoop.cpp:
              (WebCore::WorkerRunLoop::runInMode):
              (WebCore::WorkerRunLoop::Task::performTask):
              * workers/WorkerThread.cpp:
              (WebCore::WorkerThread::workerThread):
              (WebCore::WorkerThreadShutdownFinishTask::create):
              (WebCore::WorkerThreadShutdownFinishTask::performTask):
              (WebCore::WorkerThreadShutdownFinishTask::isCleanupTask):
              (WebCore::WorkerThreadShutdownStartTask::create):
              (WebCore::WorkerThreadShutdownStartTask::performTask):
              (WebCore::WorkerThreadShutdownStartTask::isCleanupTask):
              (WebCore::WorkerThread::stop):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a1d89653
  20. 18 Nov, 2009 1 commit
  21. 12 Nov, 2009 1 commit
    • dimich@chromium.org's avatar
      Add postTaskToMainThread to ScriptExecutionContext. · e547697a
      dimich@chromium.org authored
      Move the code to post task to the main thread into a new method on ScriptExecutionContext,
      to use as a helper implementation of the virtual ScriptExecutionContext::postTask(Task) in
      contexts that live on the main thread.
      https://bugs.webkit.org/show_bug.cgi?id=31427
      
      Reviewed by Alexey Proskuryakov.
      
      No new tests - simply moving the code.
      
      * dom/Document.cpp:
      (WebCore::Document::postTask):
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ScriptExecutionContextTaskTimer::ScriptExecutionContextTaskTimer):
      (WebCore::ScriptExecutionContextTaskTimer::fired):
      (WebCore::PerformTaskData::PerformTaskData):
      (WebCore::PerformTaskData::performTask):
      (WebCore::ScriptExecutionContext::postTaskToMainThread):
      * dom/ScriptExecutionContext.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e547697a
  22. 02 Nov, 2009 1 commit
    • dimich@chromium.org's avatar
      Remove threadsafe refcounting from tasks used with WTF::MessageQueue. · 142155ae
      dimich@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=30612
      
      Reviewed by David Levin.
      
      JavaScriptCore:
      
      * wtf/MessageQueue.h:
      (WTF::MessageQueue::alwaysTruePredicate):
      (WTF::MessageQueue::~MessageQueue):
      (WTF::MessageQueue::append):
      (WTF::MessageQueue::appendAndCheckEmpty):
      (WTF::MessageQueue::prepend):
      (WTF::MessageQueue::waitForMessage):
      (WTF::MessageQueue::waitForMessageFilteredWithTimeout):
      (WTF::MessageQueue::tryGetMessage):
      (WTF::MessageQueue::removeIf):
      The MessageQueue is changed to act as a queue of OwnPtr<DataType>. It takes ownership
      of posted tasks and passes it to the new owner (in another thread) when the task is fetched.
      All methods have arguments of type PassOwnPtr<DataType> and return the same type.
      
      * wtf/Threading.cpp:
      (WTF::createThread):
      Superficial change to trigger rebuild of JSC project on Windows,
      workaround for https://bugs.webkit.org/show_bug.cgi?id=30890
      
      WebCore:
      
      No new tests since no new functionality. Storage, MessagePorts and Workers tests cover this.
      
      There are a lot of files but most changes are simply replace RefPtr and PassRefPtr with
      OwnPtr and PassOwnPtr when dealing with Tasks.
      
      ScriptExecutionContext::Task, DatabaseTask and WorkerRunLoop::Task are no longer
      threadsafe refcounted, but simply Noncopyable.
      
      * dom/Document.cpp:
      (WebCore::ScriptExecutionContextTaskTimer::ScriptExecutionContextTaskTimer):
      (WebCore::PerformTaskContext::PerformTaskContext):
      (WebCore::Document::postTask):
      * dom/Document.h:
      * dom/ScriptExecutionContext.cpp:
      (WebCore::ProcessMessagesSoonTask::create):
      * dom/ScriptExecutionContext.h:
      * dom/default/PlatformMessagePortChannel.cpp:
      (WebCore::PlatformMessagePortChannel::tryGetMessageFromRemote):
      * dom/default/PlatformMessagePortChannel.h:
      (WebCore::PlatformMessagePortChannel::MessagePortQueue::tryGetMessage):
      (WebCore::PlatformMessagePortChannel::MessagePortQueue::appendAndCheckEmpty):
      * loader/FrameLoader.cpp:
      (WebCore::HashChangeEventTask::create):
      * loader/appcache/ApplicationCacheGroup.cpp:
      (WebCore::CallCacheListenerTask::create):
      * storage/Database.cpp:
      (WebCore::Database::openAndVerifyVersion):
      (WebCore::Database::markAsDeletedAndClose):
      (WebCore::Database::scheduleTransaction):
      (WebCore::Database::scheduleTransactionStep):
      (WebCore::Database::tableNames):
      * storage/DatabaseTask.h:
      (WebCore::DatabaseOpenTask::create):
      (WebCore::DatabaseCloseTask::create):
      (WebCore::DatabaseTransactionTask::create):
      (WebCore::DatabaseTableNamesTask::create):
      * storage/DatabaseThread.cpp:
      (WebCore::DatabaseThread::databaseThread):
      (WebCore::DatabaseThread::scheduleTask):
      (WebCore::DatabaseThread::scheduleImmediateTask):
      (WebCore::SameDatabasePredicate::operator()):
      * storage/DatabaseThread.h:
      * storage/LocalStorageTask.h:
      (WebCore::LocalStorageTask::createImport):
      (WebCore::LocalStorageTask::createSync):
      (WebCore::LocalStorageTask::createTerminate):
      * storage/LocalStorageThread.cpp:
      (WebCore::LocalStorageThread::localStorageThread):
      * storage/LocalStorageThread.h:
      * websockets/WebSocket.cpp:
      (WebCore::ProcessWebSocketEventTask::create):
      * workers/DefaultSharedWorkerRepository.cpp:
      (WebCore::SharedWorkerProxy::postTaskToLoader):
      (WebCore::SharedWorkerProxy::postTaskForModeToWorkerContext):
      (WebCore::SharedWorkerConnectTask::create):
      * workers/GenericWorkerTask.h:
      (WebCore::GenericWorkerTask1::create):
      (WebCore::GenericWorkerTask2::create):
      (WebCore::GenericWorkerTask3::create):
      (WebCore::GenericWorkerTask4::create):
      (WebCore::GenericWorkerTask5::create):
      (WebCore::GenericWorkerTask6::create):
      (WebCore::GenericWorkerTask7::create):
      (WebCore::GenericWorkerTask8::create):
      (WebCore::createCallbackTask):
      * workers/WorkerContext.cpp:
      (WebCore::WorkerContext::postTask):
      * workers/WorkerContext.h:
      * workers/WorkerLoaderProxy.h:
      * workers/WorkerMessagingProxy.cpp:
      (WebCore::MessageWorkerContextTask::create):
      (WebCore::MessageWorkerTask::create):
      (WebCore::WorkerExceptionTask::create):
      (WebCore::WorkerContextDestroyedTask::create):
      (WebCore::WorkerTerminateTask::create):
      (WebCore::WorkerThreadActivityReportTask::create):
      (WebCore::WorkerMessagingProxy::postTaskForModeToWorkerContext):
      (WebCore::WorkerMessagingProxy::postTaskToLoader):
      (WebCore::WorkerMessagingProxy::workerThreadCreated):
      * workers/WorkerMessagingProxy.h:
      * workers/WorkerRunLoop.cpp:
      (WebCore::ModePredicate::operator()):
      (WebCore::WorkerRunLoop::runInMode):
      (WebCore::WorkerRunLoop::postTask):
      (WebCore::WorkerRunLoop::postTaskForMode):
      (WebCore::WorkerRunLoop::Task::create):
      (WebCore::WorkerRunLoop::Task::performTask):
      (WebCore::WorkerRunLoop::Task::Task):
      * workers/WorkerRunLoop.h:
      (WebCore::WorkerRunLoop::Task::~Task):
      (WebCore::WorkerRunLoop::Task::mode):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      142155ae
  23. 23 Oct, 2009 1 commit
    • tony@chromium.org's avatar
      2009-10-23 Tony Chang <tony@chromium.org> · 91136d14
      tony@chromium.org authored
          
              Reviewed by David Levin.
      
              Fix Chromium build after IsoldatedWorld change (r49963).
              https://bugs.webkit.org/show_bug.cgi?id=30719
      
              * bindings/ScriptControllerBase.cpp:
              * bindings/js/ScriptController.cpp:
              (WebCore::ScriptController::executeScriptInIsolatedWorld):
              * bindings/v8/ScriptController.cpp:
              (WebCore::mainThreadNormalWorld):
              * bindings/v8/ScriptController.h:
              (WebCore::ScriptController::windowShell):
              (WebCore::ScriptController::existingWindowShell):
              * dom/Document.cpp:
              (WebCore::Document::createWrapperCache):
              * dom/ScriptExecutionContext.cpp:
              * dom/ScriptExecutionContext.h:
              * xml/XMLHttpRequest.cpp:
              * xml/XMLHttpRequest.h:
      
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      91136d14
  24. 22 Oct, 2009 1 commit
    • barraclough@apple.com's avatar
      WebCore: https://bugs.webkit.org/show_bug.cgi?id=30696 · c53df831
      barraclough@apple.com authored
      Add support for IsolatedWorlds to JSC bindings.
      
      Patch by Gavin Barraclough <barraclough@apple.com> on 2009-10-16
      Reviewed by Sam Weinig & Geoff Garen.
      
      An IsolatedWorld is basically a parallel, separate copy of the window shells and DOM wrapper objects for
      a given document.  To support isolation this patch:
      
          * Adds support to the ScriptController to track multiple window shells, one per world.
          * Adds support to Document to support multiple separate wrapper-maps, one per world.
          * Replaces the single global DOM wrapper map (on the WebCoreJSClientData) with separate maps,
            stored on the (new) IsolatedWorld objects.
      
      In addition to supporting separate copies of these objects, two other features are supported:
      
          * It is necessary to track the current world on entry into JSC, so that within callbacks out to WebCore
            we can determine which world (and as such, set of DOM bindings) we should be operating on.
          * EventListeners & Callbacks are run in the world they were registered in.
            This requires the handler to retain a reference to the world.
      
      No new tests. (Enabled existing isolated world layout tests.)
      
      * WebCore.base.exp:
      * bindings/js/JSAbstractWorkerCustom.cpp:
      (WebCore::JSAbstractWorker::addEventListener):
      (WebCore::JSAbstractWorker::removeEventListener):
      * bindings/js/JSCallbackData.cpp:
      (WebCore::JSCallbackData::invokeCallback):
      * bindings/js/JSCallbackData.h:
      (WebCore::JSCallbackData::JSCallbackData):
      * bindings/js/JSCustomXPathNSResolver.cpp:
      (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
      * bindings/js/JSDOMApplicationCacheCustom.cpp:
      (WebCore::JSDOMApplicationCache::addEventListener):
      (WebCore::JSDOMApplicationCache::removeEventListener):
      * bindings/js/JSDOMBinding.cpp:
      (WebCore::removeWrappers):
      (WebCore::DOMObjectWrapperMap::get):
      (WebCore::DOMObjectWrapperMap::set):
      (WebCore::DOMObjectWrapperMap::remove):
      (WebCore::DOMObjectWrapperMap::take):
      (WebCore::IsolatedWorld::IsolatedWorld):
      (WebCore::IsolatedWorld::~IsolatedWorld):
      (WebCore::EnterIsolatedWorld::EnterIsolatedWorld):
      (WebCore::EnterIsolatedWorld::~EnterIsolatedWorld):
      (WebCore::JSGlobalDataWorldIterator::JSGlobalDataWorldIterator):
      (WebCore::JSGlobalDataWorldIterator::operator bool):
      (WebCore::JSGlobalDataWorldIterator::operator*):
      (WebCore::JSGlobalDataWorldIterator::operator->):
      (WebCore::JSGlobalDataWorldIterator::operator++):
      (WebCore::getCurrentWorld):
      (WebCore::getNormalWorld):
      (WebCore::commonNormalWorld):
      (WebCore::commonCurrentWorld):
      (WebCore::DOMObjectHashTableMap::mapFor):
      (WebCore::DOMObjectWrapperMap::mapFor):
      (WebCore::forgetDOMObject):
      (WebCore::getCachedDOMNodeWrapper):
      (WebCore::forgetDOMNode):
      (WebCore::cacheDOMNodeWrapper):
      (WebCore::forgetAllDOMNodesForDocument):
      (WebCore::forgetWorldOfDOMNodesForDocument):
      (WebCore::isObservableThroughDOM):
      (WebCore::markDOMNodesForDocument):
      (WebCore::markActiveObjectsForContext):
      (WebCore::takeWrappers):
      (WebCore::updateDOMNodeDocument):
      (WebCore::markDOMObjectWrapper):
      (WebCore::allowsAccessFromFrame):
      (WebCore::printErrorMessageForFrame):
      (WebCore::JSC_DebuggerCallFrame_evaluateInWorld):
      (WebCore::JSC_callInWorld):
      (WebCore::JSC_constructInWorld):
      (WebCore::JSC_evaluateInWorld):
      * bindings/js/JSDOMBinding.h:
      (WebCore::IsolatedWorld::rememberDocument):
      (WebCore::IsolatedWorld::forgetDocument):
      (WebCore::IsolatedWorld::rememberScriptController):
      (WebCore::IsolatedWorld::forgetScriptController):
      (WebCore::DOMObjectHashTableMap::~DOMObjectHashTableMap):
      (WebCore::DOMObjectHashTableMap::get):
      (WebCore::WebCoreJSClientData::WebCoreJSClientData):
      (WebCore::WebCoreJSClientData::currentWorld):
      (WebCore::WebCoreJSClientData::normalWorld):
      (WebCore::WebCoreJSClientData::rememberWorld):
      (WebCore::WebCoreJSClientData::forgetWorld):
      (WebCore::debuggerWorld):
      (WebCore::pluginWorld):
      * bindings/js/JSDOMGlobalObject.cpp:
      (WebCore::JSDOMGlobalObject::createJSAttributeEventListener):
      (WebCore::toJSDOMGlobalObject):
      * bindings/js/JSDOMGlobalObject.h:
      * bindings/js/JSDOMWindowBase.cpp:
      (WebCore::JSDOMWindowBase::printErrorMessage):
      (WebCore::JSDOMWindowBase::commonJSGlobalData):
      (WebCore::toJS):
      (WebCore::toJSDOMWindow):
      * bindings/js/JSDOMWindowBase.h:
      * bindings/js/JSDOMWindowCustom.cpp:
      (WebCore::createWindow):
      (WebCore::JSDOMWindow::open):
      (WebCore::JSDOMWindow::showModalDialog):
      (WebCore::JSDOMWindow::setTimeout):
      (WebCore::JSDOMWindow::setInterval):
      (WebCore::JSDOMWindow::addEventListener):
      (WebCore::JSDOMWindow::removeEventListener):
      * bindings/js/JSDOMWindowShell.cpp:
      (WebCore::toJS):
      (WebCore::toJSDOMWindowShell):
      * bindings/js/JSDOMWindowShell.h:
      * bindings/js/JSDesktopNotificationsCustom.cpp:
      (WebCore::JSNotification::addEventListener):
      (WebCore::):
      * bindings/js/JSEventListener.cpp:
      (WebCore::JSEventListener::JSEventListener):
      (WebCore::JSEventListener::handleEvent):
      (WebCore::JSEventListener::reportError):
      * bindings/js/JSEventListener.h:
      (WebCore::JSEventListener::create):
      * bindings/js/JSEventSourceCustom.cpp:
      (WebCore::JSEventSource::addEventListener):
      (WebCore::JSEventSource::removeEventListener):
      * bindings/js/JSEventTarget.cpp:
      (WebCore::toJS):
      * bindings/js/JSHTMLDocumentCustom.cpp:
      (WebCore::JSHTMLDocument::open):
      * bindings/js/JSHTMLFrameSetElementCustom.cpp:
      (WebCore::JSHTMLFrameSetElement::nameGetter):
      * bindings/js/JSInspectorBackendCustom.cpp:
      (WebCore::JSInspectorBackend::databaseForId):
      (WebCore::JSInspectorBackend::inspectedWindow):
      (WebCore::JSInspectorBackend::nodeForId):
      * bindings/js/JSLazyEventListener.cpp:
      (WebCore::JSLazyEventListener::JSLazyEventListener):
      (WebCore::JSLazyEventListener::parseCode):
      * bindings/js/JSLazyEventListener.h:
      (WebCore::JSLazyEventListener::create):
      * bindings/js/JSMessageChannelCustom.cpp:
      (WebCore::JSMessageChannel::markChildren):
      * bindings/js/JSMessagePortCustom.cpp:
      (WebCore::JSMessagePort::markChildren):
      (WebCore::JSMessagePort::addEventListener):
      (WebCore::JSMessagePort::removeEventListener):
      * bindings/js/JSNodeCustom.cpp:
      (WebCore::JSNode::addEventListener):
      (WebCore::JSNode::removeEventListener):
      (WebCore::JSNode::markChildren):
      * bindings/js/JSNodeFilterCondition.cpp:
      (WebCore::JSNodeFilterCondition::acceptNode):
      * bindings/js/JSQuarantinedObjectWrapper.cpp:
      (WebCore::JSQuarantinedObjectWrapper::construct):
      (WebCore::JSQuarantinedObjectWrapper::call):
      * bindings/js/JSSVGElementInstanceCustom.cpp:
      (WebCore::JSSVGElementInstance::addEventListener):
      (WebCore::JSSVGElementInstance::removeEventListener):
      * bindings/js/JSSharedWorkerCustom.cpp:
      (WebCore::JSSharedWorker::markChildren):
      * bindings/js/JSWebSocketCustom.cpp:
      (WebCore::JSWebSocket::addEventListener):
      (WebCore::JSWebSocket::removeEventListener):
      * bindings/js/JSWorkerContextCustom.cpp:
      (WebCore::JSWorkerContext::addEventListener):
      (WebCore::JSWorkerContext::removeEventListener):
      (WebCore::JSWorkerContext::setTimeout):
      (WebCore::JSWorkerContext::setInterval):
      * bindings/js/JSXMLHttpRequestConstructor.cpp:
      (WebCore::constructXMLHttpRequest):
      * bindings/js/JSXMLHttpRequestCustom.cpp:
      (WebCore::JSXMLHttpRequest::markChildren):
      (WebCore::JSXMLHttpRequest::addEventListener):
      (WebCore::JSXMLHttpRequest::removeEventListener):
      * bindings/js/JSXMLHttpRequestUploadCustom.cpp:
      (WebCore::JSXMLHttpRequestUpload::markChildren):
      (WebCore::JSXMLHttpRequestUpload::addEventListener):
      (WebCore::JSXMLHttpRequestUpload::removeEventListener):
      * bindings/js/ScheduledAction.cpp:
      (WebCore::ScheduledAction::create):
      (WebCore::ScheduledAction::ScheduledAction):
      (WebCore::ScheduledAction::executeFunctionInContext):
      (WebCore::ScheduledAction::execute):
      * bindings/js/ScheduledAction.h:
      (WebCore::ScheduledAction::ScheduledAction):
      * bindings/js/ScriptCachedFrameData.cpp:
      (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
      (WebCore::ScriptCachedFrameData::restore):
      * bindings/js/ScriptController.cpp:
      (WebCore::ScriptController::~ScriptController):
      (WebCore::ScriptController::evaluateInWorld):
      (WebCore::ScriptController::evaluate):
      (WebCore::ScriptController::evaluateInIsolatedWorld):
      (WebCore::ScriptController::clearWindowShell):
      (WebCore::ScriptController::initScript):
      (WebCore::ScriptController::processingUserGestureEvent):
      (WebCore::ScriptController::attachDebugger):
      (WebCore::ScriptController::updateDocument):
      (WebCore::ScriptController::bindingRootObject):
      (WebCore::ScriptController::createRootObject):
      (WebCore::ScriptController::windowScriptNPObject):
      (WebCore::ScriptController::jsObjectForPluginElement):
      * bindings/js/ScriptController.h:
      (WebCore::ScriptController::windowShell):
      (WebCore::ScriptController::existingWindowShell):
      (WebCore::ScriptController::globalObject):
      (WebCore::ScriptController::forgetWorld):
      * bindings/js/ScriptControllerMac.mm:
      (WebCore::ScriptController::windowScriptObject):
      * bindings/js/ScriptEventListener.cpp:
      (WebCore::createAttributeEventListener):
      * bindings/js/ScriptFunctionCall.cpp:
      (WebCore::ScriptFunctionCall::call):
      (WebCore::ScriptFunctionCall::construct):
      * bindings/js/ScriptObjectQuarantine.cpp:
      (WebCore::getQuarantinedScriptObject):
      * bindings/js/ScriptState.cpp:
      (WebCore::scriptStateFromNode):
      (WebCore::scriptStateFromPage):
      * bindings/js/ScriptState.h:
      * bindings/js/WorkerScriptController.cpp:
      (WebCore::WorkerScriptController::WorkerScriptController):
      (WebCore::WorkerScriptController::evaluate):
      * bindings/objc/DOMInternal.mm:
      (-[WebScriptObject _initializeScriptDOMNodeImp]):
      * bindings/objc/WebScriptObject.mm:
      (-[WebScriptObject callWebScriptMethod:withArguments:]):
      (-[WebScriptObject evaluateWebScript:]):
      * bindings/scripts/CodeGeneratorJS.pm:
      * bridge/NP_jsobject.cpp:
      (_NPN_InvokeDefault):
      (_NPN_Invoke):
      (_NPN_Evaluate):
      (_NPN_Construct):
      * bridge/jni/jni_jsobject.mm:
      (JavaJSObject::call):
      (JavaJSObject::eval):
      * dom/Document.cpp:
      (WebCore::Document::createWrapperCache):
      * dom/Document.h:
      (WebCore::Document::wrapperCacheMap):
      (WebCore::Document::getWrapperCache):
      * inspector/InspectorController.cpp:
      (WebCore::InspectorController::startUserInitiatedProfiling):
      (WebCore::InspectorController::stopUserInitiatedProfiling):
      * inspector/JavaScriptCallFrame.cpp:
      (WebCore::JavaScriptCallFrame::evaluate):
      * loader/FrameLoader.cpp:
      (WebCore::FrameLoader::dispatchWindowObjectAvailable):
      * platform/network/mac/AuthenticationMac.mm:
      * xml/XMLHttpRequest.cpp:
      (WebCore::XMLHttpRequest::XMLHttpRequest):
      (WebCore::XMLHttpRequest::dropProtection):
      * xml/XMLHttpRequest.h:
      (WebCore::XMLHttpRequest::create):
      
      WebKit/mac: https://bugs.webkit.org/show_bug.cgi?id=30696
      Update to incorporate support for IsolatedWorlds in JSC bindings.
      
      Patch by Gavin Barraclough <barraclough@apple.com> on 2009-10-16
      Reviewed by Sam Weinig & Geoff Garen.
      
      * WebView/WebFrame.mm:
      (-[WebFrame _attachScriptDebugger]):
      (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
      (-[WebFrame globalContext]):
      * WebView/WebScriptDebugDelegate.mm:
      (-[WebScriptCallFrame evaluateWebScript:]):
      * WebView/WebView.mm:
      (-[WebView aeDescByEvaluatingJavaScriptFromString:]):
      
      WebKit/win: https://bugs.webkit.org/show_bug.cgi?id=30696
      Update to incorporate support for IsolatedWorlds in JSC bindings.
      
      Patch by Gavin Barraclough <barraclough@apple.com> on 2009-10-22
      Reviewed by Sam Weinig & Geoff Garen.
      
      * Interfaces/IWebFramePrivate.idl:
      * WebFrame.cpp:
      (WebFrame::globalContext):
      (WebFrame::windowObjectCleared):
      (WebFrame::stringByEvaluatingJavaScriptInIsolatedWorld):
      * WebFrame.h:
      
      WebKitTools: https://bugs.webkit.org/show_bug.cgi?id=30696
      Enable isolated-worlds tests on mac.
      
      Patch by Gavin Barraclough <barraclough@apple.com> on 2009-10-22
      Reviewed by Sam Weinig & Geoff Garen.
      
      Add private interface for DRT to invoke execution in a given world.
      
      * DumpRenderTree/LayoutTestController.cpp:
      (evaluateScriptInIsolatedWorldCallback):
      (LayoutTestController::staticFunctions):
      * DumpRenderTree/LayoutTestController.h:
      * DumpRenderTree/mac/LayoutTestControllerMac.mm:
      (LayoutTestController::evaluateScriptInIsolatedWorld):
      * DumpRenderTree/win/LayoutTestControllerWin.cpp:
      (LayoutTestController::evaluateScriptInIsolatedWorld):
      
      LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=30696
      Enable isolated-worlds tests on mac.
        * Update the results to switch from windows to unix line-endings.
        * Update all-window-prototypes.html to allow for properties on
          the global object with null prototypes (just skip over them).
      
      Patch by Gavin Barraclough <barraclough@apple.com> on 2009-10-19
      Reviewed by Sam Weinig & Geoff Garen.
      
      * http/tests/security/isolatedWorld/all-window-properties-expected.txt:
      * http/tests/security/isolatedWorld/all-window-prototypes-expected.txt:
      * http/tests/security/isolatedWorld/all-window-prototypes.html:
      * http/tests/security/isolatedWorld/body-properties-expected.txt:
      * http/tests/security/isolatedWorld/body-prototype-expected.txt:
      * http/tests/security/isolatedWorld/document-properties-expected.txt:
      * http/tests/security/isolatedWorld/document-prototype-expected.txt:
      * http/tests/security/isolatedWorld/global-variables-expected.txt:
      * http/tests/security/isolatedWorld/image-properties-expected.txt:
      * http/tests/security/isolatedWorld/image-prototype-expected.txt:
      * http/tests/security/isolatedWorld/location-properties-expected.txt:
      * http/tests/security/isolatedWorld/location-prototype-expected.txt:
      * http/tests/security/isolatedWorld/number-prototype-expected.txt:
      * http/tests/security/isolatedWorld/object-prototype-expected.txt:
      * http/tests/security/isolatedWorld/storage-properties-expected.txt:
      * http/tests/security/isolatedWorld/storage-prototype-expected.txt:
      * http/tests/security/isolatedWorld/string-prototype-expected.txt:
      * http/tests/security/isolatedWorld/window-properties-expected.txt:
      * platform/mac/Skipped:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c53df831
  25. 21 Jun, 2009 1 commit
    • levin@chromium.org's avatar
      JavaScriptCore: · 3affb89e
      levin@chromium.org authored
      2009-06-21  Drew Wilson  <atwilson@google.com>
      
              Reviewed by David Levin.
      
              <https://bugs.webkit.org/show_bug.cgi?id=25043>
              Added support for multi-threaded MessagePorts.
      
              * wtf/MessageQueue.h:
              (WTF::::appendAndCheckEmpty):
                  Added API to test whether the queue was empty before adding an element.
      
      WebCore:
      
      2009-06-21  Drew Wilson  <atwilson@google.com>
      
              Reviewed by David Levin.
      
              <https://bugs.webkit.org/show_bug.cgi?id=25043>
              Removed obsolete MessagePort.startConversation(), active and onclose APIs.
      
              Refactored MessagePortProxy into MessagePortChannel and a platform-dependent PlatformMessagePortChannel
              implementation. Modified APIs to simplify cross-process implementations by moving the messaging code
              entirely into the platform-dependent proxy.
      
              Created a thread-safe default PlatformMessagePortChannel implementation.
      
              Changed DOMWindow messaging to create the MessageEvent in the target ScriptExecutionContext to match how
              cross-thread MessagePorts work.
      
              * GNUMakefile.am:
              * WebCore.vcproj/WebCore.vcproj:
              * WebCore.xcodeproj/project.pbxproj:
                  Added MessagePortChannel/PlatformMessagePortChannel files.
              * bindings/js/JSMessagePortCustom.cpp:
              (WebCore::JSMessagePort::mark):
                  Changed ports to not mark their entangled pair as reachable, per the spec.
              * bindings/v8/custom/V8MessagePortCustom.cpp:
              * dom/MessageChannel.cpp:
              (WebCore::MessageChannel::MessageChannel):
                  Updated to use PlatformMessagePortChannel::createChannel() to entangle the ports.
              * dom/MessagePort.cpp:
              (WebCore::MessagePort::MessagePort):
              (WebCore::MessagePort::~MessagePort):
              (WebCore::MessagePort::postMessage):
              (WebCore::MessagePort::disentangle):
              (WebCore::MessagePort::messageAvailable):
              (WebCore::MessagePort::start):
              (WebCore::MessagePort::close):
              (WebCore::MessagePort::entangle):
              (WebCore::MessagePort::contextDestroyed):
              (WebCore::MessagePort::dispatchMessages):
              (WebCore::MessagePort::setOnmessage):
              (WebCore::MessagePort::hasPendingActivity):
                  Changed these APIs to delegate to new PlatformMessagePortChannel APIs.
              * dom/MessagePort.h:
                  Renamed isQueueOpen() to started().
              * dom/MessagePort.idl:
                  Removed startConversation and onclose.
              * dom/MessagePortProxy.h: Removed.
              * dom/MessagePortChannel.cpp: Added.
              (WebCore::MessagePortChannel::EventData::create):
              (WebCore::MessagePortChannel::EventData::EventData):
              (WebCore::MessagePortChannel::~MessagePortChannel):
              * dom/MessagePortChannel.h: Added.
              (WebCore::MessagePortChannel::EventData::message):
              (WebCore::MessagePortChannel::EventData::channel):
                  Changed EventData to hold a reference to a MessagePortChannel object instead of a MessagePort to enable cross-thread messaging.
              (WebCore::MessagePortChannel::MessagePortChannel):
              (WebCore::MessagePortChannel::create):
              * dom/ScriptExecutionContext.cpp:
              (WebCore:ScriptExecutionContext::dispatchMessagePortEvents):
                  Renamed isQueueOpen() to started().
              * dom/default/PlatformMessagePortChannel.cpp: Added.
              (WebCore::MessagePortChannel::entangleIfOpen):
              (WebCore::MessagePortChannel::disentangle):
              (WebCore::MessagePortChannel::postMessageToRemote):
              (WebCore::MessagePortChannel::tryGetMessageFromRemote):
              (WebCore::MessagePortChannel::close):
              (WebCore::MessagePortChannel::isConnectedTo):
              (WebCore::MessagePortChannel::hasPendingActivity):
              (WebCore::PlatformMessagePortChannel::PlatformMessagePortChannel):
              (WebCore::PlatformMessagePortChannel::~PlatformMessagePortChannel):
              (WebCore::PlatformMessagePortChannel::createChannel):
              (WebCore::PlatformMessagePortChannel::entangleIfOpen):
              (WebCore::PlatformMessagePortChannel::disentangle):
              (WebCore::PlatformMessagePortChannel::setRemotePort):
              (WebCore::PlatformMessagePortChannel::remotePort):
              (WebCore::PlatformMessagePortChannel::entangledChannel):
              (WebCore::PlatformMessagePortChannel::setEntangledChannel):
              (WebCore::PlatformMessagePortChannel::postMessageToRemote):
              (WebCore::PlatformMessagePortChannel::tryGetMessageFromRemote):
              (WebCore::PlatformMessagePortChannel::isConnectedTo):
              (WebCore::PlatformMessagePortChannel::close):
              (WebCore::PlatformMessagePortChannel::closeInternal):
              (WebCore::PlatformMessagePortChannel::hasPendingActivity):
              * dom/default/PlatformMessagePortChannel.h: Added.
              (WebCore::PlatformMessagePortChannel::MessagePortQueue::create):
              (WebCore::PlatformMessagePortChannel::MessagePortQueue::tryGetMessage):
              (WebCore::PlatformMessagePortChannel::MessagePortQueue::appendAndCheckEmpty):
              (WebCore::PlatformMessagePortChannel::MessagePortQueue::isEmpty):
              (WebCore::PlatformMessagePortChannel::MessagePortQueue::MessagePortQueue):
              * page/DOMWindow.cpp:
              (WebCore::PostMessageTimer::PostMessageTimer):
                  Changed DOMWindow messaging to create the MessageEvent in the target ScriptExecutionContext to match how cross-thread MessagePorts work.
              (WebCore::PostMessageTimer::event):
              (WebCore::DOMWindow::postMessage):
              (WebCore::DOMWindow::postMessageTimerFired):
      
      LayoutTests:
      
      2009-06-21  Drew Wilson  <atwilson@google.com>
      
              Reviewed by David Levin.
      
              <https://bugs.webkit.org/show_bug.cgi?id=25043>
              Updated MessageChannel/MessagePorts tests to reflect latest spec (close event has been removed).
              Added more tests of port cloning.
      
              * fast/events/message-channel-gc-2-expected.txt:
              * fast/events/message-channel-gc-2.html-disabled:
              * fast/events/message-channel-gc-3-expected.txt:
              * fast/events/message-channel-gc-3.html-disabled:
              * fast/events/message-channel-gc-expected.txt:
              * fast/events/message-channel-gc.html-disabled:
              * fast/events/message-port-clone-expected.txt: Added.
              * fast/events/message-port-clone.html-disabled: Added.
              * fast/events/message-port-expected.txt:
              * fast/events/message-port-no-wrapper-expected.txt: Added.
              * fast/events/message-port-onclose-expected.txt: Removed.
              * fast/events/message-port-onclose.html-disabled: Removed.
              * fast/events/message-port.html-disabled:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3affb89e
  26. 03 Feb, 2009 1 commit
    • ap@webkit.org's avatar
      2009-02-03 Dmitry Titov <dimich@chromium.org> · 177db693
      ap@webkit.org authored
              Reviewed by Alexey Proskuryakov.
      
              https://bugs.webkit.org/show_bug.cgi?id=22718
              Implement WindowTimers interface in Workers.
      
              This patch moves timeoutID from Document to ScriptExecutionContext
              and exposes JS methods setTimeout/setInterval/clearTimeout/clearInterval inside of a Worker.
              Also added a test for those methods.
      
              Test: fast/workers/worker-timeout.html
      
              * bindings/js/JSWorkerContextCustom.cpp:
              (WebCore::setTimeoutOrInterval):
              Creates ScheduledAction and calls WorkerContext::installTimeout to actually add a timer.
      
              (WebCore::JSWorkerContext::setTimeout):
              (WebCore::JSWorkerContext::clearTimeout):
              (WebCore::JSWorkerContext::setInterval):
              (WebCore::JSWorkerContext::clearInterval):
              Added methods exposed to JS.
      
              * dom/Document.cpp:
              * dom/Document.h:
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::addTimeout):
              (WebCore::ScriptExecutionContext::removeTimeout):
              (WebCore::ScriptExecutionContext::findTimeout):
              * dom/ScriptExecutionContext.h:
              The timerID map moves from Document to ScriptExecutionContext,
              to be available to Document and to WorkerContext.
      
              * dom/WorkerContext.cpp:
              (WebCore::WorkerContext::installTimeout): Adds a DOMTimeout.
              (WebCore::WorkerContext::removeTimeout): Removes a DOMTimeout.
              * dom/WorkerContext.h:
      
              * page/DOMTimer.cpp:
              (WebCore::DOMTimer::DOMTimer):
              (WebCore::DOMTimer::~DOMTimer):
              (WebCore::DOMTimer::removeById):
              Code change here reflects move of timeoutID map to the ScriptExecutionContext.
              Some checks and casts are no longer needed.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      177db693
  27. 05 Dec, 2008 1 commit
    • ap@webkit.org's avatar
      Reviewed by Darin Adler. · 2658fb31
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=22672
              ASSERT(m_table) when xhr.onabort creates another xhr or calls setTimeout
      
              Test: http/tests/xmlhttprequest/send-on-abort.html
      
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects):
              (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
              (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
              (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
              Add a comment explaining that ActiveDOMObject methods shouldn't execute arbitrary JS.
      
              * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::stop): Don't dispatch events. This
              reverts a recent change that made the behavior slightly closer to Firefox - but the
              compatibility effect should be very minor if any, and Firefox itself behaves inconsistently.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2658fb31
  28. 04 Dec, 2008 1 commit
    • ap@webkit.org's avatar
      Reviewed by Alexey Proskuryakov. · a3f2d9f3
      ap@webkit.org authored
              Make ScriptExecutionContextTaskWorkerTask::performTask a pure virtual function.
              https://bugs.webkit.org/show_bug.cgi?id=22642
      
              * dom/Document.cpp:
              (WebCore::ScriptExecutionContextTaskTimer::ScriptExecutionContextTaskTimer):
              (WebCore::ScriptExecutionContextTaskTimer::fired):
              (WebCore::PerformTaskContext::PerformTaskContext):
              (WebCore::performTask):
              (WebCore::Document::postTask):
              * dom/Document.h:
              * dom/ScriptExecutionContext.cpp:
              * dom/ScriptExecutionContext.h:
              * dom/WorkerContext.cpp:
              (WebCore::ScriptExecutionContextTaskWorkerTask::create):
              (WebCore::ScriptExecutionContextTaskWorkerTask::ScriptExecutionContextTaskWorkerTask):
              (WebCore::ScriptExecutionContextTaskWorkerTask::performTask):
              (WebCore::WorkerContext::postTask):
              * dom/WorkerContext.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a3f2d9f3
  29. 03 Dec, 2008 1 commit
    • ap@webkit.org's avatar
      Reviewed by Maciej Stachowiak. · 773343a3
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=22543
              Consolidate ActiveDOMObject page cache interaction
      
              Test: http/tests/xmlhttprequest/abort-on-leaving-page.html
      
              * dom/ActiveDOMObject.cpp:
              (WebCore::ActiveDOMObject::canSuspend):
              (WebCore::ActiveDOMObject::suspend):
              (WebCore::ActiveDOMObject::resume):
              * dom/ActiveDOMObject.h:
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects):
              (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
              (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
              * dom/ScriptExecutionContext.h:
              Added methods for suspending and resuming active objects.
      
              * dom/Worker.cpp:
              (WebCore::Worker::canSuspend):
              (WebCore::Worker::stop):
              * dom/Worker.h:
              Workers cannot be suspended yet. This is a change in behavior, as workers used to keep
              running until their owner was destroyed.
      
              * loader/FrameLoader.cpp:
              (WebCore::FrameLoader::stopLoading): No longer call stopActiveDOMObjects() here, because
              their activity is not necessarily loading.
              (WebCore::FrameLoader::canCachePage): Can only cache if all active objects can be suspended.
              Previously, stopLoading() cancelled outstanding XMLHttpRequests, which made the page
              uncacheable due to no-null main document error.
              (WebCore::FrameLoader::commitProvisionalLoad): Suspend or stop active objects, depending on
              whether the document will be cached.
              (WebCore::FrameLoader::frameDetached): Stop active objects to let them clean up before their
              context is destroyed.
      
              * xml/XMLHttpRequest.h: added canSuspend().
              * xml/XMLHttpRequest.cpp:
              (WebCore::XMLHttpRequest::canSuspend): Only XHRs that are not loading can be suspended.
              (WebCore::XMLHttpRequest::stop): Call abort() instead of internalAbort() to dispatch events
              for Firefox compatibility. This is a change in behavior that helps test that requests do
              get aborted.
              (WebCore::XMLHttpRequest::contextDestroyed): The request must have been stopped by now, so
              assert that.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38931 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      773343a3
  30. 02 Dec, 2008 1 commit
    • ap@webkit.org's avatar
      Reviewed by Alexey Proskuryakov. · 0497fcef
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=22588
              Move securityOrigin() from Document and WorkerContext into ScriptExecutionContext.
      
              No observable change in behavior, so no test.
              
              * dom/Document.cpp:
              (WebCore::Document::open):
              (WebCore::Document::domain):
              (WebCore::Document::setDomain):
              (WebCore::Document::initSecurityContext):
              (WebCore::Document::setSecurityOrigin):
              * dom/Document.h:
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ScriptExecutionContext::setSecurityOrigin):
              * dom/ScriptExecutionContext.h:
              (WebCore::ScriptExecutionContext::securityOrigin):
              * dom/WorkerContext.cpp:
              (WebCore::WorkerContext::WorkerContext):
              * dom/WorkerContext.h:
              These changes are for the move of securityOrigin().
              
              * xml/XMLHttpRequest.cpp:
              (WebCore::XMLHttpRequest::createRequest):
              (WebCore::XMLHttpRequest::makeSimpleCrossSiteAccessRequest):
              (WebCore::XMLHttpRequest::makeCrossSiteAccessRequestWithPreflight):
              (WebCore::XMLHttpRequest::handleAsynchronousPreflightResult):
              (WebCore::XMLHttpRequest::setRequestHeader):
              (WebCore::XMLHttpRequest::getAllResponseHeaders):
              (WebCore::XMLHttpRequest::getResponseHeader):
              (WebCore::XMLHttpRequest::processSyncLoadResults):
              (WebCore::XMLHttpRequest::willSendRequest):
              (WebCore::XMLHttpRequest::accessControlCheck):
              (WebCore::XMLHttpRequest::didReceiveResponsePreflight):
              Change XMLHttpRequest to use ScriptExecutionContext instead of Document to access securityOrigin().
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0497fcef
  31. 16 Nov, 2008 1 commit
    • ap@webkit.org's avatar
      Reviewed by Maciej Stachowiak. · e2011e8f
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=22266
              Stop using MessagePort for communication with workers
      
              The current MessagePort specification is not well suited for being implemented in a
              multi-threaded or multi-process environment, and this doesn't appear to be easily fixable.
              This patch implements a simpler Mozilla API for workers instead.
      
              * WebCore.xcodeproj/project.pbxproj:
              * DerivedSources.make:
              * bindings/js/JSDOMWindowBase.cpp: (jsDOMWindowBaseWorker):
              * bindings/js/JSDedicatedWorkerConstructor.cpp: Removed.
              * bindings/js/JSDedicatedWorkerConstructor.h: Removed.
              * bindings/js/JSDedicatedWorkerCustom.cpp: Removed.
              * bindings/js/JSWorkerConstructor.cpp: Copied from WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp.
              * bindings/js/JSWorkerConstructor.h: Copied from WebCore/bindings/js/JSDedicatedWorkerConstructor.h.
              * bindings/js/JSWorkerCustom.cpp: Copied from WebCore/bindings/js/JSDedicatedWorkerCustom.cpp.
              * dom/DedicatedWorker.cpp: Removed.
              * dom/DedicatedWorker.h: Removed.
              * dom/DedicatedWorker.idl: Removed.
              Renamed DedicatedWorker to Worker to match Mozilla and current WHATWG cpec.
      
              * bindings/js/JSEventListener.cpp: (WebCore::JSAbstractEventListener::handleEvent):
              Clear worker exceptions to avoid hitting an assertion.
      
              * dom/EventTarget.cpp: (WebCore::EventTarget::toWorker):
              * dom/EventTarget.h:
              * bindings/js/JSEventTarget.cpp: (WebCore::toJS):
              WorkerContext is now an EventTarget, too.
      
              * bindings/js/JSWorkerContext.cpp: Removed onconnect, constructors for MessageChannel and
              MessagePort. Added postMessage() and onmessage.
      
              * dom/ScriptExecutionContext.cpp: (WebCore::performTask): Do not reference ScriptExecutionContext
              when posting a task - this operation is not thread safe. It is also not necessary any more,
              as the context is kept alive by WorkerMessagingProxy.
      
              * dom/Worker.cpp: Copied from WebCore/dom/DedicatedWorker.cpp.
              (WebCore::Worker::Worker): Start loading the script right away - there is no reason to do
              that on a timer.
              (WebCore::Worker::~Worker): Notify messaging proxy.
              (WebCore::Worker::postMessage): Just ask the proxy to post the message.
              (WebCore::Worker::notifyFinished): Notify messaging proxy when a thread object becomes
              available. Also, it is now safe to unsetPendingActivity(), making the object collectable.
              I'm not sure if this is the right lifetime for workers, as unreachable workers with event
              listeners should probably be kept alive, but it at least lets the object be collected.
              (WebCore::Worker::addEventListener): Added an EventTarget implementation.
              (WebCore::Worker::removeEventListener): Added an EventTarget implementation.
              (WebCore::Worker::dispatchEvent): Added an EventTarget implementation.
      
              * dom/Worker.h: Copied from WebCore/dom/DedicatedWorker.h.
              * dom/Worker.idl: Copied from WebCore/dom/DedicatedWorker.idl.
              Removed onclose, made an EventListener. Actual messaging is now handled by WorkerMessagingProxy.
      
              * dom/WorkerContext.cpp:
              (WebCore::WorkerContext::~WorkerContext): Notify messaging proxy that the context was shut
              down successfully.
              (WebCore::WorkerContext::postMessage): Added. Post the message via messaging proxy.
      
              * dom/WorkerContext.h: Added postMessage and onmessage, removed onconnect.
      
              * dom/WorkerMessagingProxy.cpp: Added.
              * dom/WorkerMessagingProxy.h: Added.
              This new class implements actual messaging. It is notified when a Worker is garbage collected,
              and asks the thread to shut down. It also owns the thread object, and references script
              execution context, making it safe to post messages to it remotely.
      
              * dom/WorkerThread.cpp:
              * dom/WorkerThread.h:
              Keep a reference to messaging proxy, not to Worker itself. Also, the thread object no longer
              keeps itself alive - it is now the job of messaging proxy.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38443 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e2011e8f
  32. 13 Nov, 2008 1 commit
    • ap@webkit.org's avatar
      Reviewed by Darin Adler. · 3568f13c
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=22203
              Implement Worker messaging
      
              No test cases included, because this functionality is disabled by default.
      
              The implementation is known to still have many race condition, but works quite well for
              testing.
      
              * WebCore.xcodeproj/project.pbxproj: Added WorkerTask.{h,cpp}.
      
              * bindings/js/JSDOMBinding.cpp:
              (WebCore::markActiveObjectsForContext): Re-worded comments a little.
              (WebCore::markCrossHeapDependentObjectsForContext): Existing cross-heap GC protocol was
              incorrect, changed it to a much simpler (but still incorrect) version.
      
              * dom/WorkerTask.cpp: Added.
              (WebCore::WorkerTask::~WorkerTask):
              * dom/WorkerTask.h: Added.
              Tasks posted to workers implement this new interface.
      
              * bindings/js/JSDedicatedWorkerCustom.cpp:
              (WebCore::JSDedicatedWorker::mark):
              (WebCore::JSDedicatedWorker::connect):
              * dom/DedicatedWorker.h:
              * dom/DedicatedWorker.idl:
              Auto-generate event listener attributes. Renamed startConversation() to connect(), tracking
              WHATWG discussions.
      
              * dom/DedicatedWorker.cpp:
              (WebCore::WorkerConnectTask::WorkerConnectTask): A task that performs worker-side connect()
              operations.
              (WebCore::DedicatedWorker::DedicatedWorker): Initialize WorkerThread pointer.
              (WebCore::DedicatedWorker::connect): Connect() creates a pair of entangled ports, and posts
              one to worker. Since message port registration in ScriptExecutionContext is not thread safe,
              this port starts with a null context pointer.
              (WebCore::DedicatedWorker::notifyFinished): Since Worker methods should work immediately
              after creation, we have to queue tasks until after a WorkerThread object is created. Then we
              forward all queued tasks to its queue.
      
              * dom/EventTarget.cpp: (WebCore::EventTarget::toWorkerContext):
              * dom/EventTarget.h:
              * bindings/js/JSEventTarget.cpp: (WebCore::toJS):
              Added cases for WorkerContext, which is now an EventTarget, too.
      
              * bindings/js/JSWorkerContext.h: Added JSWorkerContext::put() to make onconnect settable.
              * bindings/js/JSWorkerContext.cpp:
              (WebCore::JSWorkerContext::mark): Mark event listeners.
              (WebCore::JSWorkerContext::createPrototype): Fixed a typo, use the right StructureID.
              (WebCore::JSWorkerContext::put): Implemented.
              (WebCore::jsWorkerContextPrototypeFunctionAddEventListener): Added an EventTarget implementation.
              (WebCore::jsWorkerContextPrototypeFunctionRemoveEventListener): Ditto.
              (WebCore::jsWorkerContextPrototypeFunctionDispatchEvent): Ditto.
              (WebCore::jsWorkerContextOnconnect): Added.
              (WebCore::setJSWorkerContextOnconnect): Added.
      
              * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::evaluate):
              Made it actually work by adding necessary setup.
      
              * bindings/js/WorkerScriptController.h: (WebCore::WorkerScriptController::initScriptIfNeeded):
              Check the right variable - it is the wrapper that may not be initialized yet.
      
              * dom/ActiveDOMObject.cpp:
              (WebCore::ActiveDOMObject::ActiveDOMObject):
              (WebCore::ActiveDOMObject::~ActiveDOMObject):
              Assert being called from the correct thread, as active DOM object tracking is not thread safe.
      
              * dom/ScriptExecutionContext.h: Added a Task interface and a postTask() method, to be used
              for asynchronously executing tasks in context's thread.
      
              * dom/ScriptExecutionContext.cpp:
              (WebCore::ProcessMessagesSoonTask): Changed from a Timer to a Task
              (WebCore::ScriptExecutionContext::ScriptExecutionContext): Removed m_firedMessagePortTimer.
              It was an optimization that couldn't be easily preserved without introducing race conditions
              in multithreading case.
              (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): Use postTask().
              (WebCore::ScriptExecutionContext::dispatchMessagePortEvents): Added a comment explaining
              why it's OK to not ref() ports in a frozen copy.
              (WebCore::ScriptExecutionContext::createdMessagePort): Assert that we're not being called
              from a wrong thread.
              (WebCore::ScriptExecutionContext::destroyedMessagePort): Ditto.
              (WebCore::ScriptExecutionContextTaskTimer): Part of
              ScriptExecutionContext::Task implementation - use Timer if posting from main thread to main
              thread.
              (WebCore::ScriptExecutionContextTaskWorkerTask): Another part - use WorkerTask if posting
              to a worker.
              (WebCore::PerformTaskContext::PerformTaskContext): Finally, use callOnMainThread() if posting
              to main thread from a secondary one.
              (WebCore::performTask): A helper function for callOnMainThread().
              (WebCore::ScriptExecutionContext::postTask): Use one of the above implementations.
      
              * dom/MessagePort.h: Fixed message queue to keep EventData pointers - otherwise, we would
              ref/deref EventData::message from different threads, which is not allowed.
      
              * dom/MessagePort.cpp:
              (WebCore::MessagePortCloseEventTask): Use a task instead of a timer to work across threads.
              (WebCore::MessagePort::EventData::create): Updated for EventData being refcountable now.
              (WebCore::MessagePort::EventData::EventData): Ditto.
              (WebCore::MessagePort::MessagePort): ScriptExecutionContext is now allowed to be null at
              first, because we need to create ports for posting to other threads, and it is not possible
              to register in a context from another thread.
              (WebCore::MessagePort::clone): Always create ports with null contexts - it is now message
              receiver's job to set the context.
              (WebCore::MessagePort::postMessage): Enable posting to ports that are not attached to any
              context yet.
              (WebCore::MessagePort::startConversation): Ditto. Data port is always posted unattached.
              (WebCore::MessagePort::contextDestroyed): Assert that we had a context.
              (WebCore::MessagePort::attachToContext): Called when receiving a data port to register in
              context.
              (WebCore::MessagePort::scriptExecutionContext): Moved from header, as the function is virtual.
              (WebCore::MessagePort::dispatchMessages): Attach data port to receiving context. Use postTask().
              (WebCore::MessagePort::queueCloseEvent): Use postTask().
              (WebCore::MessagePort::hasPendingActivity): Reworded comment a little. As mentioned above,
              MessagePort cross-heap GC is still quite wrong.
      
              * dom/WorkerContext.h: Made WorkerContext an event target, added onconnect attribute.
              * dom/WorkerContext.cpp: Keep a pointer to WorkerThread. It is only used for debug assertions
              now, but there is no harm in tracking it in release builds, too.
      
              * dom/WorkerThread.cpp:
              (WebCore::WorkerThread::create): WorkerThread is refcountable, construct with create().
              (WebCore::WorkerThread::workerThread): Implemented a message loop.
              * dom/WorkerThread.h:
              (WebCore::WorkerThread::threadID): Also only used for assertions.
              (WebCore::WorkerThread::messageQueue): Return a reference to queue, so clients can post to it.
      
              * page/DOMWindow.cpp:
              (WebCore::DOMWindow::postMessage): MessagePort::clone() no longer takes a context, as it
              always sets it to null.
              (WebCore::DOMWindow::postMessageTimerFired): Attach data port to receiving context.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3568f13c
  33. 29 Oct, 2008 1 commit
    • ap@webkit.org's avatar
      Reviewed by Darin Adler. · 3c120a80
      ap@webkit.org authored
              https://bugs.webkit.org/show_bug.cgi?id=21923
              Create an abstraction for script execution context
      
              * GNUmakefile.am:
              * WebCore.pro:
              * WebCore.vcproj/WebCore.vcproj:
              * WebCore.xcodeproj/project.pbxproj:
              * WebCoreSources.bkl:
              Added ScriptExecutionContext.{h,cpp}.
      
              * bindings/js/JSAudioConstructor.cpp:
              (WebCore::JSAudioConstructor::JSAudioConstructor):
              * bindings/js/JSAudioConstructor.h:
              * bindings/js/JSImageConstructor.cpp:
              (WebCore::JSImageConstructor::JSImageConstructor):
              * bindings/js/JSImageConstructor.h:
              * bindings/js/JSOptionConstructor.cpp:
              (WebCore::JSOptionConstructor::JSOptionConstructor):
              * bindings/js/JSOptionConstructor.h:
              * bindings/js/JSXMLHttpRequestConstructor.cpp:
              (WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
              * bindings/js/JSXMLHttpRequestConstructor.h:
              Pass ScriptExecutionContext instead of Document to make getDOMConstructor() happy.
              Since these objects can only work within documents now, it is immediately converted back
              to Document.
      
              * bindings/js/JSMessageChannelConstructor.cpp:
              (WebCore::JSMessageChannelConstructor::JSMessageChannelConstructor):
              (WebCore::JSMessageChannelConstructor::construct):
              * bindings/js/JSMessageChannelConstructor.h:
              (WebCore::JSMessageChannelConstructor::scriptExecutionContext):
              MessageChannel needs to be supported in workers right away, so the constructor operates with
              it directly.
      
              * dom/ActiveDOMObject.cpp:
              (WebCore::ActiveDOMObject::ActiveDOMObject):
              (WebCore::ActiveDOMObject::~ActiveDOMObject):
              (WebCore::ActiveDOMObject::contextDestroyed):
              * dom/ActiveDOMObject.h:
              (WebCore::ActiveDOMObject::scriptExecutionContext):
              * bindings/js/JSDOMBinding.cpp:
              (WebCore::markActiveObjectsForContext):
              (WebCore::markCrossHeapDependentObjectsForContext):
              Use ScriptExecutionContext instead of Document, now that ActiveDOMObject and MessagePort
              tracking is handled by ScriptExecutionContext.
      
              * bindings/js/JSDOMBinding.h: (WebCore::getDOMPrototype): Moved to JSDOMGlobalObject.
      
              * bindings/js/JSDOMGlobalObject.h:
              (WebCore::getDOMConstructor): Moved to this file, as constructors live in JSDOMGlobalObject.
              Also, the two-argument version that used to be in JSDOMWindowBase.cpp need to be accessible
              to worker context implementation.
              (WebCore::scriptExecutionContext): Added a pure virtual method to access
              ScriptExecutionContext, implemented by subclasses.
      
              * bindings/js/JSDOMWindowBase.h:
              * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::scriptExecutionContext):
              Implement by returning the associated document. Note that this method currently gives bogus
              results after navigation - DOMWindow Frame reference is not zeroed out, so we get a document
              that is currently in the frame, not the one associated with this window.
      
              * bindings/js/JSDedicatedWorkerConstructor.cpp: Removed unnecessary include of DOMWindow.h.
      
              * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::mark):
              Call markActiveObjectsForContext() by its new name.
      
              * dom/DedicatedWorker.cpp:
              (WebCore::DedicatedWorker::DedicatedWorker):
              (WebCore::DedicatedWorker::document):
              * dom/DedicatedWorker.h:
              * xml/XMLHttpRequest.cpp:
              (WebCore::XMLHttpRequest::document):
              * xml/XMLHttpRequest.h:
              Added a document() function that upcasts ScriptExecutionContext, as these objects only work
              within documents currently (at least for XMLHttpRequest, this will change soon though).
      
              * dom/Document.cpp:
              (WebCore::Document::Document):
              (WebCore::Document::~Document):
              Moved active object and MessagePort tracking up to ScriptExecutionContext, to share code
              with workers.
              
              * dom/Document.h:
              (WebCore::Document::isDocument):
              (WebCore::Document::refScriptExecutionContext):
              (WebCore::Document::derefScriptExecutionContext):
              Inherit from ScriptExecutionContext.
      
              * dom/MessageChannel.cpp:
              (WebCore::MessageChannel::MessageChannel):
              * dom/MessageChannel.h:
              (WebCore::MessageChannel::create):
              Use ScriptExecutionContext instead of Document.
      
              * dom/MessagePort.cpp:
              (WebCore::CloseMessagePortTimer::CloseMessagePortTimer): Make m_port a RefPtr, because
              MessagePort doesn't ref() itself when posting this event any more (this is a fix for an
              unrelated issue that was causing random crashes in layout tests).
              (WebCore::MessagePort::MessagePort):
              (WebCore::MessagePort::~MessagePort):
              (WebCore::MessagePort::associatedFrame):
              (WebCore::MessagePort::clone):
              (WebCore::MessagePort::postMessage):
              (WebCore::MessagePort::startConversation):
              (WebCore::MessagePort::start):
              (WebCore::MessagePort::contextDestroyed):
              (WebCore::MessagePort::dispatchMessages):
              * dom/MessagePort.h:
              (WebCore::MessagePort::create):
              (WebCore::MessagePort::scriptExecutionContext):
              Use ScriptExecutionContext instead of Document. This is a step toward making MessagePort
              work in worker contexts - we need to also make some its method thread safe for cross-thread
              messaging, and make event dispatching thread safe.
      
              * dom/ScriptExecutionContext.cpp: Added.
              * dom/ScriptExecutionContext.h: Added.
              ActiveDOMObject and MessagePort tracking is moved from Document.
              It is debatable whether ScriptExecutionContext should be a parent of Document or DOMWindow,
              but as I'm just moving Document code, and it is Document that is the main context object
              in our implementation currently.
              Changing ScriptExecutionContext to be a parent of DOMWindow causes a number of bugs that
              seem non-trivial to fix, and isn't really a part of this task.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3c120a80