webkitsourceopen event doesn't always fire
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Oct 2012 18:52:49 +0000 (18:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Oct 2012 18:52:49 +0000 (18:52 +0000)
commit1810be8e8483fb88ca968eb6009369b55ba190a5
tree68ac3e10e867ba9fd1a4c6be06994918b3ba130d
parent7c27c4712ab12da3b22e7651d2e18e293db364ca
webkitsourceopen event doesn't always fire
https://bugs.webkit.org/show_bug.cgi?id=99868

Patch by Aaron Colwell <acolwell@chromium.org> on 2012-10-22
Reviewed by Adam Barth.

Source/WebCore:

Changed MediaSource to derive from ActiveDOMObject so that event listeners
will still fire even if all references to the object go out of scope.

Test: http/tests/media/media-source/video-media-source-garbage-collection-before-sourceopen.html

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::create):
(WebCore::MediaSource::MediaSource):
(WebCore::MediaSource::scriptExecutionContext):
(WebCore):
(WebCore::MediaSource::hasPendingActivity):
(WebCore::MediaSource::stop): Clears m_player & m_asyncEventQueue so they don't indicate pending activity anymore.
* Modules/mediasource/MediaSource.h:
(MediaSource):
* Modules/mediasource/MediaSource.idl:
* Modules/mediasource/MediaSourceRegistry.cpp:
(WebCore::MediaSourceRegistry::registerMediaSourceURL): Added setPendingActivity() call so the MediaSource object stays active while in the registry.
(WebCore::MediaSourceRegistry::unregisterMediaSourceURL): Added unsetPendingActivity() call so the MediaSource object can become inactive after being removed from the registry.

LayoutTests:

Added a test that verifies the webkitsourceopen event still fires
even if the MediaSource variable goes out of scope and garbage
collection occurs.

* http/tests/media/media-source/video-media-source-garbage-collection-before-sourceopen-expected.txt: Added.
* http/tests/media/media-source/video-media-source-garbage-collection-before-sourceopen.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132115 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/media/media-source/video-media-source-garbage-collection-before-sourceopen-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/video-media-source-garbage-collection-before-sourceopen.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediasource/MediaSource.h
Source/WebCore/Modules/mediasource/MediaSource.idl
Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp