Title: [151793] trunk/Source/WebCore
Revision
151793
Author
[email protected]
Date
2013-06-20 13:06:02 -0700 (Thu, 20 Jun 2013)

Log Message

        [Mac] Downloaded file name encoding is incorrect when download link opens in a new window
        https://bugs.webkit.org/show_bug.cgi?id=117818
        <rdar://problem/14212635>

        Reviewed by Brady Eidson.

        No tests added. The machinery we have for logging downloaded file name is very
        far from being able to work in a secondary window.

        * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest):
        Made a targeted fix - don't update encoding fallback array if we already have one,
        there is no chance for it to be more correct. In this case, it's incorrect because
        it comes from a new blank window, instead of original referer.
        We have a lot of code in addExtraFieldsToRequest() to struggle with this, and we have
        a FIXME to try not calling it from policy delegate.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151792 => 151793)


--- trunk/Source/WebCore/ChangeLog	2013-06-20 19:44:39 UTC (rev 151792)
+++ trunk/Source/WebCore/ChangeLog	2013-06-20 20:06:02 UTC (rev 151793)
@@ -1,3 +1,21 @@
+2013-06-20  Alexey Proskuryakov  <[email protected]>
+
+        [Mac] Downloaded file name encoding is incorrect when download link opens in a new window
+        https://bugs.webkit.org/show_bug.cgi?id=117818
+        <rdar://problem/14212635>
+
+        Reviewed by Brady Eidson.
+
+        No tests added. The machinery we have for logging downloaded file name is very
+        far from being able to work in a secondary window.
+
+        * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest):
+        Made a targeted fix - don't update encoding fallback array if we already have one,
+        there is no chance for it to be more correct. In this case, it's incorrect because
+        it comes from a new blank window, instead of original referer.
+        We have a lot of code in addExtraFieldsToRequest() to struggle with this, and we have
+        a FIXME to try not calling it from policy delegate.
+
 2013-06-18  Robert Hogan  <[email protected]>
 
         REGRESSION (r151451): Text not vertically centered correctly on icloud.com

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (151792 => 151793)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2013-06-20 19:44:39 UTC (rev 151792)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2013-06-20 20:06:02 UTC (rev 151793)
@@ -2500,9 +2500,12 @@
     // Make sure we send the Origin header.
     addHTTPOriginIfNeeded(request, String());
 
-    // Always try UTF-8. If that fails, try frame encoding (if any) and then the default.
-    Settings* settings = m_frame->settings();
-    request.setResponseContentDispositionEncodingFallbackArray("UTF-8", m_frame->document()->encoding(), settings ? settings->defaultTextEncodingName() : String());
+    // Only set fallback array if it's still empty (later attempts may be incorrect, see bug 117818).
+    if (request.responseContentDispositionEncodingFallbackArray().isEmpty()) {
+        // Always try UTF-8. If that fails, try frame encoding (if any) and then the default.
+        Settings* settings = m_frame->settings();
+        request.setResponseContentDispositionEncodingFallbackArray("UTF-8", m_frame->document()->encoding(), settings ? settings->defaultTextEncodingName() : String());
+    }
 }
 
 void FrameLoader::addHTTPOriginIfNeeded(ResourceRequest& request, const String& origin)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to