Changeset 107239 in webkit


Ignore:
Timestamp:
Feb 9, 2012 6:49:21 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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:
Location:
trunk
Files:
4 added
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107231 r107239  
     12012-02-09  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        Test that timers do not fire from subframes of suspended documents.
     4        https://bugs.webkit.org/show_bug.cgi?id=53733
     5
     6        Reviewed by Mihai Parparita.
     7
     8        * fast/events/resources/suspend-subframe-1.html: Added.
     9        * fast/events/resources/suspend-subframe-2.html: Added.
     10        * fast/events/suspend-timers-expected.txt: Added.
     11        * fast/events/suspend-timers.html: Added.
     12        * platform/chromium/test_expectations.txt:
     13
    1142012-02-09  Nikolas Zimmermann  <nzimmermann@rim.com>
    215
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r107231 r107239  
    206206WONTFIX SKIP : fast/events/pageshow-pagehide-on-back-cached.html = TIMEOUT FAIL
    207207WONTFIX SKIP : fast/events/pageshow-pagehide-on-back-cached-with-frames.html = TIMEOUT
     208WONTFIX SKIP : fast/events/suspend-timers.html = TIMEOUT
    208209WONTFIX SKIP : media/restore-from-page-cache.html = TIMEOUT
    209210WONTFIX SKIP : loader/go-back-to-different-window-size.html = TIMEOUT TEXT
  • trunk/Source/WebCore/ChangeLog

    r107238 r107239  
     12012-02-09  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        Ensure timers and other active DOM objects do not fire in suspended documents.
     4        https://bugs.webkit.org/show_bug.cgi?id=53733
     5
     6        ScriptExecutionContext now remembers it has suspended active DOM objects
     7        and suspends all newly installed active DOM objects as well.
     8
     9        All create-calls active DOM objects now calls the post constructor method
     10        suspendIfNeeded that updates the suspend state. It is post constructor
     11        because the suspend/resume functions are virtual and thus can not be called
     12        from constructors.
     13
     14        Reviewed by Mihai Parparita.
     15
     16        Test: fast/events/suspend-timers.html
     17
     18        * Modules/intents/IntentRequest.cpp:
     19        (WebCore::IntentRequest::create):
     20        * bindings/generic/ActiveDOMCallback.cpp:
     21        (WebCore::ActiveDOMCallback::ActiveDOMCallback):
     22        * dom/ActiveDOMObject.cpp:
     23        (WebCore::ActiveDOMObject::ActiveDOMObject):
     24        (WebCore::ActiveDOMObject::~ActiveDOMObject):
     25        (WebCore::ActiveDOMObject::suspendIfNeeded):
     26        * dom/ActiveDOMObject.h:
     27        (WebCore::ActiveDOMObject::suspendIfNeededCalled):
     28        * dom/DocumentEventQueue.cpp:
     29        (WebCore::DocumentEventQueue::DocumentEventQueue):
     30        * dom/ScriptExecutionContext.cpp:
     31        (WebCore::ScriptExecutionContext::ScriptExecutionContext):
     32        (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
     33        (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects):
     34        (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
     35        (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
     36        (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
     37        (WebCore::ScriptExecutionContext::suspendActiveDOMObjectIfNeeded):
     38        * dom/ScriptExecutionContext.h:
     39        (ScriptExecutionContext):
     40        (WebCore::ScriptExecutionContext::activeDOMObjectsAreSuspended):
     41        * fileapi/DOMFileSystem.cpp:
     42        (WebCore::DOMFileSystem::create):
     43        * fileapi/FileReader.cpp:
     44        (WebCore::FileReader::create):
     45        * fileapi/FileReader.h:
     46        * fileapi/FileWriter.cpp:
     47        (WebCore::FileWriter::create):
     48        * fileapi/FileWriter.h:
     49        * history/CachedFrame.cpp:
     50        (WebCore::CachedFrame::CachedFrame):
     51        * html/HTMLAudioElement.cpp:
     52        (WebCore::HTMLAudioElement::create):
     53        (WebCore::HTMLAudioElement::createForJSConstructor):
     54        * html/HTMLMarqueeElement.cpp:
     55        (WebCore::HTMLMarqueeElement::create):
     56        * html/HTMLVideoElement.cpp:
     57        (WebCore::HTMLVideoElement::create):
     58        * mediastream/PeerConnection.cpp:
     59        (WebCore::PeerConnection::create):
     60        * notifications/Notification.cpp:
     61        (WebCore::Notification::create):
     62        * notifications/NotificationCenter.cpp:
     63        (WebCore::NotificationCenter::create):
     64        * notifications/NotificationCenter.h:
     65        * page/DOMTimer.cpp:
     66        (WebCore::DOMTimer::install):
     67        (WebCore::DOMTimer::fired):
     68        * page/EventSource.cpp:
     69        (WebCore::EventSource::create):
     70        * page/SuspendableTimer.cpp:
     71        (WebCore::SuspendableTimer::SuspendableTimer):
     72        * storage/IDBDatabase.cpp:
     73        (WebCore::IDBDatabase::create):
     74        * storage/IDBRequest.cpp:
     75        (WebCore::IDBRequest::create):
     76        * storage/IDBTransaction.cpp:
     77        (WebCore::IDBTransaction::create):
     78        * storage/IDBVersionChangeRequest.cpp:
     79        (WebCore::IDBVersionChangeRequest::create):
     80        * webaudio/AudioContext.cpp:
     81        (WebCore::AudioContext::create):
     82        (WebCore::AudioContext::createOfflineContext):
     83        * websockets/WebSocket.cpp:
     84        (WebCore::WebSocket::create):
     85        * websockets/WebSocket.h:
     86        * workers/SharedWorker.cpp:
     87        (WebCore::SharedWorker::create):
     88        * workers/Worker.cpp:
     89        (WebCore::Worker::create):
     90        * xml/XMLHttpRequest.cpp:
     91        (WebCore::XMLHttpRequest::create):
     92
    1932012-02-09  Vsevolod Vlasov  <vsevik@chromium.org>
    294
  • trunk/Source/WebCore/Modules/intents/IntentRequest.cpp

    r106823 r107239  
    4242                                                PassRefPtr<IntentResultCallback> errorCallback)
    4343{
    44     return adoptRef(new IntentRequest(context, intent, successCallback, errorCallback));
     44    RefPtr<IntentRequest> intentRequest(adoptRef(new IntentRequest(context, intent, successCallback, errorCallback)));
     45    intentRequest->suspendIfNeeded();
     46    return intentRequest.release();
    4547}
    4648
  • trunk/Source/WebCore/bindings/generic/ActiveDOMCallback.cpp

    r106823 r107239  
    123123    : m_impl(adoptPtr(new ActiveDOMObjectCallbackImpl(context)))
    124124{
     125    m_impl->suspendIfNeeded();
    125126}
    126127
  • trunk/Source/WebCore/dom/ActiveDOMObject.cpp

    r106823 r107239  
    6161    : ContextDestructionObserver(scriptExecutionContext)
    6262    , m_pendingActivityCount(0)
     63#if !ASSERT_DISABLED
     64    , m_suspendIfNeededCalled(false)
     65#endif
    6366{
    6467    if (!m_scriptExecutionContext)
     
    7477        return;
    7578
     79    ASSERT(m_suspendIfNeededCalled);
    7680    ASSERT(m_scriptExecutionContext->isContextThread());
    7781    m_scriptExecutionContext->willDestroyActiveDOMObject(this);
     82}
     83
     84void ActiveDOMObject::suspendIfNeeded()
     85{
     86#if !ASSERT_DISABLED
     87    ASSERT(!m_suspendIfNeededCalled);
     88    m_suspendIfNeededCalled = true;
     89#endif
     90    if (!m_scriptExecutionContext)
     91        return;
     92
     93    m_scriptExecutionContext->suspendActiveDOMObjectIfNeeded(this);
    7894}
    7995
  • trunk/Source/WebCore/dom/ActiveDOMObject.h

    r106823 r107239  
    5252        ActiveDOMObject(ScriptExecutionContext*, void* upcastPointer);
    5353
     54        // suspendIfNeeded() should be called exactly once after object construction to synchronize
     55        // the suspend state with that in ScriptExecutionContext.
     56        void suspendIfNeeded();
     57#if !ASSERT_DISABLED
     58        bool suspendIfNeededCalled() const { return m_suspendIfNeededCalled; }
     59#endif
     60
    5461        virtual bool hasPendingActivity() const;
    5562
     
    8996    private:
    9097        unsigned m_pendingActivityCount;
     98#if !ASSERT_DISABLED
     99        bool m_suspendIfNeededCalled;
     100#endif
    91101    };
    92102
  • trunk/Source/WebCore/dom/DocumentEventQueue.cpp

    r106823 r107239  
    6565    , m_isClosed(false)
    6666{
     67    m_pendingEventTimer->suspendIfNeeded();
    6768}
    6869
  • trunk/Source/WebCore/dom/ScriptExecutionContext.cpp

    r107082 r107239  
    9494    , m_inDestructor(false)
    9595    , m_inDispatchErrorEvent(false)
     96    , m_activeDOMObjectsAreSuspended(false)
    9697#if ENABLE(SQL_DATABASE)
    9798    , m_hasOpenDatabases(false)
     
    103104{
    104105    m_inDestructor = true;
    105 
    106106    for (HashSet<ContextDestructionObserver*>::iterator iter = m_destructionObservers.begin(); iter != m_destructionObservers.end(); iter = m_destructionObservers.begin()) {
    107107        ContextDestructionObserver* observer = *iter;
     
    212212    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    213213        ASSERT(iter->first->scriptExecutionContext() == this);
     214        ASSERT(iter->first->suspendIfNeededCalled());
    214215        if (!iter->first->canSuspend()) {
    215216            m_iteratingActiveDOMObjects = false;
    216217            return false;
    217218        }
    218     }   
     219    }
    219220    m_iteratingActiveDOMObjects = false;
    220221    return true;
     
    228229    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    229230        ASSERT(iter->first->scriptExecutionContext() == this);
     231        ASSERT(iter->first->suspendIfNeededCalled());
    230232        iter->first->suspend(why);
    231233    }
    232234    m_iteratingActiveDOMObjects = false;
     235    m_activeDOMObjectsAreSuspended = true;
     236    m_reasonForSuspendingActiveDOMObjects = why;
    233237}
    234238
    235239void ScriptExecutionContext::resumeActiveDOMObjects()
    236240{
     241    m_activeDOMObjectsAreSuspended = false;
    237242    // No protection against m_activeDOMObjects changing during iteration: resume() shouldn't execute arbitrary JS.
    238243    m_iteratingActiveDOMObjects = true;
     
    240245    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    241246        ASSERT(iter->first->scriptExecutionContext() == this);
     247        ASSERT(iter->first->suspendIfNeededCalled());
    242248        iter->first->resume();
    243249    }
     
    252258    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    253259        ASSERT(iter->first->scriptExecutionContext() == this);
     260        ASSERT(iter->first->suspendIfNeededCalled());
    254261        iter->first->stop();
    255262    }
     
    258265    // Also close MessagePorts. If they were ActiveDOMObjects (they could be) then they could be stopped instead.
    259266    closeMessagePorts();
     267}
     268
     269void ScriptExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object)
     270{
     271    ASSERT(m_activeDOMObjects.contains(object));
     272    // Ensure all ActiveDOMObjects are suspended also newly created ones.
     273    if (m_activeDOMObjectsAreSuspended)
     274        object->suspend(m_reasonForSuspendingActiveDOMObjects);
    260275}
    261276
  • trunk/Source/WebCore/dom/ScriptExecutionContext.h

    r107082 r107239  
    9999    void addConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>);
    100100
     101#if ENABLE(BLOB)
     102    PublicURLManager& publicURLManager();
     103#endif
    101104    // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
    102105    bool canSuspendActiveDOMObjects();
     
    107110    virtual void stopActiveDOMObjects();
    108111
    109 #if ENABLE(BLOB)
    110     PublicURLManager& publicURLManager();
    111 #endif
     112    bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSuspended; }
     113
     114    // Called from the constructor and destructors of ActiveDOMObject.
    112115    void didCreateActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
    113116    void willDestroyActiveDOMObject(ActiveDOMObject*);
     117
     118    // Called after the construction of an ActiveDOMObject to synchronize suspend state.
     119    void suspendActiveDOMObjectIfNeeded(ActiveDOMObject*);
    114120
    115121    typedef const HashMap<ActiveDOMObject*, void*> ActiveDOMObjectsMap;
     
    216222#endif
    217223
     224    bool m_activeDOMObjectsAreSuspended;
     225    ActiveDOMObject::ReasonForSuspension m_reasonForSuspendingActiveDOMObjects;
     226
    218227#if ENABLE(SQL_DATABASE)
    219228    RefPtr<DatabaseThread> m_databaseThread;
  • trunk/Source/WebCore/fileapi/DOMFileSystem.cpp

    r106823 r107239  
    5757{
    5858    RefPtr<DOMFileSystem> fileSystem(adoptRef(new DOMFileSystem(context, name, asyncFileSystem)));
     59    fileSystem->suspendIfNeeded();
    5960    InspectorInstrumentation::didOpenFileSystem(fileSystem.get());
    60     return fileSystem;
     61    return fileSystem.release();
    6162}
    6263
  • trunk/Source/WebCore/fileapi/FileReader.cpp

    r106823 r107239  
    4949static const double progressNotificationIntervalMS = 50;
    5050
     51PassRefPtr<FileReader> FileReader::create(ScriptExecutionContext* context)
     52{
     53    RefPtr<FileReader> fileReader(adoptRef(new FileReader(context)));
     54    fileReader->suspendIfNeeded();
     55    return fileReader.release();
     56}
     57
    5158FileReader::FileReader(ScriptExecutionContext* context)
    5259    : ActiveDOMObject(context, this)
  • trunk/Source/WebCore/fileapi/FileReader.h

    r106823 r107239  
    5252class FileReader : public RefCounted<FileReader>, public ActiveDOMObject, public EventTarget, public FileReaderLoaderClient {
    5353public:
    54     static PassRefPtr<FileReader> create(ScriptExecutionContext* context)
    55     {
    56         return adoptRef(new FileReader(context));
    57     }
     54    static PassRefPtr<FileReader> create(ScriptExecutionContext*);
    5855
    5956    virtual ~FileReader();
  • trunk/Source/WebCore/fileapi/FileWriter.cpp

    r106823 r107239  
    4646static const int kMaxRecursionDepth = 3;
    4747
     48PassRefPtr<FileWriter> FileWriter::create(ScriptExecutionContext* context)
     49{
     50    RefPtr<FileWriter> fileWriter(adoptRef(new FileWriter(context)));
     51    fileWriter->suspendIfNeeded();
     52    return fileWriter.release();
     53}
     54
    4855FileWriter::FileWriter(ScriptExecutionContext* context)
    4956    : ActiveDOMObject(context, this)
  • trunk/Source/WebCore/fileapi/FileWriter.h

    r106823 r107239  
    4949class FileWriter : public FileWriterBase, public ActiveDOMObject, public EventTarget, public AsyncFileWriterClient {
    5050public:
    51     static PassRefPtr<FileWriter> create(ScriptExecutionContext* context)
    52     {
    53         return adoptRef(new FileWriter(context));
    54     }
     51    static PassRefPtr<FileWriter> create(ScriptExecutionContext*);
    5552
    5653    enum ReadyState {
  • trunk/Source/WebCore/history/CachedFrame.cpp

    r106823 r107239  
    169169    // Suspending must also happen after we've recursed over child frames, in case
    170170    // those create more objects.
    171     // FIXME: It's still possible to have objects created after suspending in some cases, see http://webkit.org/b/53733 for more details.
    172171    m_document->documentWillSuspendForPageCache();
    173172    m_document->suspendScriptedAnimationControllerCallbacks();
  • trunk/Source/WebCore/html/HTMLAudioElement.cpp

    r106823 r107239  
    4444PassRefPtr<HTMLAudioElement> HTMLAudioElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
    4545{
    46     return adoptRef(new HTMLAudioElement(tagName, document, createdByParser));
     46    RefPtr<HTMLAudioElement> audioElement(adoptRef(new HTMLAudioElement(tagName, document, createdByParser)));
     47    audioElement->suspendIfNeeded();
     48    return audioElement.release();
    4749}
    4850
     
    5557        audio->scheduleLoad(HTMLMediaElement::MediaResource);
    5658    }
     59    audio->suspendIfNeeded();
    5760    return audio.release();
    5861}
  • trunk/Source/WebCore/html/HTMLMarqueeElement.cpp

    r106823 r107239  
    4949PassRefPtr<HTMLMarqueeElement> HTMLMarqueeElement::create(const QualifiedName& tagName, Document* document)
    5050{
    51     return adoptRef(new HTMLMarqueeElement(tagName, document));
     51    RefPtr<HTMLMarqueeElement> marqueeElement(adoptRef(new HTMLMarqueeElement(tagName, document)));
     52    marqueeElement->suspendIfNeeded();
     53    return marqueeElement.release();
    5254}
    5355
  • trunk/Source/WebCore/html/HTMLVideoElement.cpp

    r106823 r107239  
    5555PassRefPtr<HTMLVideoElement> HTMLVideoElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
    5656{
    57     return adoptRef(new HTMLVideoElement(tagName, document, createdByParser));
     57    RefPtr<HTMLVideoElement> videoElement(adoptRef(new HTMLVideoElement(tagName, document, createdByParser)));
     58    videoElement->suspendIfNeeded();
     59    return videoElement.release();
    5860}
    5961
  • trunk/Source/WebCore/mediastream/PeerConnection.cpp

    r107054 r107239  
    4242    connection->setPendingActivity(connection.get());
    4343    connection->scheduleInitialNegotiation();
     44    connection->suspendIfNeeded();
    4445
    4546    return connection.release();
  • trunk/Source/WebCore/notifications/Notification.cpp

    r106823 r107239  
    103103PassRefPtr<Notification> Notification::create(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
    104104{
    105     return adoptRef(new Notification(url, context, ec, provider));
     105    RefPtr<Notification> notification(adoptRef(new Notification(url, context, ec, provider)));
     106    notification->suspendIfNeeded();
     107    return notification.release();
    106108}
    107109
    108110PassRefPtr<Notification> Notification::create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
    109111{
    110     return adoptRef(new Notification(contents, context, ec, provider));
     112    RefPtr<Notification> notification(adoptRef(new Notification(contents, context, ec, provider)));
     113    notification->suspendIfNeeded();
     114    return notification.release();
    111115}
    112116
  • trunk/Source/WebCore/notifications/NotificationCenter.cpp

    r106823 r107239  
    4242namespace WebCore {
    4343
     44PassRefPtr<NotificationCenter> NotificationCenter::create(ScriptExecutionContext* context, NotificationPresenter* presenter)
     45{
     46    RefPtr<NotificationCenter> notificationCenter(adoptRef(new NotificationCenter(context, presenter)));
     47    notificationCenter->suspendIfNeeded();
     48    return notificationCenter.release();
     49}
     50
    4451NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter)
    4552    : ActiveDOMObject(context, this)
  • trunk/Source/WebCore/notifications/NotificationCenter.h

    r106823 r107239  
    5151class NotificationCenter : public RefCounted<NotificationCenter>, public ActiveDOMObject {
    5252public:
    53     static PassRefPtr<NotificationCenter> create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); }
     53    static PassRefPtr<NotificationCenter> create(ScriptExecutionContext*, NotificationPresenter*);
    5454
    5555    PassRefPtr<Notification> createHTMLNotification(const String& URI, ExceptionCode& ec)
  • trunk/Source/WebCore/page/DOMTimer.cpp

    r106846 r107239  
    9393    DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
    9494
     95    timer->suspendIfNeeded();
    9596    InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot);
    9697
     
    115116    ScriptExecutionContext* context = scriptExecutionContext();
    116117    timerNestingLevel = m_nestingLevel;
    117    
     118    ASSERT(!context->activeDOMObjectsAreSuspended());
    118119    UserGestureIndicator gestureIndicator(m_shouldForwardUserGesture ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture);
    119120   
  • trunk/Source/WebCore/page/EventSource.cpp

    r106823 r107239  
    9999    source->setPendingActivity(source.get());
    100100    source->connect();
     101    source->suspendIfNeeded();
    101102
    102103    return source.release();
  • trunk/Source/WebCore/page/SuspendableTimer.cpp

    r106823 r107239  
    3636    , m_nextFireInterval(0)
    3737    , m_repeatInterval(0)
     38    , m_active(false)
    3839#if !ASSERT_DISABLED
    39     , m_active(false)
    4040    , m_suspended(false)
    4141#endif
  • trunk/Source/WebCore/storage/IDBDatabase.cpp

    r106823 r107239  
    5151PassRefPtr<IDBDatabase> IDBDatabase::create(ScriptExecutionContext* context, PassRefPtr<IDBDatabaseBackendInterface> database)
    5252{
    53     return adoptRef(new IDBDatabase(context, database));
     53    RefPtr<IDBDatabase> idbDatabase(adoptRef(new IDBDatabase(context, database)));
     54    idbDatabase->suspendIfNeeded();
     55    return idbDatabase.release();
    5456}
    5557
  • trunk/Source/WebCore/storage/IDBRequest.cpp

    r106823 r107239  
    4646PassRefPtr<IDBRequest> IDBRequest::create(ScriptExecutionContext* context, PassRefPtr<IDBAny> source, IDBTransaction* transaction)
    4747{
    48     return adoptRef(new IDBRequest(context, source, transaction));
     48    RefPtr<IDBRequest> request(adoptRef(new IDBRequest(context, source, transaction)));
     49    request->suspendIfNeeded();
     50    return request.release();
    4951}
    5052
  • trunk/Source/WebCore/storage/IDBTransaction.cpp

    r106823 r107239  
    4343PassRefPtr<IDBTransaction> IDBTransaction::create(ScriptExecutionContext* context, PassRefPtr<IDBTransactionBackendInterface> backend, IDBDatabase* db)
    4444{
    45     return adoptRef(new IDBTransaction(context, backend, db));
     45    RefPtr<IDBTransaction> transaction(adoptRef(new IDBTransaction(context, backend, db)));
     46    transaction->suspendIfNeeded();
     47    return transaction.release();
    4648}
    4749
  • trunk/Source/WebCore/storage/IDBVersionChangeRequest.cpp

    r106823 r107239  
    3636PassRefPtr<IDBVersionChangeRequest> IDBVersionChangeRequest::create(ScriptExecutionContext* context, PassRefPtr<IDBAny> source, const String& version)
    3737{
    38     return adoptRef(new IDBVersionChangeRequest(context, source, version));
     38    RefPtr<IDBVersionChangeRequest> request(adoptRef(new IDBVersionChangeRequest(context, source, version)));
     39    request->suspendIfNeeded();
     40    return request.release();
     41
    3942}
    4043
  • trunk/Source/WebCore/webaudio/AudioContext.cpp

    r106823 r107239  
    103103    if (s_hardwareContextCount >= MaxHardwareContexts)
    104104        return 0;
    105        
    106     return adoptRef(new AudioContext(document));
     105
     106    RefPtr<AudioContext> audioContext(adoptRef(new AudioContext(document)));
     107    audioContext->suspendIfNeeded();
     108    return audioContext.release();
    107109}
    108110
     
    119121    }
    120122
    121     return adoptRef(new AudioContext(document, numberOfChannels, numberOfFrames, sampleRate));
     123    RefPtr<AudioContext> audioContext(new AudioContext(document, numberOfChannels, numberOfFrames, sampleRate));
     124    audioContext->suspendIfNeeded();
     125    return audioContext.release();
    122126}
    123127
  • trunk/Source/WebCore/websockets/WebSocket.cpp

    r106823 r107239  
    163163    if (m_channel)
    164164        m_channel->disconnect();
     165}
     166
     167PassRefPtr<WebSocket> WebSocket::create(ScriptExecutionContext* context)
     168{
     169    RefPtr<WebSocket> webSocket(adoptRef(new WebSocket(context)));
     170    webSocket->suspendIfNeeded();
     171    return webSocket.release();
    165172}
    166173
  • trunk/Source/WebCore/websockets/WebSocket.h

    r106823 r107239  
    5454    static void setIsAvailable(bool);
    5555    static bool isAvailable();
    56     static PassRefPtr<WebSocket> create(ScriptExecutionContext* context) { return adoptRef(new WebSocket(context)); }
     56    static PassRefPtr<WebSocket> create(ScriptExecutionContext*);
    5757    virtual ~WebSocket();
    5858
  • trunk/Source/WebCore/workers/SharedWorker.cpp

    r106823 r107239  
    5959    ASSERT(remotePort);
    6060
     61    worker->suspendIfNeeded();
     62
    6163    KURL scriptURL = worker->resolveURL(url, ec);
    6264    if (scriptURL.isEmpty())
  • trunk/Source/WebCore/workers/Worker.cpp

    r106823 r107239  
    6060{
    6161    RefPtr<Worker> worker = adoptRef(new Worker(context));
     62
     63    worker->suspendIfNeeded();
    6264
    6365    KURL scriptURL = worker->resolveURL(url, ec);
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r106823 r107239  
    155155PassRefPtr<XMLHttpRequest> XMLHttpRequest::create(ScriptExecutionContext* context, PassRefPtr<SecurityOrigin> securityOrigin)
    156156{
    157     return adoptRef(new XMLHttpRequest(context, securityOrigin));
     157    RefPtr<XMLHttpRequest> xmlHttpRequest(adoptRef(new XMLHttpRequest(context, securityOrigin)));
     158    xmlHttpRequest->suspendIfNeeded();
     159
     160    return xmlHttpRequest.release();
    158161}
    159162
Note: See TracChangeset for help on using the changeset viewer.