Changeset 106654 in webkit


Ignore:
Timestamp:
Feb 3, 2012 5:42:20 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-03
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:

(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):

  • 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):

  • webaudio/AudioContext.cpp:

(WebCore::AudioContext::create):

  • 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-03
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
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r106652 r106654  
     12012-02-03  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-03  Zoltan Arvai  <zarvai@inf.u-szeged.hu>
    215
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r106641 r106654  
    204204WONTFIX SKIP : fast/events/pageshow-pagehide-on-back-cached.html = TIMEOUT FAIL
    205205WONTFIX SKIP : fast/events/pageshow-pagehide-on-back-cached-with-frames.html = TIMEOUT
     206WONTFIX SKIP : fast/events/suspend-timers.html = TIMEOUT
    206207WONTFIX SKIP : media/restore-from-page-cache.html = TIMEOUT
    207208WONTFIX SKIP : loader/go-back-to-different-window-size.html = TIMEOUT TEXT
  • trunk/Source/WebCore/ChangeLog

    r106649 r106654  
     12012-02-03  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        (WebCore::ScriptExecutionContext::activeDOMObjectsAreSuspended):
     40        * fileapi/DOMFileSystem.cpp:
     41        (WebCore::DOMFileSystem::create):
     42        * fileapi/FileReader.cpp:
     43        (WebCore::FileReader::create):
     44        * fileapi/FileReader.h:
     45        * fileapi/FileWriter.cpp:
     46        (WebCore::FileWriter::create):
     47        * fileapi/FileWriter.h:
     48        * history/CachedFrame.cpp:
     49        (WebCore::CachedFrame::CachedFrame):
     50        * html/HTMLAudioElement.cpp:
     51        (WebCore::HTMLAudioElement::create):
     52        * html/HTMLMarqueeElement.cpp:
     53        (WebCore::HTMLMarqueeElement::create):
     54        * html/HTMLVideoElement.cpp:
     55        (WebCore::HTMLVideoElement::create):
     56        * mediastream/PeerConnection.cpp:
     57        (WebCore::PeerConnection::create):
     58        * notifications/Notification.cpp:
     59        (WebCore::Notification::create):
     60        * notifications/NotificationCenter.cpp:
     61        (WebCore::NotificationCenter::create):
     62        * notifications/NotificationCenter.h:
     63        * page/DOMTimer.cpp:
     64        (WebCore::DOMTimer::install):
     65        (WebCore::DOMTimer::fired):
     66        * page/EventSource.cpp:
     67        (WebCore::EventSource::create):
     68        * page/SuspendableTimer.cpp:
     69        (WebCore::SuspendableTimer::SuspendableTimer):
     70        * storage/IDBDatabase.cpp:
     71        (WebCore::IDBDatabase::create):
     72        * storage/IDBRequest.cpp:
     73        (WebCore::IDBRequest::create):
     74        * storage/IDBTransaction.cpp:
     75        (WebCore::IDBTransaction::create):
     76        * webaudio/AudioContext.cpp:
     77        (WebCore::AudioContext::create):
     78        * websockets/WebSocket.cpp:
     79        (WebCore::WebSocket::create):
     80        * websockets/WebSocket.h:
     81        * workers/SharedWorker.cpp:
     82        (WebCore::SharedWorker::create):
     83        * workers/Worker.cpp:
     84        (WebCore::Worker::create):
     85        * xml/XMLHttpRequest.cpp:
     86        (WebCore::XMLHttpRequest::create):
     87
    1882012-02-03  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
    289
  • trunk/Source/WebCore/Modules/intents/IntentRequest.cpp

    r104991 r106654  
    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

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

    r105804 r106654  
    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

    r98787 r106654  
    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

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

    r105310 r106654  
    9393    , m_inDestructor(false)
    9494    , m_inDispatchErrorEvent(false)
     95    , m_activeDOMObjectsAreSuspended(false)
    9596#if ENABLE(SQL_DATABASE)
    9697    , m_hasOpenDatabases(false)
     
    102103{
    103104    m_inDestructor = true;
    104 
    105105    for (HashSet<ContextDestructionObserver*>::iterator iter = m_destructionObservers.begin(); iter != m_destructionObservers.end(); iter = m_destructionObservers.begin()) {
    106106        ContextDestructionObserver* observer = *iter;
     
    207207    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    208208        ASSERT(iter->first->scriptExecutionContext() == this);
     209        ASSERT(iter->first->suspendIfNeededCalled());
    209210        if (!iter->first->canSuspend()) {
    210211            m_iteratingActiveDOMObjects = false;
    211212            return false;
    212213        }
    213     }   
     214    }
    214215    m_iteratingActiveDOMObjects = false;
    215216    return true;
     
    223224    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    224225        ASSERT(iter->first->scriptExecutionContext() == this);
     226        ASSERT(iter->first->suspendIfNeededCalled());
    225227        iter->first->suspend(why);
    226228    }
    227229    m_iteratingActiveDOMObjects = false;
     230    m_activeDOMObjectsAreSuspended = true;
     231    m_reasonForSuspendingActiveDOMObjects = why;
    228232}
    229233
    230234void ScriptExecutionContext::resumeActiveDOMObjects()
    231235{
     236    m_activeDOMObjectsAreSuspended = false;
    232237    // No protection against m_activeDOMObjects changing during iteration: resume() shouldn't execute arbitrary JS.
    233238    m_iteratingActiveDOMObjects = true;
     
    235240    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    236241        ASSERT(iter->first->scriptExecutionContext() == this);
     242        ASSERT(iter->first->suspendIfNeededCalled());
    237243        iter->first->resume();
    238244    }
     
    247253    for (HashMap<ActiveDOMObject*, void*>::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
    248254        ASSERT(iter->first->scriptExecutionContext() == this);
     255        ASSERT(iter->first->suspendIfNeededCalled());
    249256        iter->first->stop();
    250257    }
     
    253260    // Also close MessagePorts. If they were ActiveDOMObjects (they could be) then they could be stopped instead.
    254261    closeMessagePorts();
     262}
     263
     264void ScriptExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object)
     265{
     266    ASSERT(m_activeDOMObjects.contains(object));
     267    // Ensure all ActiveDOMObjects are suspended also newly created ones.
     268    if (m_activeDOMObjectsAreSuspended)
     269        object->suspend(m_reasonForSuspendingActiveDOMObjects);
    255270}
    256271
  • trunk/Source/WebCore/dom/ScriptExecutionContext.h

    r105568 r106654  
    104104    virtual void stopActiveDOMObjects();
    105105
     106    bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSuspended; }
     107
     108    // Called from the constructor and destructors of ActiveDOMObject.
    106109    void didCreateActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
    107110    void willDestroyActiveDOMObject(ActiveDOMObject*);
     111
     112    // Called after the construction of an ActiveDOMObject to synchronize suspend state.
     113    void suspendActiveDOMObjectIfNeeded(ActiveDOMObject*);
    108114
    109115    typedef const HashMap<ActiveDOMObject*, void*> ActiveDOMObjectsMap;
     
    207213    OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions;
    208214
     215    bool m_activeDOMObjectsAreSuspended;
     216    ActiveDOMObject::ReasonForSuspension m_reasonForSuspendingActiveDOMObjects;
     217
    209218#if ENABLE(SQL_DATABASE)
    210219    RefPtr<DatabaseThread> m_databaseThread;
  • trunk/Source/WebCore/fileapi/DOMFileSystem.cpp

    r101236 r106654  
    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

    r101295 r106654  
    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

    r100227 r106654  
    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

    r105531 r106654  
    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

    r98802 r106654  
    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

    r103130 r106654  
    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

    r102968 r106654  
    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
  • trunk/Source/WebCore/html/HTMLMarqueeElement.cpp

    r73197 r106654  
    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

    r103679 r106654  
    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

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

    r101750 r106654  
    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

    r106592 r106654  
    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

    r101307 r106654  
    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

    r106636 r106654  
    9797    DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
    9898
     99    timer->suspendIfNeeded();
    99100    InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot);
    100101
     
    119120    ScriptExecutionContext* context = scriptExecutionContext();
    120121    timerNestingLevel = m_nestingLevel;
    121    
     122    ASSERT(!context->activeDOMObjectsAreSuspended());
    122123    UserGestureIndicator gestureIndicator(m_shouldForwardUserGesture ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture);
    123124   
  • trunk/Source/WebCore/page/EventSource.cpp

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

    r77355 r106654  
    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

    r104933 r106654  
    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

    r105137 r106654  
    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

    r103283 r106654  
    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/webaudio/AudioContext.cpp

    r105375 r106654  
    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
  • trunk/Source/WebCore/websockets/WebSocket.cpp

    r104803 r106654  
    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

    r101730 r106654  
    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

    r98388 r106654  
    6565    SharedWorkerRepository::connect(worker.get(), remotePort.release(), scriptURL, name, ec);
    6666
     67    worker->suspendIfNeeded();
    6768    InspectorInstrumentation::didCreateWorker(context, worker->asID(), scriptURL.string(), true);
    6869
  • trunk/Source/WebCore/workers/Worker.cpp

    r98388 r106654  
    7474    worker->m_scriptLoader->loadAsynchronously(context, scriptURL, DenyCrossOriginRequests, worker.get());
    7575
     76    worker->suspendIfNeeded();
    7677    InspectorInstrumentation::didCreateWorker(context, worker->asID(), scriptURL.string(), false);
    7778
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r105076 r106654  
    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.