Permalink
Browse files

dns-prefetch: whitelist Safari 6+

Fixes #1348
  • Loading branch information...
jeffkaufman authored and crowell committed Jul 11, 2016
1 parent d462e41 commit d05a8b6e75eb5fc7ee7105abedf6189af7308896
@@ -207,11 +207,10 @@ const char* kWebpAnimatedBlacklist[] = {
"*CriOS/31.*",
};

// TODO(rahulbansal): We haven't added Safari here since it supports dns
// prefetch only from 5.0.1 which causes the wildcard to be a bit messy.
const char* kInsertDnsPrefetchWhitelist[] = {
"*Chrome/*",
"*Firefox/*",
"*Safari/*",
// Plus IE, see code below.
"*Wget*",
// The following user agents are used only for internal testing
@@ -222,6 +221,15 @@ const char* kInsertDnsPrefetchBlacklist[] = {
"*Firefox/1.*",
"*Firefox/2.*",
"*Firefox/3.*",
// Safari indicates version with a separate Version/N.N.N token that appears
// somewhere before the Safari/ token. This only started with version 3, but
// versions before 3 are 10+ years old at this point and won't run on any
// supported OS.
"*Version/3.*Safari/*",
"*Version/4.*Safari/*",
// 5.0.1+ actually did support it, but that's long obsolete, so don't bother
// contorting the list to include it.
"*Version/5.*Safari/*",
"*MSIE 5.*",
"*MSIE 6.*",
"*MSIE 7.*",
@@ -438,6 +438,10 @@ TEST_F(UserAgentMatcherTest, SupportsDnsPrefetch) {
kIe9UserAgent));
EXPECT_TRUE(user_agent_matcher_->SupportsDnsPrefetch(
kFirefox5UserAgent));
EXPECT_TRUE(user_agent_matcher_->SupportsDnsPrefetch(
kSafari6UserAgent));
EXPECT_TRUE(user_agent_matcher_->SupportsDnsPrefetch(
kSafari9UserAgent));
for (int i = 0; i < kIe11UserAgentsArraySize; ++i) {
EXPECT_TRUE(user_agent_matcher_->SupportsDnsPrefetch(
kIe11UserAgents[i]));
@@ -277,6 +277,12 @@ const char UserAgentMatcherTestBase::kRoverUserAgent[] =
const char UserAgentMatcherTestBase::kSafariUserAgent[] =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.51.22 "
"(KHTML, like Gecko) Version/5.1.1 Safari/534.51.22";
const char UserAgentMatcherTestBase::kSafari6UserAgent[] =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.25 "
"(KHTML, like Gecko) Version/6.0 Safari/536.25";
const char UserAgentMatcherTestBase::kSafari9UserAgent[] =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 "
"(KHTML, like Gecko) Version/9.1.1 Safari/601.6.17";
const char UserAgentMatcherTestBase::kSAGEMMobileUserAgent[] =
"SAGEM-my202C/Orange1.0 UP.Browser/5.0.5.6 (GUI)";
const char UserAgentMatcherTestBase::kSAGEMUserAgent[] =
@@ -123,6 +123,8 @@ class UserAgentMatcherTestBase : public testing::Test {
static const char kPSPUserAgent[];
static const char kRoverUserAgent[];
static const char kSafariUserAgent[];
static const char kSafari6UserAgent[];
static const char kSafari9UserAgent[];
static const char kSAGEMMobileUserAgent[];
static const char kSAGEMUserAgent[];
static const char kSAMSUNGMobileUserAgent[];

0 comments on commit d05a8b6

Please sign in to comment.