Add State to PageLoadState
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Nov 2013 22:43:06 +0000 (22:43 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Nov 2013 22:43:06 +0000 (22:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124538

Reviewed by Tim Horton.

* UIProcess/PageLoadState.cpp:
(WebKit::PageLoadState::PageLoadState):
(WebKit::PageLoadState::didStartProvisionalLoad):
(WebKit::PageLoadState::didReceiveServerRedirectForProvisionalLoad):
(WebKit::PageLoadState::didFailProvisionalLoad):
(WebKit::PageLoadState::didCommitLoad):
(WebKit::PageLoadState::didFinishLoad):
(WebKit::PageLoadState::didSameDocumentNavigation):
* UIProcess/PageLoadState.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159458 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/PageLoadState.cpp
Source/WebKit2/UIProcess/PageLoadState.h

index 750150c..113a04c 100644 (file)
@@ -1,5 +1,22 @@
 2013-11-18  Anders Carlsson  <andersca@apple.com>
 
+        Add State to PageLoadState
+        https://bugs.webkit.org/show_bug.cgi?id=124538
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/PageLoadState.cpp:
+        (WebKit::PageLoadState::PageLoadState):
+        (WebKit::PageLoadState::didStartProvisionalLoad):
+        (WebKit::PageLoadState::didReceiveServerRedirectForProvisionalLoad):
+        (WebKit::PageLoadState::didFailProvisionalLoad):
+        (WebKit::PageLoadState::didCommitLoad):
+        (WebKit::PageLoadState::didFinishLoad):
+        (WebKit::PageLoadState::didSameDocumentNavigation):
+        * UIProcess/PageLoadState.h:
+
+2013-11-18  Anders Carlsson  <andersca@apple.com>
+
         The PageLoadState object should keep track of the current URL
         https://bugs.webkit.org/show_bug.cgi?id=124536
 
index 159ac37..52d3663 100644 (file)
@@ -29,6 +29,7 @@
 namespace WebKit {
 
 PageLoadState::PageLoadState()
+    : m_state(State::Finished)
 {
 }
 
@@ -55,6 +56,7 @@ void PageLoadState::didStartProvisionalLoad(const String& url, const String& unr
 {
     ASSERT(m_provisionalURL.isEmpty());
 
+    m_state = State::Provisional;
     m_provisionalURL = url;
 
     // FIXME: Do something with the unreachable URL.
@@ -62,26 +64,36 @@ void PageLoadState::didStartProvisionalLoad(const String& url, const String& unr
 
 void PageLoadState::didReceiveServerRedirectForProvisionalLoad(const String& url)
 {
+    ASSERT(m_state == State::Provisional);
+
     m_provisionalURL = url;
 }
 
 void PageLoadState::didFailProvisionalLoad()
 {
+    ASSERT(m_state == State::Provisional);
+
+    m_state = State::Finished;
     m_provisionalURL = String();
 }
 
 void PageLoadState::didCommitLoad()
 {
+    ASSERT(m_state == State::Provisional);
     ASSERT(!m_provisionalURL.isEmpty());
 
+    m_state = State::Committed;
     m_url = m_provisionalURL;
     m_provisionalURL = String();
 }
 
 void PageLoadState::didFinishLoad()
 {
+    ASSERT(m_state == State::Committed);
     ASSERT(m_provisionalURL.isEmpty());
     ASSERT(!m_url.isEmpty());
+
+    m_state = State::Finished;
 }
 
 void PageLoadState::didFailLoad()
@@ -92,7 +104,6 @@ void PageLoadState::didFailLoad()
 
 void PageLoadState::didSameDocumentNavigation(const String& url)
 {
-    ASSERT(m_provisionalURL.isEmpty());
     ASSERT(!m_url.isEmpty());
 
     m_url = url;
index 70e9720..feee269 100644 (file)
@@ -35,6 +35,12 @@ public:
     PageLoadState();
     ~PageLoadState();
 
+    enum class State {
+        Provisional,
+        Committed,
+        Finished
+    };
+
     const String& pendingAPIRequestURL() const;
     void setPendingAPIRequestURL(const String&);
     void clearPendingAPIRequestURL();
@@ -50,6 +56,8 @@ public:
     void didSameDocumentNavigation(const String& url);
 
 private:
+    State m_state;
+
     String m_pendingAPIRequestURL;
 
     String m_provisionalURL;