<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[180774] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/180774">180774</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-02-27 13:18:39 -0800 (Fri, 27 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>MediaSource should be suspendable when closed
https://bugs.webkit.org/show_bug.cgi?id=142089
&lt;rdar://problem/19923085&gt;

Reviewed by Jer Noble.

Source/WebCore:

Make MediaSource ActiveDOMObject suspendable when it is in closed state
and it has no pending events. This increases the likelihood of pages
using MediaSource to enter the PageCache.

Tests: fast/history/page-cache-media-source-closed-2.html
       fast/history/page-cache-media-source-closed.html
       fast/history/page-cache-media-source-opened.html

LayoutTests:

Add layout tests to check that:
- Pages with an open MediaSource do not enter the PageCache
- Pages with an initially closed MediaSource enter the PageCache
- Pages with a MediaSource that changed state from opened to closed
  enter the PageCache.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwincairoTestExpectations">trunk/LayoutTests/platform/wincairo/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceMediaSourcecpp">trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceMediaSourceh">trunk/Source/WebCore/Modules/mediasource/MediaSource.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasthistorypagecachemediasourceclosed2expectedtxt">trunk/LayoutTests/fast/history/page-cache-media-source-closed-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasthistorypagecachemediasourceclosed2html">trunk/LayoutTests/fast/history/page-cache-media-source-closed-2.html</a></li>
<li><a href="#trunkLayoutTestsfasthistorypagecachemediasourceclosedexpectedtxt">trunk/LayoutTests/fast/history/page-cache-media-source-closed-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasthistorypagecachemediasourceclosedhtml">trunk/LayoutTests/fast/history/page-cache-media-source-closed.html</a></li>
<li><a href="#trunkLayoutTestsfasthistorypagecachemediasourceopenedexpectedtxt">trunk/LayoutTests/fast/history/page-cache-media-source-opened-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasthistorypagecachemediasourceopenedhtml">trunk/LayoutTests/fast/history/page-cache-media-source-opened.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/LayoutTests/ChangeLog        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -1,5 +1,19 @@
</span><span class="cx"> 2015-02-27  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        MediaSource should be suspendable when closed
+        https://bugs.webkit.org/show_bug.cgi?id=142089
+        &lt;rdar://problem/19923085&gt;
+
+        Reviewed by Jer Noble.
+
+        Add layout tests to check that:
+        - Pages with an open MediaSource do not enter the PageCache
+        - Pages with an initially closed MediaSource enter the PageCache
+        - Pages with a MediaSource that changed state from opened to closed
+          enter the PageCache.
+
+2015-02-27  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         Make IDBDatabase / IDBRequest suspendable
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=142076
</span><span class="cx">         &lt;rdar://problem/19923085&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfasthistorypagecachemediasourceclosed2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/history/page-cache-media-source-closed-2-expected.txt (0 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/history/page-cache-media-source-closed-2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/history/page-cache-media-source-closed-2-expected.txt        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Tests that a page with a closed MediaSource goes into the page cache.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+pageshow - not from cache
+pagehide - entering cache
+pageshow - from cache
+PASS Page did enter and was restored from the page cache
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasthistorypagecachemediasourceclosed2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/history/page-cache-media-source-closed-2.html (0 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/history/page-cache-media-source-closed-2.html                                (rev 0)
+++ trunk/LayoutTests/fast/history/page-cache-media-source-closed-2.html        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description('Tests that a page with a closed MediaSource goes into the page cache.');
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.overridePreference(&quot;WebKitUsesPageCachePreferenceKey&quot;, 1);
+
+window.addEventListener(&quot;pageshow&quot;, function(event) {
+    debug(&quot;pageshow - &quot; + (event.persisted ? &quot;&quot; : &quot;not &quot;) + &quot;from cache&quot;);
+
+    if (event.persisted) {
+        testPassed(&quot;Page did enter and was restored from the page cache&quot;);
+        finishJSTest();
+    }
+}, false);
+
+window.addEventListener(&quot;pagehide&quot;, function(event) {
+    debug(&quot;pagehide - &quot; + (event.persisted ? &quot;&quot; : &quot;not &quot;) + &quot;entering cache&quot;);
+    if (!event.persisted) {
+        testFailed(&quot;Page did not enter the page cache.&quot;);
+        finishJSTest();
+    }
+}, false);
+
+window.addEventListener('load', function() {
+    // Construct a MediaSource and open it.
+    mediaSource = new MediaSource();
+    mediaTag = document.createElement(&quot;video&quot;);
+    document.body.appendChild(mediaTag);
+    mediaSourceURL = URL.createObjectURL(mediaSource);
+    mediaTag.src = mediaSourceURL;
+
+    window.sessionStorage.page_cache_open_mediasource_test_started = true;
+
+    mediaSource.addEventListener('sourceopen', function() {
+        // Cause the MediaSource to close.
+        mediaTag.src = &quot;&quot;;
+    });
+
+    mediaSource.addEventListener('sourceclose', function() {
+        // Force a back navigation back to this page.
+        window.location.href = &quot;resources/page-cache-helper.html&quot;;
+    });
+}, false);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasthistorypagecachemediasourceclosedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/history/page-cache-media-source-closed-expected.txt (0 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/history/page-cache-media-source-closed-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/history/page-cache-media-source-closed-expected.txt        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Tests that a page with a closed MediaSource goes into the page cache.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+pageshow - not from cache
+pagehide - entering cache
+pageshow - from cache
+PASS Page did enter and was restored from the page cache
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasthistorypagecachemediasourceclosedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/history/page-cache-media-source-closed.html (0 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/history/page-cache-media-source-closed.html                                (rev 0)
+++ trunk/LayoutTests/fast/history/page-cache-media-source-closed.html        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description('Tests that a page with a closed MediaSource goes into the page cache.');
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.overridePreference(&quot;WebKitUsesPageCachePreferenceKey&quot;, 1);
+
+window.addEventListener(&quot;pageshow&quot;, function(event) {
+    debug(&quot;pageshow - &quot; + (event.persisted ? &quot;&quot; : &quot;not &quot;) + &quot;from cache&quot;);
+
+    if (event.persisted) {
+        testPassed(&quot;Page did enter and was restored from the page cache&quot;);
+        finishJSTest();
+    }
+}, false);
+
+window.addEventListener(&quot;pagehide&quot;, function(event) {
+    debug(&quot;pagehide - &quot; + (event.persisted ? &quot;&quot; : &quot;not &quot;) + &quot;entering cache&quot;);
+    if (!event.persisted) {
+        testFailed(&quot;Page did not enter the page cache.&quot;);
+        finishJSTest();
+    }
+}, false);
+
+window.addEventListener('load', function() {
+    // Construct a MediaSource (it is initially in closed state).
+    mediaSource = new MediaSource();
+
+    // This needs to happen outside the onload handler so that a history
+    // item is created.
+    setTimeout(function() {
+        // Force a back navigation back to this page.
+        window.location.href = &quot;resources/page-cache-helper.html&quot;;
+    }, 0);
+}, false);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasthistorypagecachemediasourceopenedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/history/page-cache-media-source-opened-expected.txt (0 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/history/page-cache-media-source-opened-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/history/page-cache-media-source-opened-expected.txt        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Tests that a page with a closed MediaSource goes into the page cache.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+pageshow - not from cache
+PASS Page was not restored from page cache
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasthistorypagecachemediasourceopenedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/history/page-cache-media-source-opened.html (0 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/history/page-cache-media-source-opened.html                                (rev 0)
+++ trunk/LayoutTests/fast/history/page-cache-media-source-opened.html        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description('Tests that a page with a closed MediaSource goes into the page cache.');
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.overridePreference(&quot;WebKitUsesPageCachePreferenceKey&quot;, 1);
+
+window.addEventListener(&quot;pageshow&quot;, function(event) {
+    debug(&quot;pageshow - &quot; + (event.persisted ? &quot;&quot; : &quot;not &quot;) + &quot;from cache&quot;);
+    if (!window.sessionStorage.page_cache_open_mediasource_test_started)
+        return;
+
+    delete window.sessionStorage.page_cache_open_mediasource_test_started;
+
+    if (event.persisted)
+        testFailed(&quot;Page did enter and was restored from the page cache&quot;);
+    else
+        testPassed(&quot;Page was not restored from page cache&quot;);
+
+    finishJSTest();
+}, false);
+
+window.addEventListener(&quot;pagehide&quot;, function(event) {
+    debug(&quot;pagehide - &quot; + (event.persisted ? &quot;&quot; : &quot;not &quot;) + &quot;entering cache&quot;);
+    if (event.persisted) {
+        testFailed(&quot;Page entered the page cache.&quot;);
+        finishJSTest();
+    }
+}, false);
+
+window.addEventListener('load', function() {
+    // Construct a MediaSource and open it.
+    mediaSource = new MediaSource();
+    mediaTag = document.createElement(&quot;video&quot;);
+    document.body.appendChild(mediaTag);
+    mediaSourceURL = URL.createObjectURL(mediaSource);
+    mediaTag.src = mediaSourceURL;
+
+    window.sessionStorage.page_cache_open_mediasource_test_started = true;
+
+    mediaSource.addEventListener('sourceopen', function() {
+        // Force a back navigation back to this page.
+        window.location.href = &quot;resources/page-cache-helper.html&quot;;
+    });
+}, false);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -1046,6 +1046,9 @@
</span><span class="cx"> # Requires MEDIA_SOURCE support.
</span><span class="cx"> webkit.org/b/95296 http/tests/media/media-source [ Skip ]
</span><span class="cx"> webkit.org/b/95296 media/media-source [ Skip ]
</span><ins>+webkit.org/b/95296 fast/history/page-cache-media-source-opened.html [ Skip ]
+webkit.org/b/95296 fast/history/page-cache-media-source-closed.html [ Skip ]
+webkit.org/b/95296 fast/history/page-cache-media-source-closed-2.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # Requires ENCRYPTED_MEDIA support.
</span><span class="cx"> webkit.org/b/95297 media/encrypted-media [ Pass ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -952,6 +952,9 @@
</span><span class="cx"> # Mavericks and prior do not support Media Source.
</span><span class="cx"> [ Mavericks ] media/media-source [ WontFix ]
</span><span class="cx"> [ Mavericks ] http/tests/media/media-source/ [ WontFix ]
</span><ins>+[ Mavericks ] fast/history/page-cache-media-source-closed.html [ WontFix ]
+[ Mavericks ] fast/history/page-cache-media-source-closed-2.html [ WontFix ]
+[ Mavericks ] fast/history/page-cache-media-source-opened.html [ WontFix ]
</ins><span class="cx"> ## --- End media tests failing on Mavericks and earlier ---
</span><span class="cx"> 
</span><span class="cx"> ## --- Start flaky media tests ---
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/LayoutTests/platform/win/TestExpectations        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -799,6 +799,9 @@
</span><span class="cx"> # Tests for MediaSource API. Feature is not yet functional.
</span><span class="cx"> media/media-source/ [ Skip ]
</span><span class="cx"> webkit.org/b/64731 http/tests/media/media-source/ [ Skip ]
</span><ins>+webkit.org/b/64731 fast/history/page-cache-media-source-opened.html [ Skip ]
+webkit.org/b/64731 fast/history/page-cache-media-source-closed.html [ Skip ]
+webkit.org/b/64731 fast/history/page-cache-media-source-closed-2.html  [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # These tests are for an obsolete version of the EME spec.
</span><span class="cx"> fast/events/constructors/media-key-event-constructor.html [ Skip ] # [ WontFix ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwincairoTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wincairo/TestExpectations        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -1995,6 +1995,9 @@
</span><span class="cx"> # Tests for MediaSource API. Feature is not yet functional.
</span><span class="cx"> # https://bugs.webkit.org/show_bug.cgi?id=64731
</span><span class="cx"> http/tests/media/media-source/
</span><ins>+fast/history/page-cache-media-source-opened.html
+fast/history/page-cache-media-source-closed.html
+fast/history/page-cache-media-source-closed-2.html
</ins><span class="cx"> 
</span><span class="cx"> # Encrypted Media Extensions are not enabled.
</span><span class="cx"> media/encrypted-media/
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/Source/WebCore/ChangeLog        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-02-27  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        MediaSource should be suspendable when closed
+        https://bugs.webkit.org/show_bug.cgi?id=142089
+        &lt;rdar://problem/19923085&gt;
+
+        Reviewed by Jer Noble.
+
+        Make MediaSource ActiveDOMObject suspendable when it is in closed state
+        and it has no pending events. This increases the likelihood of pages
+        using MediaSource to enter the PageCache.
+
+        Tests: fast/history/page-cache-media-source-closed-2.html
+               fast/history/page-cache-media-source-closed.html
+               fast/history/page-cache-media-source-opened.html
+
</ins><span class="cx"> 2015-02-27  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use NeverDestroyed for JS wrapper owners.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceMediaSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -809,6 +809,11 @@
</span><span class="cx">     m_private.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MediaSource::canSuspend() const
+{
+    return isClosed() &amp;&amp; !m_asyncEventQueue.hasPendingEvents();
+}
+
</ins><span class="cx"> void MediaSource::onReadyStateChange(const AtomicString&amp; oldState, const AtomicString&amp; newState)
</span><span class="cx"> {
</span><span class="cx">     if (isOpen()) {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceMediaSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.h (180773 => 180774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/MediaSource.h        2015-02-27 20:14:22 UTC (rev 180773)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.h        2015-02-27 21:18:39 UTC (rev 180774)
</span><span class="lines">@@ -100,8 +100,9 @@
</span><span class="cx">     static bool isTypeSupported(const String&amp; type);
</span><span class="cx"> 
</span><span class="cx">     // ActiveDOMObject interface
</span><del>-    virtual bool hasPendingActivity() const override;
-    virtual void stop() override;
</del><ins>+    bool hasPendingActivity() const override;
+    void stop() override;
+    bool canSuspend() const override;
</ins><span class="cx"> 
</span><span class="cx">     // EventTarget interface
</span><span class="cx">     virtual ScriptExecutionContext* scriptExecutionContext() const override final;
</span></span></pre>
</div>
</div>

</body>
</html>