[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jschuh at chromium.org jschuh at chromium.org
Wed Dec 22 14:07:17 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 47fb2f5c765554bede733cdd82eb388308758da2
Author: jschuh at chromium.org <jschuh at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 4 22:25:43 2010 +0000

    2010-10-04  Justin Schuh  <jschuh at chromium.org>
    
            Reviewed by James Robinson.
    
            HTMLMediaElement delayed load should fire asynchronously
            https://bugs.webkit.org/show_bug.cgi?id=45765
    
            Test: media/remove-from-document-before-load.html
    
            * dom/Document.cpp:
            (WebCore::Document::Document):
            (WebCore::Document::decrementLoadEventDelayCount):
            (WebCore::Document::loadEventDelayTimerFired):
            * dom/Document.h:
            * html/HTMLMediaElement.cpp:
            (WebCore::HTMLMediaElement::HTMLMediaElement):
            (WebCore::HTMLMediaElement::asyncEventTimerFired):
            (WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
            * html/HTMLMediaElement.h:
    2010-10-04  Justin Schuh  <jschuh at chromium.org>
    
            Reviewed by James Robinson.
    
            HTMLMediaElement delayed load should fire asynchronously
            https://bugs.webkit.org/show_bug.cgi?id=45765
    
            * media/remove-from-document-before-load-expected.txt: Added.
            * media/remove-from-document-before-load.html: Added.
            * media/video-click-dblckick-standalone.html:
            * media/video-controls-rendering.html:
            * media/video-transformed.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69043 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 572ae19..7c0cc2b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-04  Justin Schuh  <jschuh at chromium.org>
+
+        Reviewed by James Robinson.
+
+        HTMLMediaElement delayed load should fire asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=45765
+
+        * media/remove-from-document-before-load-expected.txt: Added.
+        * media/remove-from-document-before-load.html: Added.
+        * media/video-click-dblckick-standalone.html:
+        * media/video-controls-rendering.html:
+        * media/video-transformed.html:
+
 2010-10-04  Alpha Lam  <hclam at chromium.org>
 
         Build fix. Not reviewed.
diff --git a/LayoutTests/media/remove-from-document-before-load-expected.txt b/LayoutTests/media/remove-from-document-before-load-expected.txt
new file mode 100644
index 0000000..c81e248
--- /dev/null
+++ b/LayoutTests/media/remove-from-document-before-load-expected.txt
@@ -0,0 +1 @@
+PASS: A crash did not occur when the media element was removed before loading.
diff --git a/LayoutTests/media/remove-from-document-before-load.html b/LayoutTests/media/remove-from-document-before-load.html
new file mode 100644
index 0000000..fa27217
--- /dev/null
+++ b/LayoutTests/media/remove-from-document-before-load.html
@@ -0,0 +1,11 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+</script>
+<body onload="document.body.innerHTML='PASS: A crash did not occur when the media element was removed before loading.';
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();">
+<video src="A"></video>
+</body>
\ No newline at end of file
diff --git a/LayoutTests/media/video-click-dblckick-standalone.html b/LayoutTests/media/video-click-dblckick-standalone.html
index 59608a6..7a13e43 100644
--- a/LayoutTests/media/video-click-dblckick-standalone.html
+++ b/LayoutTests/media/video-click-dblckick-standalone.html
@@ -16,7 +16,10 @@
         function test()
         {
             video = document.getElementById('fr').contentDocument.getElementsByTagName('video')[0];
-            video.addEventListener('canplaythrough', test2);
+            if (video.readyState >= 4)
+                test2();
+            else
+                video.addEventListener('canplaythrough', test2);
         }
         function test2()
         {
diff --git a/LayoutTests/media/video-controls-rendering.html b/LayoutTests/media/video-controls-rendering.html
index dc70b11..0ef5084 100644
--- a/LayoutTests/media/video-controls-rendering.html
+++ b/LayoutTests/media/video-controls-rendering.html
@@ -1,6 +1,6 @@
 <script src="media-file.js"></script>
 <script src="video-paint-test.js"></script>
-<body onload="init()">
+<body>
 <p>Test controls placement. </p>
 <div>
     <video controls></video>
@@ -11,5 +11,8 @@
 <div>
     <video controls style="position: absolute; width: 320px;"></video>
 </div>
-<script>setSrcByTagName('video', findMediaFile('video', 'content/test'))</script>
+<script>
+init();
+setSrcByTagName('video', findMediaFile('video', 'content/test'));
+</script>
 </body>
diff --git a/LayoutTests/media/video-transformed.html b/LayoutTests/media/video-transformed.html
index d3ab263..3c1a72b 100644
--- a/LayoutTests/media/video-transformed.html
+++ b/LayoutTests/media/video-transformed.html
@@ -1,6 +1,6 @@
 <script src="media-file.js"></script>
 <script src="video-paint-test.js"></script>
-<body onload="init()">
+<body>
 <style>
 video { width:200px; border: 3px solid red; }
 </style>
@@ -8,5 +8,8 @@ video { width:200px; border: 3px solid red; }
 &nbsp;<video style="-webkit-transform:rotate(20deg)"></video><br>
 &nbsp;<video style="-webkit-transform:scale(0.5)"></video><br>
 &nbsp;<video style="-webkit-transform:skew(20deg)"></video><br>
-<script>setSrcByTagName('video', findMediaFile('video', 'content/test'))</script>
+<script>
+init();
+setSrcByTagName('video', findMediaFile('video', 'content/test'));
+</script>
 </body>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5bd6ea3..2d71a9b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-04  Justin Schuh  <jschuh at chromium.org>
+
+        Reviewed by James Robinson.
+
+        HTMLMediaElement delayed load should fire asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=45765
+
+        Test: media/remove-from-document-before-load.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::decrementLoadEventDelayCount):
+        (WebCore::Document::loadEventDelayTimerFired):
+        * dom/Document.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement):
+        (WebCore::HTMLMediaElement::asyncEventTimerFired):
+        (WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
+        * html/HTMLMediaElement.h:
+
 2010-10-04  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 84a8038..2192f11 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -407,6 +407,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML, con
     , m_areKeysEnabledInFullScreen(0)
 #endif
     , m_loadEventDelayCount(0)
+    , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
 {
     m_document = this;
 
@@ -4765,7 +4766,13 @@ void Document::decrementLoadEventDelayCount()
     ASSERT(m_loadEventDelayCount);
     --m_loadEventDelayCount;
 
-    if (frame() && !m_loadEventDelayCount)
+    if (frame() && !m_loadEventDelayCount && !m_loadEventDelayTimer.isActive())
+        m_loadEventDelayTimer.startOneShot(0);
+}
+
+void Document::loadEventDelayTimerFired(Timer<Document>*)
+{
+    if (frame())
         frame()->loader()->checkCompleted();
 }
 
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index fa14e3d..372090c 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -1077,6 +1077,8 @@ private:
 
     PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const;
 
+    void loadEventDelayTimerFired(Timer<Document>*);
+
     OwnPtr<CSSStyleSelector> m_styleSelector;
     bool m_didCalculateStyleSelector;
 
@@ -1319,6 +1321,7 @@ private:
 #endif
 
     int m_loadEventDelayCount;
+    Timer<Document> m_loadEventDelayTimer;
 
     ViewportArguments m_viewportArguments;
 };
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index cd44ee1..3d9149e 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -136,7 +136,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
     , m_playing(false)
     , m_isWaitingUntilMediaCanStart(false)
     , m_shouldDelayLoadEvent(false)
-    , m_isWaitingToDecrementLoadEventDelayCount(false)
     , m_haveFiredLoadedData(false)
     , m_inActiveDocument(true)
     , m_autoplaying(true)
@@ -399,15 +398,6 @@ void HTMLMediaElement::scheduleEvent(const AtomicString& eventName)
 
 void HTMLMediaElement::asyncEventTimerFired(Timer<HTMLMediaElement>*)
 {
-    // If we are waiting to release our delay on the load event, do that first and post
-    // the pending events on the next go around.
-    if (m_isWaitingToDecrementLoadEventDelayCount) {
-        setShouldDelayLoadEvent(false);
-        if (!m_asyncEventTimer.isActive())
-            m_asyncEventTimer.startOneShot(0);
-        return;
-    }
-
     Vector<RefPtr<Event> > pendingEvents;
     ExceptionCode ec = 0;
 
@@ -2332,24 +2322,9 @@ void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay)
     if (m_shouldDelayLoadEvent == shouldDelay)
         return;
 
-    // Don't decrement the load event delay if we are in the middle of a callback from
-    // the media engine. The load event is sent synchronously and may trigger a script that
-    // causes the document to be come inactive and that will clear the media engine, causing 
-    // the return to be a rough one.
-    if (!shouldDelay && processingMediaPlayerCallback()) {
-        m_isWaitingToDecrementLoadEventDelayCount = true;
-
-        // Instead of creating yet-another-timer, reuse the async event timer which is always
-        // used as a one-shot.
-        if (!m_asyncEventTimer.isActive())
-            m_asyncEventTimer.startOneShot(0);
-        return;
-    }
-
     LOG(Media, "HTMLMediaElement::setShouldDelayLoadEvent(%s)", boolString(shouldDelay));
 
     m_shouldDelayLoadEvent = shouldDelay;
-    m_isWaitingToDecrementLoadEventDelayCount = false;
     if (shouldDelay)
         document()->incrementLoadEventDelayCount();
     else
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index db75a9c..99232e0 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -350,7 +350,6 @@ private:
     bool m_playing : 1;
     bool m_isWaitingUntilMediaCanStart : 1;
     bool m_shouldDelayLoadEvent : 1;
-    bool m_isWaitingToDecrementLoadEventDelayCount : 1;
     bool m_haveFiredLoadedData : 1;
     bool m_inActiveDocument : 1;
     bool m_autoplaying : 1;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list