[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

darin at apple.com darin at apple.com
Thu Oct 29 20:32:17 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 4d9d718cfbcda70f54770e140b5c71375e1960b9
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 23 00:38:04 2009 +0000

    Tighten up the ScheduledRedirection machinery to prepare for a bug fix
    https://bugs.webkit.org/show_bug.cgi?id=29663
    
    Patch by Darin Adler <darin at apple.com> on 2009-09-22
    Reviewed by Sam Weinig.
    
    WebCore:
    
    * loader/FrameLoader.cpp:
    (WebCore::ScheduledRedirection::ScheduledRedirection): Added a boolean,
    initialized to false, to keep track if the redirection has been
    communicated to the client.
    (WebCore::FrameLoader::stopLoading): Tweaked a comment.
    (WebCore::FrameLoader::cancelRedirection): Removed code to clear
    m_scheduledRedirection.clear since stopRedirectionTimer does that now.
    (WebCore::FrameLoader::allChildrenAreComplete): Added.
    (WebCore::FrameLoader::checkCompleted): Use allChildrenAreComplete
    function for clarity.
    (WebCore::FrameLoader::checkCallImplicitClose): Ditto.
    (WebCore::FrameLoader::scheduleRedirection): Changed to take a PassOwnPtr.
    (WebCore::FrameLoader::startRedirectionTimer): Added code to set the
    toldClient flag and not call clientRedirected a second time if it is set.
    (WebCore::FrameLoader::stopRedirectionTimer): Changed so this can be safely
    called multiple times and it will call clientRedirectCancelledOrFinished
    only once.
    
    * loader/FrameLoader.h: Changed scheduleRedirection to be a PassOwnPtr.
    Added allChildrenAreComplete function.
    
    LayoutTests:
    
    * http/tests/loading/deleted-host-in-resource-load-delegate-callback-expected.txt:
    Updated test to reflect progression. The willPerformClientRedirectToURL
    call was called an extra time before.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48661 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b98e1ce..c413d27 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-09-22  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Tighten up the ScheduledRedirection machinery to prepare for a bug fix
+        https://bugs.webkit.org/show_bug.cgi?id=29663
+
+        * http/tests/loading/deleted-host-in-resource-load-delegate-callback-expected.txt:
+        Updated test to reflect progression. The willPerformClientRedirectToURL
+        call was called an extra time before.
+
 2009-09-22  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/http/tests/loading/deleted-host-in-resource-load-delegate-callback-expected.txt b/LayoutTests/http/tests/loading/deleted-host-in-resource-load-delegate-callback-expected.txt
index 27c8d43..58cf6f4 100644
--- a/LayoutTests/http/tests/loading/deleted-host-in-resource-load-delegate-callback-expected.txt
+++ b/LayoutTests/http/tests/loading/deleted-host-in-resource-load-delegate-callback-expected.txt
@@ -3,7 +3,6 @@ main frame - didCommitLoadForFrame
 main frame - didFinishDocumentLoadForFrame
 main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/deleted-host-in-resource-load-delegate-callback.html 
 main frame - didHandleOnloadEventsForFrame
-main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/deleted-host-in-resource-load-delegate-callback.html 
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCancelClientRedirectForFrame
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4355458..7333789 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,31 @@
+2009-09-22  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Tighten up the ScheduledRedirection machinery to prepare for a bug fix
+        https://bugs.webkit.org/show_bug.cgi?id=29663
+
+        * loader/FrameLoader.cpp:
+        (WebCore::ScheduledRedirection::ScheduledRedirection): Added a boolean,
+        initialized to false, to keep track if the redirection has been
+        communicated to the client.
+        (WebCore::FrameLoader::stopLoading): Tweaked a comment.
+        (WebCore::FrameLoader::cancelRedirection): Removed code to clear
+        m_scheduledRedirection.clear since stopRedirectionTimer does that now.
+        (WebCore::FrameLoader::allChildrenAreComplete): Added.
+        (WebCore::FrameLoader::checkCompleted): Use allChildrenAreComplete
+        function for clarity.
+        (WebCore::FrameLoader::checkCallImplicitClose): Ditto.
+        (WebCore::FrameLoader::scheduleRedirection): Changed to take a PassOwnPtr.
+        (WebCore::FrameLoader::startRedirectionTimer): Added code to set the
+        toldClient flag and not call clientRedirected a second time if it is set.
+        (WebCore::FrameLoader::stopRedirectionTimer): Changed so this can be safely
+        called multiple times and it will call clientRedirectCancelledOrFinished
+        only once.
+
+        * loader/FrameLoader.h: Changed scheduleRedirection to be a PassOwnPtr.
+        Added allChildrenAreComplete function.
+
 2009-09-22  Yury Semikhatsky  <yurys at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 16c390c..5a51660 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -138,6 +138,7 @@ struct ScheduledRedirection {
     const bool wasUserGesture;
     const bool wasRefresh;
     const bool wasDuringLoad;
+    bool toldClient;
 
     ScheduledRedirection(double delay, const String& url, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, bool refresh)
         : type(redirection)
@@ -149,6 +150,7 @@ struct ScheduledRedirection {
         , wasUserGesture(wasUserGesture)
         , wasRefresh(refresh)
         , wasDuringLoad(false)
+        , toldClient(false)
     {
         ASSERT(!url.isEmpty());
     }
@@ -164,6 +166,7 @@ struct ScheduledRedirection {
         , wasUserGesture(wasUserGesture)
         , wasRefresh(refresh)
         , wasDuringLoad(duringLoad)
+        , toldClient(false)
     {
         ASSERT(!url.isEmpty());
     }
@@ -177,6 +180,7 @@ struct ScheduledRedirection {
         , wasUserGesture(false)
         , wasRefresh(false)
         , wasDuringLoad(false)
+        , toldClient(false)
     {
     }
 
@@ -194,6 +198,7 @@ struct ScheduledRedirection {
         , wasUserGesture(false)
         , wasRefresh(false)
         , wasDuringLoad(duringLoad)
+        , toldClient(false)
     {
         ASSERT(!frameRequest.isEmpty());
         ASSERT(this->formState);
@@ -597,7 +602,7 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic
             m_frame->document()->removeAllEventListeners();
     }
 
-    m_isComplete = true; // to avoid calling completed() in finishedParsing() (David)
+    m_isComplete = true; // to avoid calling completed() in finishedParsing()
     m_isLoadingMainResource = false;
     m_didCallImplicitClose = true; // don't want that one either
 
@@ -656,8 +661,6 @@ void FrameLoader::cancelRedirection(bool cancelWithLoadInProgress)
     m_cancellingWithLoadInProgress = cancelWithLoadInProgress;
 
     stopRedirectionTimer();
-
-    m_scheduledRedirection.clear();
 }
 
 KURL FrameLoader::iconURL()
@@ -1238,15 +1241,23 @@ void FrameLoader::loadDone()
     checkCompleted();
 }
 
+bool FrameLoader::allChildrenAreComplete() const
+{
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+        if (!child->loader()->m_isComplete)
+            return false;
+    }
+    return true;
+}
+
 void FrameLoader::checkCompleted()
 {
     if (m_frame->view())
         m_frame->view()->checkStopDelayingDeferredRepaints();
 
     // Any frame that hasn't completed yet?
-    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-        if (!child->loader()->m_isComplete)
-            return;
+    if (!allChildrenAreComplete())
+        return;
 
     // Have we completed before?
     if (m_isComplete)
@@ -1305,9 +1316,8 @@ void FrameLoader::checkCallImplicitClose()
     if (m_didCallImplicitClose || m_frame->document()->parsing())
         return;
 
-    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-        if (!child->loader()->m_isComplete) // still got a frame running -> too early
-            return;
+    if (!allChildrenAreComplete())
+        return; // still got a frame running -> too early
 
     m_didCallImplicitClose = true;
     m_wasUnloadEventEmitted = false;
@@ -2110,7 +2120,7 @@ bool FrameLoader::isComplete() const
     return m_isComplete;
 }
 
-void FrameLoader::scheduleRedirection(ScheduledRedirection* redirection)
+void FrameLoader::scheduleRedirection(PassOwnPtr<ScheduledRedirection> redirection)
 {
     ASSERT(m_frame->page());
 
@@ -2124,10 +2134,10 @@ void FrameLoader::scheduleRedirection(ScheduledRedirection* redirection)
     }
 
     stopRedirectionTimer();
-    m_scheduledRedirection.set(redirection);
-    if (!m_isComplete && redirection->type != ScheduledRedirection::redirection)
+    m_scheduledRedirection = redirection;
+    if (!m_isComplete && m_scheduledRedirection->type != ScheduledRedirection::redirection)
         completed();
-    if (m_isComplete || redirection->type != ScheduledRedirection::redirection)
+    if (m_isComplete || m_scheduledRedirection->type != ScheduledRedirection::redirection)
         startRedirectionTimer();
 }
 
@@ -2142,6 +2152,9 @@ void FrameLoader::startRedirectionTimer()
     switch (m_scheduledRedirection->type) {
         case ScheduledRedirection::locationChange:
         case ScheduledRedirection::redirection:
+            if (m_scheduledRedirection->toldClient)
+                return;
+            m_scheduledRedirection->toldClient = true;
             clientRedirected(KURL(ParsedURLString, m_scheduledRedirection->url),
                 m_scheduledRedirection->delay,
                 currentTime() + m_redirectionTimer.nextFireInterval(),
@@ -2161,28 +2174,11 @@ void FrameLoader::startRedirectionTimer()
 
 void FrameLoader::stopRedirectionTimer()
 {
-    if (!m_redirectionTimer.isActive())
-        return;
-
     m_redirectionTimer.stop();
 
-    if (m_scheduledRedirection) {
-        switch (m_scheduledRedirection->type) {
-            case ScheduledRedirection::locationChange:
-            case ScheduledRedirection::redirection:
-                clientRedirectCancelledOrFinished(m_cancellingWithLoadInProgress);
-                return;
-            case ScheduledRedirection::formSubmission:
-                // FIXME: It would make sense to report form submissions as client redirects too.
-                // But we didn't do that in the past when form submission used a separate delay
-                // mechanism, so doing it will be a behavior change.
-                return;
-            case ScheduledRedirection::historyNavigation:
-                // Don't report history navigations.
-                return;
-        }
-        ASSERT_NOT_REACHED();
-    }
+    OwnPtr<ScheduledRedirection> redirection(m_scheduledRedirection.release());
+    if (redirection && redirection->toldClient)
+        clientRedirectCancelledOrFinished(m_cancellingWithLoadInProgress);
 }
 
 void FrameLoader::completed()
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index 26206e6..f66e7d2 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -35,6 +35,7 @@
 #include "ResourceRequest.h"
 #include "ThreadableLoader.h"
 #include "Timer.h"
+#include <wtf/Forward.h>
 
 namespace WebCore {
 
@@ -485,7 +486,7 @@ namespace WebCore {
         bool shouldReloadToHandleUnreachableURL(DocumentLoader*);
         void handleUnimplementablePolicy(const ResourceError&);
 
-        void scheduleRedirection(ScheduledRedirection*);
+        void scheduleRedirection(PassOwnPtr<ScheduledRedirection>);
         void startRedirectionTimer();
         void stopRedirectionTimer();
 
@@ -545,6 +546,8 @@ namespace WebCore {
 
         void saveScrollPositionAndViewStateToItem(HistoryItem*);
 
+        bool allChildrenAreComplete() const; // immediate children, not all descendants
+
         Frame* m_frame;
         FrameLoaderClient* m_client;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list