Modified: trunk/Source/WebCore/ChangeLog (89311 => 89312)
--- trunk/Source/WebCore/ChangeLog 2011-06-20 23:29:57 UTC (rev 89311)
+++ trunk/Source/WebCore/ChangeLog 2011-06-20 23:32:54 UTC (rev 89312)
@@ -1,3 +1,27 @@
+2011-06-20 Adam Barth <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Remove FrameLoader::m_workingURL
+ https://bugs.webkit.org/show_bug.cgi?id=63021
+
+ FrameLoader shouldn't keep the working URL in separate state. It's
+ just a function of other state. m_workingURL exists only to create
+ bugs and confusion.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::documentURL):
+ * loader/DocumentLoader.h:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::stopLoading):
+ (WebCore::FrameLoader::didOpenURL):
+ (WebCore::FrameLoader::receivedFirstData):
+ (WebCore::FrameLoader::willSetEncoding):
+ (WebCore::FrameLoader::commitProvisionalLoad):
+ (WebCore::FrameLoader::open):
+ (WebCore::FrameLoader::finishedLoadingDocument):
+ * loader/FrameLoader.h:
+
2011-06-20 Kenneth Russell <[email protected]>
Unreviewed.
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (89311 => 89312)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2011-06-20 23:29:57 UTC (rev 89311)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2011-06-20 23:32:54 UTC (rev 89312)
@@ -733,6 +733,18 @@
return m_response.url();
}
+KURL DocumentLoader::documentURL() const
+{
+ KURL url = ""
+ if (url.isEmpty())
+ url = ""
+ if (url.isEmpty())
+ url = ""
+ if (url.isEmpty())
+ url = ""
+ return url;
+}
+
const String& DocumentLoader::responseMIMEType() const
{
return m_response.mimeType();
Modified: trunk/Source/WebCore/loader/DocumentLoader.h (89311 => 89312)
--- trunk/Source/WebCore/loader/DocumentLoader.h 2011-06-20 23:29:57 UTC (rev 89311)
+++ trunk/Source/WebCore/loader/DocumentLoader.h 2011-06-20 23:32:54 UTC (rev 89312)
@@ -93,14 +93,18 @@
const SubstituteData& substituteData() const { return m_substituteData; }
+ // FIXME: This is the same as requestURL(). We should remove one of them.
const KURL& url() const;
const KURL& unreachableURL() const;
+ // The URL of the document resulting from this DocumentLoader.
+ KURL documentURL() const;
+
const KURL& originalURL() const;
const KURL& requestURL() const;
const KURL& responseURL() const;
const String& responseMIMEType() const;
-
+
void replaceRequestURLForSameDocumentNavigation(const KURL&);
bool isStopping() const { return m_isStopping; }
void stopLoading();
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (89311 => 89312)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2011-06-20 23:29:57 UTC (rev 89311)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2011-06-20 23:32:54 UTC (rev 89312)
@@ -196,6 +196,7 @@
, m_pageDismissalEventBeingDispatched(false)
, m_isComplete(false)
, m_isLoadingMainResource(false)
+ , m_hasReceivedFirstData(false)
, m_needsClear(false)
, m_checkTimer(this, &FrameLoader::checkTimerFired)
, m_shouldCallCheckCompleted(false)
@@ -418,9 +419,9 @@
finishedParsing();
m_frame->document()->setParsing(false);
}
-
- m_workingURL = KURL();
+ m_hasReceivedFirstData = true;
+
if (Document* doc = m_frame->document()) {
// FIXME: HTML5 doesn't tell us to set the state to complete when aborting, but we do anyway to match legacy behavior.
// http://www.w3.org/Bugs/Public/show_bug.cgi?id=10537
@@ -461,7 +462,7 @@
return true;
}
-bool FrameLoader::didOpenURL(const KURL& url)
+bool FrameLoader::didOpenURL()
{
if (m_frame->navigationScheduler()->redirectScheduledDuringLoad()) {
// A redirect was scheduled before the document was created.
@@ -485,9 +486,7 @@
window->setDefaultStatus(String());
}
}
- m_workingURL = url;
- if (m_workingURL.protocolInHTTPFamily() && !m_workingURL.host().isEmpty() && m_workingURL.path().isEmpty())
- m_workingURL.setPath("/");
+ m_hasReceivedFirstData = false;
started();
@@ -573,7 +572,13 @@
void FrameLoader::receivedFirstData()
{
- activeDocumentLoader()->writer()->begin(m_workingURL, false);
+ KURL workingURL = activeDocumentLoader()->documentURL();
+#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
+ if (m_archive)
+ workingURL = m_archive->mainResource()->url();
+#endif
+
+ activeDocumentLoader()->writer()->begin(workingURL, false);
activeDocumentLoader()->writer()->setDocumentWasLoadedAsPartOfNavigation();
dispatchDidCommitLoad();
@@ -586,17 +591,17 @@
m_client->dispatchDidReceiveTitle(ptitle);
}
- m_workingURL = KURL();
+ m_hasReceivedFirstData = true;
- double delay;
- String url;
if (!m_documentLoader)
return;
if (m_frame->document()->isViewSource())
return;
+
+ double delay;
+ String url;
if (!parseHTTPRefresh(m_documentLoader->response().httpHeaderField("Refresh"), false, delay, url))
return;
-
if (url.isEmpty())
url = ""
else
@@ -972,7 +977,7 @@
void FrameLoader::willSetEncoding()
{
- if (!m_workingURL.isEmpty())
+ if (!m_hasReceivedFirstData)
receivedFirstData();
}
@@ -1770,18 +1775,9 @@
m_client->dispatchDidReceiveTitle(title);
checkCompleted();
- } else {
- KURL url = ""
- if (url.isEmpty())
- url = ""
- if (url.isEmpty())
- url = ""
- if (url.isEmpty())
- url = ""
+ } else
+ didOpenURL();
- didOpenURL(url);
- }
-
LOG(Loading, "WebCoreLoading %s: Finished committing provisional load to URL %s", m_frame->tree()->uniqueName().string().utf8().data(),
m_frame->document() ? m_frame->document()->url().string().utf8().data() : "");
@@ -2010,11 +2006,12 @@
KURL url = ""
+ // FIXME: I suspect this block of code doesn't do anything.
if (url.protocolInHTTPFamily() && !url.host().isEmpty() && url.path().isEmpty())
url.setPath("/");
-
- m_workingURL = url;
+ m_hasReceivedFirstData = false;
+
started();
clear(true, true, cachedFrame.isMainFrame());
@@ -2110,7 +2107,7 @@
loader->writer()->setMIMEType(mainResource->mimeType());
closeURL();
- didOpenURL(mainResource->url());
+ didOpenURL();
ASSERT(m_frame->document());
String userChosenEncoding = documentLoader()->overrideEncoding();
Modified: trunk/Source/WebCore/loader/FrameLoader.h (89311 => 89312)
--- trunk/Source/WebCore/loader/FrameLoader.h 2011-06-20 23:29:57 UTC (rev 89311)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2011-06-20 23:32:54 UTC (rev 89312)
@@ -387,7 +387,7 @@
void provisionalLoadStarted();
- bool didOpenURL(const KURL&);
+ bool didOpenURL();
void scheduleCheckCompleted();
void scheduleCheckLoadComplete();
@@ -436,7 +436,7 @@
RefPtr<SerializedScriptValue> m_pendingStateObject;
- KURL m_workingURL;
+ bool m_hasReceivedFirstData;
bool m_needsClear;