Title: [113938] trunk/Source/WebCore
Revision
113938
Author
[email protected]
Date
2012-04-11 20:06:24 -0700 (Wed, 11 Apr 2012)

Log Message

[BlackBerry] There shouldn't be two or more Accept-Language in platformRequest's headerList.
https://bugs.webkit.org/show_bug.cgi?id=83670

FrameLoaderClientBlackBerry::dispatchWillSendRequest and NetworkManager::startJob will call
ResourceRequest::initializePlatformRequest. Accept-Language is added two times.
We should avoid the second adding to improve performance.

Patch by Jason Liu <[email protected]> on 2012-04-11
Reviewed by Rob Buis.

No new tests. Refactor.

* platform/network/blackberry/ResourceRequestBlackBerry.cpp:
(WebCore::ResourceRequest::initializePlatformRequest):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113937 => 113938)


--- trunk/Source/WebCore/ChangeLog	2012-04-12 02:10:26 UTC (rev 113937)
+++ trunk/Source/WebCore/ChangeLog	2012-04-12 03:06:24 UTC (rev 113938)
@@ -1,3 +1,19 @@
+2012-04-11  Jason Liu  <[email protected]>
+
+        [BlackBerry] There shouldn't be two or more Accept-Language in platformRequest's headerList.
+        https://bugs.webkit.org/show_bug.cgi?id=83670
+
+        FrameLoaderClientBlackBerry::dispatchWillSendRequest and NetworkManager::startJob will call
+        ResourceRequest::initializePlatformRequest. Accept-Language is added two times.
+        We should avoid the second adding to improve performance.
+
+        Reviewed by Rob Buis.
+
+        No new tests. Refactor.
+
+        * platform/network/blackberry/ResourceRequestBlackBerry.cpp:
+        (WebCore::ResourceRequest::initializePlatformRequest):
+
 2012-04-11  Jonathan Dong  <[email protected]>
 
         [BlackBerry] MMRPlayer will hang webkit thread when retrieving media metadata

Modified: trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp (113937 => 113938)


--- trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp	2012-04-12 02:10:26 UTC (rev 113937)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp	2012-04-12 03:06:24 UTC (rev 113938)
@@ -212,15 +212,17 @@
                 platformRequest.addHeader("Cookie", cookiePairs.containsOnlyLatin1() ? cookiePairs.latin1().data() : cookiePairs.utf8().data());
         }
 
-        // Locale has the form "en-US". Construct accept language like "en-US, en;q=0.8".
-        std::string locale = BlackBerry::Platform::Client::get()->getLocale();
-        // POSIX locale has '_' instead of '-'.
-        // Replace to conform to HTTP spec.
-        size_t underscore = locale.find('_');
-        if (underscore != std::string::npos)
-            locale.replace(underscore, 1, "-");
-        std::string acceptLanguage = locale + ", " + locale.substr(0, 2) + ";q=0.8";
-        platformRequest.addHeader("Accept-Language", acceptLanguage.c_str());
+        if (!httpHeaderFields().contains("Accept-Language")) {
+            // Locale has the form "en-US". Construct accept language like "en-US, en;q=0.8".
+            std::string locale = BlackBerry::Platform::Client::get()->getLocale();
+            // POSIX locale has '_' instead of '-'.
+            // Replace to conform to HTTP spec.
+            size_t underscore = locale.find('_');
+            if (underscore != std::string::npos)
+                locale.replace(underscore, 1, "-");
+            std::string acceptLanguage = locale + ", " + locale.substr(0, 2) + ";q=0.8";
+            platformRequest.addHeader("Accept-Language", acceptLanguage.c_str());
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to