Source/WebCore: Ensure timers and other active DOM objects do not fire in suspended...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 14:49:21 +0000 (14:49 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 14:49:21 +0000 (14:49 +0000)
commit3e20ce6d937a605d0403a680ed7ca545be458bfc
tree7d6d015f6440013cb75b2ba7d98276685cd21e4b
parent17f437f0ccb0c60cf6efb909f05cd2e3bef9b53c
Source/WebCore: Ensure timers and other active DOM objects do not fire in suspended documents.
https://bugs.webkit.org/show_bug.cgi?id=53733

ScriptExecutionContext now remembers it has suspended active DOM objects
and suspends all newly installed active DOM objects as well.

All create-calls active DOM objects now calls the post constructor method
suspendIfNeeded that updates the suspend state. It is post constructor
because the suspend/resume functions are virtual and thus can not be called
from constructors.

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-02-09
Reviewed by Mihai Parparita.

Test: fast/events/suspend-timers.html

* Modules/intents/IntentRequest.cpp:
(WebCore::IntentRequest::create):
* bindings/generic/ActiveDOMCallback.cpp:
(WebCore::ActiveDOMCallback::ActiveDOMCallback):
* dom/ActiveDOMObject.cpp:
(WebCore::ActiveDOMObject::ActiveDOMObject):
(WebCore::ActiveDOMObject::~ActiveDOMObject):
(WebCore::ActiveDOMObject::suspendIfNeeded):
* dom/ActiveDOMObject.h:
(WebCore::ActiveDOMObject::suspendIfNeededCalled):
* dom/DocumentEventQueue.cpp:
(WebCore::DocumentEventQueue::DocumentEventQueue):
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::ScriptExecutionContext):
(WebCore::ScriptExecutionContext::~ScriptExecutionContext):
(WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects):
(WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
(WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
(WebCore::ScriptExecutionContext::stopActiveDOMObjects):
(WebCore::ScriptExecutionContext::suspendActiveDOMObjectIfNeeded):
* dom/ScriptExecutionContext.h:
(ScriptExecutionContext):
(WebCore::ScriptExecutionContext::activeDOMObjectsAreSuspended):
* fileapi/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::create):
* fileapi/FileReader.cpp:
(WebCore::FileReader::create):
* fileapi/FileReader.h:
* fileapi/FileWriter.cpp:
(WebCore::FileWriter::create):
* fileapi/FileWriter.h:
* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):
* html/HTMLAudioElement.cpp:
(WebCore::HTMLAudioElement::create):
(WebCore::HTMLAudioElement::createForJSConstructor):
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::create):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::create):
* mediastream/PeerConnection.cpp:
(WebCore::PeerConnection::create):
* notifications/Notification.cpp:
(WebCore::Notification::create):
* notifications/NotificationCenter.cpp:
(WebCore::NotificationCenter::create):
* notifications/NotificationCenter.h:
* page/DOMTimer.cpp:
(WebCore::DOMTimer::install):
(WebCore::DOMTimer::fired):
* page/EventSource.cpp:
(WebCore::EventSource::create):
* page/SuspendableTimer.cpp:
(WebCore::SuspendableTimer::SuspendableTimer):
* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::create):
* storage/IDBRequest.cpp:
(WebCore::IDBRequest::create):
* storage/IDBTransaction.cpp:
(WebCore::IDBTransaction::create):
* storage/IDBVersionChangeRequest.cpp:
(WebCore::IDBVersionChangeRequest::create):
* webaudio/AudioContext.cpp:
(WebCore::AudioContext::create):
(WebCore::AudioContext::createOfflineContext):
* websockets/WebSocket.cpp:
(WebCore::WebSocket::create):
* websockets/WebSocket.h:
* workers/SharedWorker.cpp:
(WebCore::SharedWorker::create):
* workers/Worker.cpp:
(WebCore::Worker::create):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::create):

LayoutTests: Test that timers do not fire from subframes of suspended documents.
https://bugs.webkit.org/show_bug.cgi?id=53733

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-02-09
Reviewed by Mihai Parparita.

* fast/events/resources/suspend-subframe-1.html: Added.
* fast/events/resources/suspend-subframe-2.html: Added.
* fast/events/suspend-timers-expected.txt: Added.
* fast/events/suspend-timers.html: Added.
* platform/chromium/test_expectations.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
40 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/resources/suspend-subframe-1.html [new file with mode: 0644]
LayoutTests/fast/events/resources/suspend-subframe-2.html [new file with mode: 0644]
LayoutTests/fast/events/suspend-timers-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/suspend-timers.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/intents/IntentRequest.cpp
Source/WebCore/bindings/generic/ActiveDOMCallback.cpp
Source/WebCore/dom/ActiveDOMObject.cpp
Source/WebCore/dom/ActiveDOMObject.h
Source/WebCore/dom/DocumentEventQueue.cpp
Source/WebCore/dom/ScriptExecutionContext.cpp
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/fileapi/DOMFileSystem.cpp
Source/WebCore/fileapi/FileReader.cpp
Source/WebCore/fileapi/FileReader.h
Source/WebCore/fileapi/FileWriter.cpp
Source/WebCore/fileapi/FileWriter.h
Source/WebCore/history/CachedFrame.cpp
Source/WebCore/html/HTMLAudioElement.cpp
Source/WebCore/html/HTMLMarqueeElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/mediastream/PeerConnection.cpp
Source/WebCore/notifications/Notification.cpp
Source/WebCore/notifications/NotificationCenter.cpp
Source/WebCore/notifications/NotificationCenter.h
Source/WebCore/page/DOMTimer.cpp
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/SuspendableTimer.cpp
Source/WebCore/storage/IDBDatabase.cpp
Source/WebCore/storage/IDBRequest.cpp
Source/WebCore/storage/IDBTransaction.cpp
Source/WebCore/storage/IDBVersionChangeRequest.cpp
Source/WebCore/webaudio/AudioContext.cpp
Source/WebCore/websockets/WebSocket.cpp
Source/WebCore/websockets/WebSocket.h
Source/WebCore/workers/SharedWorker.cpp
Source/WebCore/workers/Worker.cpp
Source/WebCore/xml/XMLHttpRequest.cpp