Title: [176382] trunk/Source/WebKit2
Revision
176382
Author
[email protected]
Date
2014-11-19 21:45:52 -0800 (Wed, 19 Nov 2014)

Log Message

Don't track sub-resources that are started after main frame progress has completed.
https://bugs.webkit.org/show_bug.cgi?id=138582

Patch by Yongjun Zhang <[email protected]> on 2014-11-19
Reviewed by Sam Weinig.

After main frame progress has finished, starting loading a sub-resource shouldn't affect
UI process's view of page loading status (i.e., the page has already completed loading
and the progress shouldn't change). To achive that, don't track the subresources that
are started after the main frame has finished, except for those triggered by user interaction.

* WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:  Notify WebPage that the main frame progress
    has started or finished.
(WebKit::WebProgressTrackerClient::progressStarted):
(WebKit::WebProgressTrackerClient::progressFinished):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::addResourceRequest): Don't track the resource request if it is initiated after
    the main frame is loaded and it is not triggered by user interaction.
(WebKit::WebPage::removeResourceRequest):
* WebProcess/WebPage/WebPage.h: Rename m_networkResourceRequestIdentifiers to m_trackedNetworkResourceRequestIdentifiers.
(WebKit::WebPage::setMainFrameProgressCompleted):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (176381 => 176382)


--- trunk/Source/WebKit2/ChangeLog	2014-11-20 05:35:49 UTC (rev 176381)
+++ trunk/Source/WebKit2/ChangeLog	2014-11-20 05:45:52 UTC (rev 176382)
@@ -1,3 +1,27 @@
+2014-11-19  Yongjun Zhang  <[email protected]>
+
+        Don't track sub-resources that are started after main frame progress has completed.
+        https://bugs.webkit.org/show_bug.cgi?id=138582
+
+        Reviewed by Sam Weinig.
+
+        After main frame progress has finished, starting loading a sub-resource shouldn't affect
+        UI process's view of page loading status (i.e., the page has already completed loading
+        and the progress shouldn't change). To achive that, don't track the subresources that
+        are started after the main frame has finished, except for those triggered by user interaction.
+
+        * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:  Notify WebPage that the main frame progress
+            has started or finished.
+        (WebKit::WebProgressTrackerClient::progressStarted):
+        (WebKit::WebProgressTrackerClient::progressFinished):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        (WebKit::WebPage::addResourceRequest): Don't track the resource request if it is initiated after
+            the main frame is loaded and it is not triggered by user interaction.
+        (WebKit::WebPage::removeResourceRequest):
+        * WebProcess/WebPage/WebPage.h: Rename m_networkResourceRequestIdentifiers to m_trackedNetworkResourceRequestIdentifiers.
+        (WebKit::WebPage::setMainFrameProgressCompleted):
+
 2014-11-19  Sun-woo Nam  <[email protected]>
 
         [EFL] Fix build failure since r176363.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp (176381 => 176382)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp	2014-11-20 05:35:49 UTC (rev 176381)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp	2014-11-20 05:45:52 UTC (rev 176382)
@@ -51,7 +51,8 @@
 {
     if (!originatingProgressFrame.isMainFrame())
         return;
-    
+
+    m_webPage.setMainFrameProgressCompleted(false);
     m_webPage.send(Messages::WebPageProxy::DidStartProgress());
 }
 
@@ -68,10 +69,12 @@
 {
     if (!originatingProgressFrame.isMainFrame())
         return;
-    
+
+    m_webPage.setMainFrameProgressCompleted(true);
+
     // Notify the bundle client.
     m_webPage.injectedBundleLoaderClient().didFinishProgress(&m_webPage);
-    
+
     m_webPage.send(Messages::WebPageProxy::DidFinishProgress());
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (176381 => 176382)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-11-20 05:35:49 UTC (rev 176381)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-11-20 05:45:52 UTC (rev 176382)
@@ -328,6 +328,7 @@
 #if ENABLE(WEBGL)
     , m_systemWebGLPolicy(WebGLAllowCreation)
 #endif
+    , m_mainFrameProgressCompleted(false)
 {
     ASSERT(m_pageID);
     // FIXME: This is a non-ideal location for this Setting and
@@ -3914,19 +3915,22 @@
     if (!request.url().protocolIsInHTTPFamily())
         return;
 
-    ASSERT(!m_networkResourceRequestIdentifiers.contains(identifier));
-    bool wasEmpty = m_networkResourceRequestIdentifiers.isEmpty();
-    m_networkResourceRequestIdentifiers.add(identifier);
+    if (m_mainFrameProgressCompleted && !ScriptController::processingUserGesture())
+        return;
+
+    ASSERT(!m_trackedNetworkResourceRequestIdentifiers.contains(identifier));
+    bool wasEmpty = m_trackedNetworkResourceRequestIdentifiers.isEmpty();
+    m_trackedNetworkResourceRequestIdentifiers.add(identifier);
     if (wasEmpty)
         send(Messages::WebPageProxy::SetNetworkRequestsInProgress(true));
 }
 
 void WebPage::removeResourceRequest(unsigned long identifier)
 {
-    if (!m_networkResourceRequestIdentifiers.remove(identifier))
+    if (!m_trackedNetworkResourceRequestIdentifiers.remove(identifier))
         return;
 
-    if (m_networkResourceRequestIdentifiers.isEmpty())
+    if (m_trackedNetworkResourceRequestIdentifiers.isEmpty())
         send(Messages::WebPageProxy::SetNetworkRequestsInProgress(false));
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (176381 => 176382)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-11-20 05:35:49 UTC (rev 176381)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-11-20 05:45:52 UTC (rev 176382)
@@ -852,6 +852,7 @@
 
     void didChangeScrollOffsetForFrame(WebCore::Frame*);
 
+    void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
@@ -1236,7 +1237,7 @@
 
     unsigned m_cachedPageCount;
 
-    HashSet<unsigned long> m_networkResourceRequestIdentifiers;
+    HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
 
     WebCore::IntSize m_minimumLayoutSize;
     bool m_autoSizingShouldExpandToViewHeight;
@@ -1311,6 +1312,8 @@
     WebCore::HitTestResult m_lastActionMenuHitTestResult;
     RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
 #endif
+
+    bool m_mainFrameProgressCompleted;
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to