[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

eric at webkit.org eric at webkit.org
Thu Feb 4 21:31:53 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 742f2fb7ec44d3470ad3182c4bfeb76d6d76d536
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 29 06:41:40 2010 +0000

    2010-01-28  Michael Nordman  <michaeln at google.com>
    
            Reviewed by Alexey Proskuryakov.
    
            ApplicationCache events should be deferred until after Document onload has fired.
            https://bugs.webkit.org/show_bug.cgi?id=29690
    
            * http/tests/appcache/deferred-events-expected.txt: Added.
            * http/tests/appcache/deferred-events.html: Added.
            * http/tests/appcache/deferred-events-delete-while-raising-expected.txt: Added.
            * http/tests/appcache/deferred-events-delete-while-raising.html: Added.
    2010-01-28  Michael Nordman  <michaeln at google.com>
    
            Reviewed by Alexey Proskuryakov.
    
            ApplicationCache events should be deferred until after Document onload has fired.
            https://bugs.webkit.org/show_bug.cgi?id=29690
    
            Test: http/tests/appcache/deferred-events.html
    
            * loader/FrameLoader.cpp:
            (WebCore::FrameLoader::handledOnloadEvents):  Tells the ApplicationCacheHost to stop deferring events.
            * loader/appcache/ApplicationCacheHost.cpp:
            (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true.
            (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event.
            (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
            * loader/appcache/ApplicationCacheHost.h: Declare new data members and method.
    2010-01-28  Michael Nordman  <michaeln at google.com>
    
            Reviewed by Alexey Proskuryakov.
    
            ApplicationCache events should be deferred until after Document onload has fired.
            https://bugs.webkit.org/show_bug.cgi?id=29690
    
            * src/ApplicationCacheHost.cpp:
            (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true.
            (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event.
            (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54044 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7b3ebd9..c8e178e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-28  Michael Nordman  <michaeln at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        ApplicationCache events should be deferred until after Document onload has fired.
+        https://bugs.webkit.org/show_bug.cgi?id=29690
+
+        * http/tests/appcache/deferred-events-expected.txt: Added.
+        * http/tests/appcache/deferred-events.html: Added.
+        * http/tests/appcache/deferred-events-delete-while-raising-expected.txt: Added.
+        * http/tests/appcache/deferred-events-delete-while-raising.html: Added.
+
 2010-01-28  Alex Milowski  <alex at milowski.com>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-expected.txt b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-expected.txt
new file mode 100644
index 0000000..8e41eb6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-expected.txt
@@ -0,0 +1,4 @@
+Test the destruction of an iframe while deferred events are being raised does not crash the system.
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising.html b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising.html
new file mode 100644
index 0000000..902d3a8
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising.html
@@ -0,0 +1,35 @@
+<html manifest="THIS_FILE_DOES_NOT_EXIST.manifest">
+<head>
+  <script src="THIS_FILE_DOES_NOT_EXIST.js" type="text/javascript"></script>
+  <script type="text/javascript">
+    var isParentFrame = window == window.top;
+
+    if (isParentFrame) {
+        if (window.layoutTestController) {
+            layoutTestController.dumpAsText()
+            layoutTestController.waitUntilDone();
+        }
+
+        window.onmessage = function() {
+            document.getElementById('result').innerHTML = "SUCCESS";
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+    } else {
+        window.applicationCache.onchecking = function() {
+            parent.postMessage("hello", "*");
+            parent.killChildFrame();
+        }
+    }
+
+    function killChildFrame() {
+        document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+    }
+  </script>
+</head>
+<body>
+<p>Test the destruction of an iframe while deferred events are being raised does not crash the system.</p>
+<div id="result">FAILURE</div>
+<iframe src="deferred-events-delete-while-raising.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/deferred-events-expected.txt b/LayoutTests/http/tests/appcache/deferred-events-expected.txt
new file mode 100644
index 0000000..45af0af
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events-expected.txt
@@ -0,0 +1,2 @@
+Test that AppicationCache events are deferred until after onload has been fired.
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/deferred-events.html b/LayoutTests/http/tests/appcache/deferred-events.html
new file mode 100644
index 0000000..ba9cf83
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events.html
@@ -0,0 +1,24 @@
+<html manifest="THIS_FILE_DOES_NOT_EXIST.manifest">
+<head>
+  <script type="text/javascript">
+    var onloadHasBeenCalled = false;
+
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText()
+        layoutTestController.waitUntilDone();
+    }
+
+    window.applicationCache.onchecking = function() {
+        if (onloadHasBeenCalled)
+            document.getElementById('result').innerHTML = "SUCCESS"
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+  </script>
+  <script src="THIS_FILE_DOES_NOT_EXIST.js" type="text/javascript"></script>
+</head>
+<body onload="onloadHasBeenCalled = true">
+Test that AppicationCache events are deferred until after onload has been fired.
+<div id="result">FAILURE</div>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8aa837c..dc3ad97 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-28  Michael Nordman  <michaeln at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        ApplicationCache events should be deferred until after Document onload has fired.
+        https://bugs.webkit.org/show_bug.cgi?id=29690
+
+        Test: http/tests/appcache/deferred-events.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::handledOnloadEvents):  Tells the ApplicationCacheHost to stop deferring events.
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true.
+        (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event.
+        (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
+        * loader/appcache/ApplicationCacheHost.h: Declare new data members and method.
+
 2010-01-28  Kavita Kanetkar  <kkanetkar at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 24fa19a..4471c97 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -3147,6 +3147,10 @@ void FrameLoader::tokenizerProcessedData()
 void FrameLoader::handledOnloadEvents()
 {
     m_client->dispatchDidHandleOnloadEvents();
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    if (documentLoader())
+        documentLoader()->applicationCacheHost()->stopDeferringEvents();
+#endif
 }
 
 void FrameLoader::frameDetached()
diff --git a/WebCore/loader/appcache/ApplicationCacheHost.cpp b/WebCore/loader/appcache/ApplicationCacheHost.cpp
index 751efc1..fc98746 100644
--- a/WebCore/loader/appcache/ApplicationCacheHost.cpp
+++ b/WebCore/loader/appcache/ApplicationCacheHost.cpp
@@ -46,6 +46,7 @@ namespace WebCore {
 ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader)
     : m_domApplicationCache(0)
     , m_documentLoader(documentLoader)
+    , m_defersEvents(true)
     , m_candidateApplicationCacheGroup(0)
 {
     ASSERT(m_documentLoader);
@@ -229,6 +230,11 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic
 
 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id)
 {
+    if (m_defersEvents) {
+        // Events are deferred until document.onload has fired.
+        m_deferredEvents.append(id);
+        return;
+    }
     if (m_domApplicationCache) {
         ExceptionCode ec = 0;
         m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
@@ -236,6 +242,21 @@ void ApplicationCacheHost::notifyDOMApplicationCache(EventID id)
     }
 }
 
+void ApplicationCacheHost::stopDeferringEvents()
+{
+    RefPtr<DocumentLoader> protect(documentLoader());
+    for (unsigned i = 0; i < m_deferredEvents.size(); ++i) {
+        EventID id = m_deferredEvents[i];
+        if (m_domApplicationCache) {
+            ExceptionCode ec = 0;
+            m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
+            ASSERT(!ec);
+        }
+    }
+    m_deferredEvents.clear();
+    m_defersEvents = false;
+}
+
 void ApplicationCacheHost::setCandidateApplicationCacheGroup(ApplicationCacheGroup* group)
 {
     ASSERT(!m_applicationCache);
diff --git a/WebCore/loader/appcache/ApplicationCacheHost.h b/WebCore/loader/appcache/ApplicationCacheHost.h
index 9c355de..52d4d40 100644
--- a/WebCore/loader/appcache/ApplicationCacheHost.h
+++ b/WebCore/loader/appcache/ApplicationCacheHost.h
@@ -33,6 +33,7 @@
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
 
+#include <wtf/Deque.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
@@ -110,12 +111,16 @@ namespace WebCore {
         void setDOMApplicationCache(DOMApplicationCache* domApplicationCache);
         void notifyDOMApplicationCache(EventID id);
 
+        void stopDeferringEvents(); // Also raises the events that have been queued up.
+
     private:
         bool isApplicationCacheEnabled();
         DocumentLoader* documentLoader() { return m_documentLoader; }
 
         DOMApplicationCache* m_domApplicationCache;
         DocumentLoader* m_documentLoader;
+        bool m_defersEvents; // Events are deferred until after document onload.
+        Vector<EventID> m_deferredEvents;
 
 #if PLATFORM(CHROMIUM)
         friend class ApplicationCacheHostInternal;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 9ca4b4d..5c3950f 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-28  Michael Nordman  <michaeln at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        ApplicationCache events should be deferred until after Document onload has fired.
+        https://bugs.webkit.org/show_bug.cgi?id=29690
+
+        * src/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true.
+        (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event.
+        (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
+
 2010-01-27  Aaron Boodman  <aa at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/chromium/src/ApplicationCacheHost.cpp b/WebKit/chromium/src/ApplicationCacheHost.cpp
index fdd1649..5fa4a66 100644
--- a/WebKit/chromium/src/ApplicationCacheHost.cpp
+++ b/WebKit/chromium/src/ApplicationCacheHost.cpp
@@ -55,6 +55,7 @@ namespace WebCore {
 ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader)
     : m_domApplicationCache(0)
     , m_documentLoader(documentLoader)
+    , m_defersEvents(true)
 {
     ASSERT(m_documentLoader);
 }
@@ -196,15 +197,32 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic
 
 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id)
 {
+    if (m_defersEvents) {
+        m_deferredEvents.append(id);
+        return;
+    }
     if (m_domApplicationCache) {
         ExceptionCode ec = 0;
-        m_domApplicationCache->dispatchEvent(
-            Event::create(DOMApplicationCache::toEventType(id), false, false),
-            ec);
+        m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
         ASSERT(!ec);
     }
 }
 
+void ApplicationCacheHost::stopDeferringEvents()
+{
+    RefPtr<DocumentLoader> protect(documentLoader());
+    for (unsigned i = 0; i < m_deferredEvents.size(); ++i) {
+        EventID id = m_deferredEvents[i];
+        if (m_domApplicationCache) {
+            ExceptionCode ec = 0;
+            m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
+            ASSERT(!ec);
+        }
+    }
+    m_deferredEvents.clear();
+    m_defersEvents = false;
+}
+
 ApplicationCacheHost::Status ApplicationCacheHost::status() const
 {
     return m_internal ? static_cast<Status>(m_internal->m_outerHost->status()) : UNCACHED;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list