[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
eric.carlson at apple.com
eric.carlson at apple.com
Thu Oct 29 20:31:25 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 0143c04bb0349a3a0c7dfc6b407d7b193d2ae6c3
Author: eric.carlson at apple.com <eric.carlson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Sep 21 20:53:52 2009 +0000
2009-09-21 Eric Carlson <eric.carlson at apple.com>
Reviewed by Brady Eidson.
HTMLMediaElement: media file should not reload when page comes out of page cache
https://bugs.webkit.org/show_bug.cgi?id=29604
Test: media/restore-from-page-cache.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::userCancelledLoad): Do nothing unless the element
is still loading. Only fire an 'emptied' event if the readyState is HAVE_NOTHING,
otherwise set the network state to NETWORK_IDLE.
2009-09-21 Eric Carlson <eric.carlson at apple.com>
Reviewed by Brady Eidson.
HTMLMediaElement: media file should not reload when page comes out of page cache
https://bugs.webkit.org/show_bug.cgi?id=29604
* media/restore-from-page-cache-expected.txt: Added.
* media/restore-from-page-cache.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7c09293..3553d1f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-09-21 Eric Carlson <eric.carlson at apple.com>
+
+ Reviewed by Brady Eidson.
+
+ HTMLMediaElement: media file should not reload when page comes out of page cache
+ https://bugs.webkit.org/show_bug.cgi?id=29604
+
+ * media/restore-from-page-cache-expected.txt: Added.
+ * media/restore-from-page-cache.html: Added.
+
2009-09-21 Oliver Hunt <oliver at apple.com>
Reviewed by Geoff Garen.
diff --git a/LayoutTests/media/restore-from-page-cache-expected.txt b/LayoutTests/media/restore-from-page-cache-expected.txt
new file mode 100644
index 0000000..e3dc44e
--- /dev/null
+++ b/LayoutTests/media/restore-from-page-cache-expected.txt
@@ -0,0 +1,9 @@
+Make sure we don't reload a <video> element when navigating back to an uncached page.
+
+EVENT(loadstart)
+EVENT(load)
+EXPECTED (loadCount == '0') OK
+*** Page going into cache
+*** Page returned from cache
+EXPECTED (loadCount == '1') OK
+
diff --git a/LayoutTests/media/restore-from-page-cache.html b/LayoutTests/media/restore-from-page-cache.html
new file mode 100644
index 0000000..345e005
--- /dev/null
+++ b/LayoutTests/media/restore-from-page-cache.html
@@ -0,0 +1,60 @@
+<html>
+ <head>
+ <script src=media-file.js></script>
+ <script src=video-test.js></script>
+ <script>
+ var mediaFile = findMediaFile("video", "content/test");
+ var loadCount = 0;
+
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+ }
+
+ function pageshow(evt)
+ {
+ if (!evt.persisted) {
+ // this is the first time the page has been loaded, setup the video element
+ setup();
+ } else {
+ consoleWrite("*** Page returned from cache");
+
+ testExpected("loadCount", 1);
+
+ // schedule the test to end shortly, but wait long enough for the element to fire loading events
+ // if that is going to happen
+ setTimeout(function() { if (window.layoutTestController) layoutTestController.notifyDone(); }, 200);
+ }
+ }
+
+ function load()
+ {
+ testExpected("loadCount", 0);
+ if (!loadCount) {
+ consoleWrite("*** Page going into cache");
+ setTimeout('window.location = "data:text/html,<script>history.back()<" + "/script>"', 0);
+ }
+ ++loadCount;
+ }
+
+ function setup()
+ {
+ video = mediaElement = document.getElementsByTagName('video')[0];
+
+ waitForEvent('loadstart');
+ waitForEvent('load', load );
+
+ video.src = mediaFile;
+ }
+
+ window.onpageshow = pageshow;
+ </script>
+ </head>
+ <body>
+
+ <video controls > </video>
+ <p>Make sure we don't reload a <video> element when navigating back to an uncached page.</p>
+ </body>
+</html>
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d1ea944..46a00e2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-09-21 Eric Carlson <eric.carlson at apple.com>
+
+ Reviewed by Brady Eidson.
+
+ HTMLMediaElement: media file should not reload when page comes out of page cache
+ https://bugs.webkit.org/show_bug.cgi?id=29604
+
+ Test: media/restore-from-page-cache.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::userCancelledLoad): Do nothing unless the element
+ is still loading. Only fire an 'emptied' event if the readyState is HAVE_NOTHING,
+ otherwise set the network state to NETWORK_IDLE.
+
2009-09-21 Sam Weinig <sam at webkit.org>
Reviewed by Geoffrey "Sean/Shawn/Shaun" Garen.
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 2ebb45d..3b1a025 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -1618,43 +1618,44 @@ void HTMLMediaElement::stopPeriodicTimers()
void HTMLMediaElement::userCancelledLoad()
{
- if (m_networkState != NETWORK_EMPTY) {
+ if (m_networkState == NETWORK_EMPTY || m_networkState >= NETWORK_LOADED)
+ return;
- // If the media data fetching process is aborted by the user:
+ // If the media data fetching process is aborted by the user:
- // 1 - The user agent should cancel the fetching process.
+ // 1 - The user agent should cancel the fetching process.
#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- m_player.clear();
+ m_player.clear();
#endif
- stopPeriodicTimers();
+ stopPeriodicTimers();
- // 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORT.
- m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
+ // 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORT.
+ m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
- // 3 - Queue a task to fire a progress event called abort at the media element, in the context
- // of the fetching process started by this instance of this algorithm.
- scheduleProgressEvent(eventNames().abortEvent);
-
- // 4 - Queue a task to fire a progress event called loadend at the media element, in the context
- // of the fetching process started by this instance of this algorithm.
- scheduleProgressEvent(eventNames().loadendEvent);
-
- // 5 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the
- // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a
- // simple event called emptied at the element. Otherwise, set set the element's networkState
- // attribute to the NETWORK_IDLE value.
- if (m_networkState >= NETWORK_LOADING) {
- m_networkState = NETWORK_EMPTY;
- m_readyState = HAVE_NOTHING;
- scheduleEvent(eventNames().emptiedEvent);
- }
+ // 3 - Queue a task to fire a progress event called abort at the media element, in the context
+ // of the fetching process started by this instance of this algorithm.
+ scheduleProgressEvent(eventNames().abortEvent);
- // 6 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
- m_delayingTheLoadEvent = false;
+ // 4 - Queue a task to fire a progress event called loadend at the media element, in the context
+ // of the fetching process started by this instance of this algorithm.
+ scheduleProgressEvent(eventNames().loadendEvent);
- // 7 - Abort the overall resource selection algorithm.
- m_currentSourceNode = 0;
+ // 5 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the
+ // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a
+ // simple event called emptied at the element. Otherwise, set set the element's networkState
+ // attribute to the NETWORK_IDLE value.
+ if (m_readyState == HAVE_NOTHING) {
+ m_networkState = NETWORK_EMPTY;
+ scheduleEvent(eventNames().emptiedEvent);
}
+ else
+ m_networkState = NETWORK_IDLE;
+
+ // 6 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
+ m_delayingTheLoadEvent = false;
+
+ // 7 - Abort the overall resource selection algorithm.
+ m_currentSourceNode = 0;
}
void HTMLMediaElement::documentWillBecomeInactive()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list