Reviewed by Darin Adler. Prepared by Sheriff Bot. Rolling out r94902.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jan 2012 18:36:40 +0000 (18:36 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jan 2012 18:36:40 +0000 (18:36 +0000)
        http://trac.webkit.org/changeset/94902
        https://bugs.webkit.org/show_bug.cgi?id=75905

        Disagrees with general direction for WebKit, and makes
        refactoring harder (Requested by ap on #webkit).

        * loader/DocumentWriter.cpp:
        (WebCore::DocumentWriter::deprecatedFrameEncoding):
        * loader/DocumentWriter.h:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::addExtraFieldsToRequest):
        * platform/network/ResourceRequestBase.cpp:
        (WebCore::ResourceRequestBase::adopt):
        (WebCore::ResourceRequestBase::copyData):
        (WebCore::ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray):
        * platform/network/ResourceRequestBase.h:

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

Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentWriter.cpp
Source/WebCore/loader/DocumentWriter.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/platform/network/ResourceRequestBase.cpp
Source/WebCore/platform/network/ResourceRequestBase.h

index fc4136b..2cee2d7 100644 (file)
@@ -1,3 +1,23 @@
+2012-01-11  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler. Prepared by Sheriff Bot. Rolling out r94902.
+        http://trac.webkit.org/changeset/94902
+        https://bugs.webkit.org/show_bug.cgi?id=75905
+
+        Disagrees with general direction for WebKit, and makes
+        refactoring harder (Requested by ap on #webkit).
+
+        * loader/DocumentWriter.cpp:
+        (WebCore::DocumentWriter::deprecatedFrameEncoding):
+        * loader/DocumentWriter.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::addExtraFieldsToRequest):
+        * platform/network/ResourceRequestBase.cpp:
+        (WebCore::ResourceRequestBase::adopt):
+        (WebCore::ResourceRequestBase::copyData):
+        (WebCore::ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray):
+        * platform/network/ResourceRequestBase.h:
+
 2012-01-11  Eli Fidler  <efidler@rim.com>
 
         Fix OpenGL dependency in CMake build system
index ad8022d..be0dc04 100644 (file)
@@ -241,7 +241,6 @@ void DocumentWriter::setEncoding(const String& name, bool userChosen)
     m_encodingWasChosenByUser = userChosen;
 }
 
-#if PLATFORM(MAC) || PLATFORM(WIN)
 String DocumentWriter::deprecatedFrameEncoding() const
 {
     Document* document = m_frame->document();
@@ -256,7 +255,6 @@ String DocumentWriter::deprecatedFrameEncoding() const
 
     return String();
 }
-#endif
 
 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation()
 {
index 81896ed..f0a1f8c 100644 (file)
@@ -59,11 +59,10 @@ public:
 
     void setEncoding(const String& encoding, bool userChosen);
 
-#if PLATFORM(MAC) || PLATFORM(WIN)
-    // This code exists only to service a quirk in the Apple Mac and Windows ports.
-    // FIXME: We should remove this code once CFNetwork implements RFC 6266.
+    // FIXME: It's really unforunate to need to expose this piece of state.
+    // I suspect a better design is to disentangle user-provided encodings,
+    // default encodings, and the decoding we're currently using.
     String deprecatedFrameEncoding() const;
-#endif
 
     const String& mimeType() const { return m_mimeType; }
     void setMIMEType(const String& type) { m_mimeType = type; }
index 2943cdd..75656d8 100644 (file)
@@ -2585,13 +2585,10 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp
     // Make sure we send the Origin header.
     addHTTPOriginIfNeeded(request, String());
 
-#if PLATFORM(MAC) || PLATFORM(WIN)
-    // The Apple Mac and Windows ports have decided not to behave like other
-    // browsers and instead use a quirky fallback array.
-    // FIXME: We should remove this code once CFNetwork implements RFC 6266.
+    // Always try UTF-8. If that fails, try frame encoding (if any) and then the default.
+    // For a newly opened frame with an empty URL, encoding() should not be used, because this methods asks decoder, which uses ISO-8859-1.
     Settings* settings = m_frame->settings();
     request.setResponseContentDispositionEncodingFallbackArray("UTF-8", activeDocumentLoader()->writer()->deprecatedFrameEncoding(), settings ? settings->defaultTextEncodingName() : String());
-#endif
 }
 
 void FrameLoader::addHTTPOriginIfNeeded(ResourceRequest& request, const String& origin)
index c5bd308..e1e96c4 100644 (file)
@@ -57,7 +57,6 @@ PassOwnPtr<ResourceRequest> ResourceRequestBase::adopt(PassOwnPtr<CrossThreadRes
     request->updateResourceRequest();
     request->m_httpHeaderFields.adopt(data->m_httpHeaders.release());
 
-#if PLATFORM(MAC) || PLATFORM(WIN)
     size_t encodingCount = data->m_responseContentDispositionEncodingFallbackArray.size();
     if (encodingCount > 0) {
         String encoding1 = data->m_responseContentDispositionEncodingFallbackArray[0];
@@ -71,7 +70,6 @@ PassOwnPtr<ResourceRequest> ResourceRequestBase::adopt(PassOwnPtr<CrossThreadRes
         ASSERT(encodingCount <= 3);
         request->setResponseContentDispositionEncodingFallbackArray(encoding1, encoding2, encoding3);
     }
-#endif
     request->setHTTPBody(data->m_httpBody);
     request->setAllowCookies(data->m_allowCookies);
     request->doPlatformAdopt(data);
@@ -89,13 +87,11 @@ PassOwnPtr<CrossThreadResourceRequestData> ResourceRequestBase::copyData() const
     data->m_httpHeaders = httpHeaderFields().copyData();
     data->m_priority = priority();
 
-#if PLATFORM(MAC) || PLATFORM(WIN)
     data->m_responseContentDispositionEncodingFallbackArray.reserveInitialCapacity(m_responseContentDispositionEncodingFallbackArray.size());
     size_t encodingArraySize = m_responseContentDispositionEncodingFallbackArray.size();
     for (size_t index = 0; index < encodingArraySize; ++index) {
         data->m_responseContentDispositionEncodingFallbackArray.append(m_responseContentDispositionEncodingFallbackArray[index].isolatedCopy());
     }
-#endif
     if (m_httpBody)
         data->m_httpBody = m_httpBody->deepCopy();
     data->m_allowCookies = m_allowCookies;
@@ -275,7 +271,6 @@ void ResourceRequestBase::clearHTTPOrigin()
         m_platformRequestUpdated = false;
 }
 
-#if PLATFORM(MAC) || PLATFORM(WIN)
 void ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray(const String& encoding1, const String& encoding2, const String& encoding3)
 {
     updateResourceRequest(); 
@@ -291,7 +286,6 @@ void ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray(con
     if (url().protocolInHTTPFamily())
         m_platformRequestUpdated = false;
 }
-#endif
 
 FormData* ResourceRequestBase::httpBody() const 
 { 
index b5dc11e..0b154d6 100644 (file)
@@ -103,11 +103,7 @@ namespace WebCore {
         String httpAccept() const { return httpHeaderField("Accept"); }
         void setHTTPAccept(const String& httpAccept) { setHTTPHeaderField("Accept", httpAccept); }
 
-#if PLATFORM(MAC) || PLATFORM(WIN)
-        // FIXME: This state should either be moved to a CFNetwork-specific
-        // ResourceRequest or should be removed.
         void setResponseContentDispositionEncodingFallbackArray(const String& encoding1, const String& encoding2 = String(), const String& encoding3 = String());
-#endif
 
         FormData* httpBody() const;
         void setHTTPBody(PassRefPtr<FormData> httpBody);
@@ -178,11 +174,7 @@ namespace WebCore {
         KURL m_firstPartyForCookies;
         String m_httpMethod;
         HTTPHeaderMap m_httpHeaderFields;
-#if PLATFORM(MAC) || PLATFORM(WIN)
-        // FIXME: This state should either be moved to a CFNetwork-specific
-        // ResourceRequest or should be removed.
         Vector<String> m_responseContentDispositionEncodingFallbackArray;
-#endif
         RefPtr<FormData> m_httpBody;
         bool m_allowCookies : 1;
         mutable bool m_resourceRequestUpdated : 1;
@@ -215,9 +207,7 @@ namespace WebCore {
 
         String m_httpMethod;
         OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders;
-#if PLATFORM(MAC) || PLATFORM(WIN)
         Vector<String> m_responseContentDispositionEncodingFallbackArray;
-#endif
         RefPtr<FormData> m_httpBody;
         bool m_allowCookies;
         ResourceLoadPriority m_priority;