diff options
author | Zeno Albisser <zeno.albisser@theqtcompany.com> | 2014-12-05 15:04:29 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@theqtcompany.com> | 2014-12-09 10:49:28 +0100 |
commit | af6588f8d723931a298c995fa97259bb7f7deb55 (patch) | |
tree | 060ca707847ba1735f01af2372e0d5e494dc0366 /chromium/url | |
parent | 2fff84d821cc7b1c785f6404e0f8091333283e74 (diff) | |
download | qtwebengine-chromium-af6588f8d723931a298c995fa97259bb7f7deb55.tar.gz |
BASELINE: Update chromium to 40.0.2214.28 and ninja to 1.5.3.
Change-Id: I759465284fd64d59ad120219cbe257f7402c4181
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/url')
-rw-r--r-- | chromium/url/gurl.h | 5 | ||||
-rw-r--r-- | chromium/url/gurl_unittest.cc | 36 | ||||
-rw-r--r-- | chromium/url/third_party/mozilla/url_parse.cc | 18 | ||||
-rw-r--r-- | chromium/url/url_canon.h | 4 | ||||
-rw-r--r-- | chromium/url/url_canon_fileurl.cc | 2 | ||||
-rw-r--r-- | chromium/url/url_canon_icu.h | 8 | ||||
-rw-r--r-- | chromium/url/url_canon_icu_unittest.cc | 11 | ||||
-rw-r--r-- | chromium/url/url_canon_ip.cc | 8 | ||||
-rw-r--r-- | chromium/url/url_canon_pathurl.cc | 8 | ||||
-rw-r--r-- | chromium/url/url_canon_stdstring.h | 4 | ||||
-rw-r--r-- | chromium/url/url_canon_unittest.cc | 29 | ||||
-rw-r--r-- | chromium/url/url_parse_unittest.cc | 20 | ||||
-rw-r--r-- | chromium/url/url_util.cc | 2 | ||||
-rw-r--r-- | chromium/url/url_util_unittest.cc | 9 |
14 files changed, 77 insertions, 87 deletions
diff --git a/chromium/url/gurl.h b/chromium/url/gurl.h index cf5785a56c6..1d388cd130c 100644 --- a/chromium/url/gurl.h +++ b/chromium/url/gurl.h @@ -236,6 +236,11 @@ class URL_EXPORT GURL { (SchemeIsFileSystem() && inner_url() && inner_url()->SchemeIsSecure()); } + // Returns true if the scheme is "blob". + bool SchemeIsBlob() const { + return SchemeIs(url::kBlobScheme); + } + // The "content" of the URL is everything after the scheme (skipping the // scheme delimiting colon). It is an error to get the origin of an invalid // URL. The result will be an empty string. diff --git a/chromium/url/gurl_unittest.cc b/chromium/url/gurl_unittest.cc index 489b9d2bc36..3e945505fc6 100644 --- a/chromium/url/gurl_unittest.cc +++ b/chromium/url/gurl_unittest.cc @@ -2,18 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" #include "url/url_canon.h" #include "url/url_test_utils.h" -// Some implementations of base/basictypes.h may define ARRAYSIZE. -// If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro -// which is in our version of basictypes.h. -#ifndef ARRAYSIZE -#define ARRAYSIZE ARRAYSIZE_UNSAFE -#endif - namespace url { using test_utils::WStringToUTF16; @@ -232,7 +226,7 @@ TEST(GURLTest, IsValid) { "http:path", "://google.com", }; - for (size_t i = 0; i < ARRAYSIZE(valid_cases); i++) { + for (size_t i = 0; i < arraysize(valid_cases); i++) { EXPECT_TRUE(GURL(valid_cases[i]).is_valid()) << "Case: " << valid_cases[i]; } @@ -244,7 +238,7 @@ TEST(GURLTest, IsValid) { "http://google.com:12three45", "path", }; - for (size_t i = 0; i < ARRAYSIZE(invalid_cases); i++) { + for (size_t i = 0; i < arraysize(invalid_cases); i++) { EXPECT_FALSE(GURL(invalid_cases[i]).is_valid()) << "Case: " << invalid_cases[i]; } @@ -299,7 +293,7 @@ TEST(GURLTest, Resolve) { {"filesystem:http://www.google.com/type/", "../foo.html", true, "filesystem:http://www.google.com/type/foo.html"}, }; - for (size_t i = 0; i < ARRAYSIZE(resolve_cases); i++) { + for (size_t i = 0; i < arraysize(resolve_cases); i++) { // 8-bit code path. GURL input(resolve_cases[i].base); GURL output = input.Resolve(resolve_cases[i].relative); @@ -331,7 +325,7 @@ TEST(GURLTest, GetOrigin) { {"filesystem:http://www.google.com/temp/foo?q#b", "http://www.google.com/"}, {"filesystem:http://user:pass@google.com:21/blah#baz", "http://google.com:21/"}, }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { GURL url(cases[i].input); GURL origin = url.GetOrigin(); EXPECT_EQ(cases[i].expected, origin.spec()); @@ -350,7 +344,7 @@ TEST(GURLTest, GetAsReferrer) { {"http://:@www.google.com", "http://www.google.com/"}, {"http://www.google.com/temp/foo?q#b", "http://www.google.com/temp/foo?q"}, }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { GURL url(cases[i].input); GURL origin = url.GetAsReferrer(); EXPECT_EQ(cases[i].expected, origin.spec()); @@ -369,7 +363,7 @@ TEST(GURLTest, GetWithEmptyPath) { {"filesystem:file:///temporary/bar.html?baz=22", "filesystem:file:///temporary/"}, }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { GURL url(cases[i].input); GURL empty_path = url.GetWithEmptyPath(); EXPECT_EQ(cases[i].expected, empty_path.spec()); @@ -401,7 +395,7 @@ TEST(GURLTest, Replacements) { {"filesystem:http://www.google.com/foo/bar.html?foo#bar", NULL, NULL, NULL, NULL, NULL, "/", "", "", "filesystem:http://www.google.com/foo/"}, }; - for (size_t i = 0; i < ARRAYSIZE(replace_cases); i++) { + for (size_t i = 0; i < arraysize(replace_cases); i++) { const ReplaceCase& cur = replace_cases[i]; GURL url(cur.base); GURL::Replacements repl; @@ -458,7 +452,7 @@ TEST(GURLTest, PathForRequest) { {"filesystem:http://www.google.com/temporary/foo/bar.html?query", "/foo/bar.html?query", "/temporary"}, }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { GURL url(cases[i].input); std::string path_request = url.PathForRequest(); EXPECT_EQ(cases[i].expected, path_request); @@ -506,7 +500,7 @@ TEST(GURLTest, EffectiveIntPort) { {"filesystem:file:///t/foo", PORT_UNSPECIFIED}, }; - for (size_t i = 0; i < ARRAYSIZE(port_tests); i++) { + for (size_t i = 0; i < arraysize(port_tests); i++) { GURL url(port_tests[i].spec); EXPECT_EQ(port_tests[i].expected_int_port, url.EffectiveIntPort()); } @@ -527,7 +521,7 @@ TEST(GURLTest, IPAddress) { {"some random input!", false}, }; - for (size_t i = 0; i < ARRAYSIZE(ip_tests); i++) { + for (size_t i = 0; i < arraysize(ip_tests); i++) { GURL url(ip_tests[i].spec); EXPECT_EQ(ip_tests[i].expected_ip, url.HostIsIPAddress()); } @@ -552,7 +546,7 @@ TEST(GURLTest, HostNoBrackets) { {"http://]/", "]", "]"}, {"", "", ""}, }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { GURL url(cases[i].input); EXPECT_EQ(cases[i].expected_host, url.host()); EXPECT_EQ(cases[i].expected_plainhost, url.HostNoBrackets()); @@ -635,4 +629,10 @@ TEST(GURLTest, SchemeIsWSOrWSS) { EXPECT_FALSE(GURL("http://bar/").SchemeIsWSOrWSS()); } +TEST(GURLTest, SchemeIsBlob) { + EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob()); + EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob()); + EXPECT_FALSE(GURL("http://bar/").SchemeIsBlob()); +} + } // namespace url diff --git a/chromium/url/third_party/mozilla/url_parse.cc b/chromium/url/third_party/mozilla/url_parse.cc index 62567969a65..ba842b87b5d 100644 --- a/chromium/url/third_party/mozilla/url_parse.cc +++ b/chromium/url/third_party/mozilla/url_parse.cc @@ -621,23 +621,13 @@ void DoExtractFileName(const CHAR* spec, return; } - // Search backwards for a parameter, which is a normally unused field in a - // URL delimited by a semicolon. We parse the parameter as part of the - // path, but here, we don't want to count it. The last semicolon is the - // parameter. The path should start with a slash, so we don't need to check - // the first one. + // Extract the filename range from the path which is between + // the last slash and the following semicolon. int file_end = path.end(); - for (int i = path.end() - 1; i > path.begin; i--) { + for (int i = path.end() - 1; i >= path.begin; i--) { if (spec[i] == ';') { file_end = i; - break; - } - } - - // Now search backwards from the filename end to the previous slash - // to find the beginning of the filename. - for (int i = file_end - 1; i >= path.begin; i--) { - if (IsURLSlash(spec[i])) { + } else if (IsURLSlash(spec[i])) { // File name is everything following this character to the end *file_name = MakeRange(i + 1, file_end); return; diff --git a/chromium/url/url_canon.h b/chromium/url/url_canon.h index 624eeaf4710..3b9f906c700 100644 --- a/chromium/url/url_canon.h +++ b/chromium/url/url_canon.h @@ -41,13 +41,13 @@ class CanonOutputT { // Accessor for returning a character at a given position. The input offset // must be in the valid range. - inline char at(int offset) const { + inline T at(int offset) const { return buffer_[offset]; } // Sets the character at the given position. The given position MUST be less // than the length(). - inline void set(int offset, int ch) { + inline void set(int offset, T ch) { buffer_[offset] = ch; } diff --git a/chromium/url/url_canon_fileurl.cc b/chromium/url/url_canon_fileurl.cc index 1322be74e40..6191f8f9b2c 100644 --- a/chromium/url/url_canon_fileurl.cc +++ b/chromium/url/url_canon_fileurl.cc @@ -40,7 +40,7 @@ int FileDoDriveSpec(const CHAR* spec, int begin, int end, // Normalize Windows drive letters to uppercase if (spec[after_slashes] >= 'a' && spec[after_slashes] <= 'z') - output->push_back(spec[after_slashes] - 'a' + 'A'); + output->push_back(static_cast<char>(spec[after_slashes] - 'a' + 'A')); else output->push_back(static_cast<char>(spec[after_slashes])); diff --git a/chromium/url/url_canon_icu.h b/chromium/url/url_canon_icu.h index c9632897a19..80d79539074 100644 --- a/chromium/url/url_canon_icu.h +++ b/chromium/url/url_canon_icu.h @@ -24,11 +24,11 @@ class URL_EXPORT ICUCharsetConverter : public CharsetConverter { // be managed by the creator such that it is alive as long as this is. ICUCharsetConverter(UConverter* converter); - virtual ~ICUCharsetConverter(); + ~ICUCharsetConverter() override; - virtual void ConvertFromUTF16(const base::char16* input, - int input_len, - CanonOutput* output) OVERRIDE; + void ConvertFromUTF16(const base::char16* input, + int input_len, + CanonOutput* output) override; private: // The ICU converter, not owned by this class. diff --git a/chromium/url/url_canon_icu_unittest.cc b/chromium/url/url_canon_icu_unittest.cc index b28c30a3bc3..12b7ded9329 100644 --- a/chromium/url/url_canon_icu_unittest.cc +++ b/chromium/url/url_canon_icu_unittest.cc @@ -10,13 +10,6 @@ #include "url/url_canon_stdstring.h" #include "url/url_test_utils.h" -// Some implementations of base/basictypes.h may define ARRAYSIZE. -// If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro -// which is in our version of basictypes.h. -#ifndef ARRAYSIZE -#define ARRAYSIZE ARRAYSIZE_UNSAFE -#endif - namespace url { using test_utils::WStringToUTF16; @@ -61,7 +54,7 @@ TEST(URLCanonIcuTest, ICUCharsetConverter) { "hello\xa7\x41%26%231758%3B\xa6\x6eworld"}, }; - for (size_t i = 0; i < ARRAYSIZE(icu_cases); i++) { + for (size_t i = 0; i < arraysize(icu_cases); i++) { UConvScoper conv(icu_cases[i].encoding); ASSERT_TRUE(conv.converter() != NULL); ICUCharsetConverter converter(conv.converter()); @@ -118,7 +111,7 @@ TEST(URLCanonIcuTest, QueryWithConverter) { "?q=Chinese%26%2365319%3B"}, }; - for (size_t i = 0; i < ARRAYSIZE(query_cases); i++) { + for (size_t i = 0; i < arraysize(query_cases); i++) { Component out_comp; UConvScoper conv(query_cases[i].encoding); diff --git a/chromium/url/url_canon_ip.cc b/chromium/url/url_canon_ip.cc index 6ed8ba7203e..45f95de0d47 100644 --- a/chromium/url/url_canon_ip.cc +++ b/chromium/url/url_canon_ip.cc @@ -204,7 +204,15 @@ CanonHostInfo::Family DoIPv4AddressToNumber(const CHAR* spec, } // Next, consume the last component to fill in the remaining bytes. + // Work around a gcc 4.9 bug. crbug.com/392872 +#if ((__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif uint32 last_value = component_values[existing_components - 1]; +#if ((__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif for (int i = 3; i >= existing_components - 1; i--) { address[i] = static_cast<unsigned char>(last_value); last_value >>= 8; diff --git a/chromium/url/url_canon_pathurl.cc b/chromium/url/url_canon_pathurl.cc index e81a4afec6a..0d23ccb0e11 100644 --- a/chromium/url/url_canon_pathurl.cc +++ b/chromium/url/url_canon_pathurl.cc @@ -19,13 +19,13 @@ namespace { template<typename CHAR, typename UCHAR> bool DoCanonicalizePathComponent(const CHAR* source, const Component& component, - CHAR seperator, + char separator, CanonOutput* output, Component* new_component) { bool success = true; if (component.is_valid()) { - if (seperator) - output->push_back(seperator); + if (separator) + output->push_back(separator); // Copy the path using path URL's more lax escaping rules (think for // javascript:). We convert to UTF-8 and escape non-ASCII, but leave all // ASCII characters alone. This helps readability of JavaStript. @@ -64,7 +64,7 @@ bool DoCanonicalizePathURL(const URLComponentSource<CHAR>& source, // We allow path URLs to have the path, query and fragment components, but we // will canonicalize each of the via the weaker path URL rules. success &= DoCanonicalizePathComponent<CHAR, UCHAR>( - source.path, parsed.path, 0, output, &new_parsed->path); + source.path, parsed.path, '\0', output, &new_parsed->path); success &= DoCanonicalizePathComponent<CHAR, UCHAR>( source.query, parsed.query, '?', output, &new_parsed->query); success &= DoCanonicalizePathComponent<CHAR, UCHAR>( diff --git a/chromium/url/url_canon_stdstring.h b/chromium/url/url_canon_stdstring.h index e859fe2301d..c3d8ba141cc 100644 --- a/chromium/url/url_canon_stdstring.h +++ b/chromium/url/url_canon_stdstring.h @@ -36,12 +36,12 @@ namespace url { class URL_EXPORT StdStringCanonOutput : public CanonOutput { public: StdStringCanonOutput(std::string* str); - virtual ~StdStringCanonOutput(); + ~StdStringCanonOutput() override; // Must be called after writing has completed but before the string is used. void Complete(); - virtual void Resize(int sz) OVERRIDE; + void Resize(int sz) override; protected: std::string* str_; diff --git a/chromium/url/url_canon_unittest.cc b/chromium/url/url_canon_unittest.cc index 469e8a0a273..3ab87100d82 100644 --- a/chromium/url/url_canon_unittest.cc +++ b/chromium/url/url_canon_unittest.cc @@ -12,13 +12,6 @@ #include "url/url_parse.h" #include "url/url_test_utils.h" -// Some implementations of base/basictypes.h may define ARRAYSIZE. -// If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro -// which is in our version of basictypes.h. -#ifndef ARRAYSIZE -#define ARRAYSIZE ARRAYSIZE_UNSAFE -#endif - namespace url { using test_utils::WStringToUTF16; @@ -123,7 +116,7 @@ TEST(URLCanonTest, DoAppendUTF8) { {0x10FFFF, "\xF4\x8F\xBF\xBF"}, }; std::string out_str; - for (size_t i = 0; i < ARRAYSIZE(utf_cases); i++) { + for (size_t i = 0; i < arraysize(utf_cases); i++) { out_str.clear(); StdStringCanonOutput output(&out_str); AppendUTF8Value(utf_cases[i].input, &output); @@ -182,7 +175,7 @@ TEST(URLCanonTest, UTF) { }; std::string out_str; - for (size_t i = 0; i < ARRAYSIZE(utf_cases); i++) { + for (size_t i = 0; i < arraysize(utf_cases); i++) { if (utf_cases[i].input8) { out_str.clear(); StdStringCanonOutput output(&out_str); @@ -899,7 +892,7 @@ TEST(URLCanonTest, UserInfo) { {"ftp://me\\mydomain:pass@foo.com/", "", Component(0, -1), Component(0, -1), true}, }; - for (size_t i = 0; i < ARRAYSIZE(user_info_cases); i++) { + for (size_t i = 0; i < arraysize(user_info_cases); i++) { int url_len = static_cast<int>(strlen(user_info_cases[i].input)); Parsed parsed; ParseStandardURL(user_info_cases[i].input, url_len, &parsed); @@ -968,7 +961,7 @@ TEST(URLCanonTest, Port) { {"80", PORT_UNSPECIFIED, ":80", Component(1, 2), true}, }; - for (size_t i = 0; i < ARRAYSIZE(port_cases); i++) { + for (size_t i = 0; i < arraysize(port_cases); i++) { int url_len = static_cast<int>(strlen(port_cases[i].input)); Component in_comp(0, url_len); Component out_comp; @@ -1152,7 +1145,7 @@ TEST(URLCanonTest, Query) { {"q=\"asdf\"", L"q=\"asdf\"", "?q=%22asdf%22"}, }; - for (size_t i = 0; i < ARRAYSIZE(query_cases); i++) { + for (size_t i = 0; i < arraysize(query_cases); i++) { Component out_comp; if (query_cases[i].input8) { @@ -1309,7 +1302,7 @@ TEST(URLCanonTest, CanonicalizeStandardURL) { {"wss://foo:815/", "wss://foo:815/", true}, }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); Parsed parsed; ParseStandardURL(cases[i].input, url_len, &parsed); @@ -1648,7 +1641,7 @@ TEST(URLCanonTest, CanonicalizeFileURL) { #endif // _WIN32 }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); Parsed parsed; ParseFileURL(cases[i].input, url_len, &parsed); @@ -1691,7 +1684,7 @@ TEST(URLCanonTest, CanonicalizeFileSystemURL) { {"filesystem:File:///temporary/Bob?qUery#reF", "filesystem:file:///temporary/Bob?qUery#reF", true}, }; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); Parsed parsed; ParseFileSystemURL(cases[i].input, url_len, &parsed); @@ -1726,7 +1719,7 @@ TEST(URLCanonTest, CanonicalizePathURL) { {":\":This /is interesting;?#", ":\":This /is interesting;?#"}, }; - for (size_t i = 0; i < ARRAYSIZE(path_cases); i++) { + for (size_t i = 0; i < arraysize(path_cases); i++) { int url_len = static_cast<int>(strlen(path_cases[i].input)); Parsed parsed; ParsePathURL(path_cases[i].input, url_len, true, &parsed); @@ -1780,7 +1773,7 @@ TEST(URLCanonTest, CanonicalizeMailtoURL) { Parsed parsed; Parsed out_parsed; - for (size_t i = 0; i < ARRAYSIZE(cases); i++) { + for (size_t i = 0; i < arraysize(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); if (i == 8) { // The 9th test case purposely has a '\0' in it -- don't count it @@ -2043,7 +2036,7 @@ TEST(URLCanonTest, ResolveRelativeURL) { {"about:blank", false, false, "content://content.Provider/", true, false, true, ""}, }; - for (size_t i = 0; i < ARRAYSIZE(rel_cases); i++) { + for (size_t i = 0; i < arraysize(rel_cases); i++) { const RelativeCase& cur_case = rel_cases[i]; Parsed parsed; diff --git a/chromium/url/url_parse_unittest.cc b/chromium/url/url_parse_unittest.cc index a8b7f8541ef..71b24381de7 100644 --- a/chromium/url/url_parse_unittest.cc +++ b/chromium/url/url_parse_unittest.cc @@ -4,17 +4,10 @@ #include "url/url_parse.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/url_parse.h" -// Some implementations of base/basictypes.h may define ARRAYSIZE. -// If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro -// which is in our version of basictypes.h. -#ifndef ARRAYSIZE -#define ARRAYSIZE ARRAYSIZE_UNSAFE -#endif - // Interesting IE file:isms... // // file:/foo/bar file:///foo/bar @@ -201,7 +194,7 @@ TEST(URLParser, CountCharactersBefore) { {"file:///c:/foo", Parsed::HOST, true, 7}, {"file:///c:/foo", Parsed::PATH, true, 7}, }; - for (size_t i = 0; i < ARRAYSIZE(count_cases); i++) { + for (size_t i = 0; i < arraysize(count_cases); i++) { int length = static_cast<int>(strlen(count_cases[i].url)); // Simple test to distinguish file and standard URLs. @@ -505,11 +498,16 @@ TEST(URLParser, ExtractFileName) { {"http://www.google.com/foo/bar.html#ref", "bar.html"}, {"http://www.google.com/search/;param", ""}, {"http://www.google.com/foo/bar.html;param#ref", "bar.html"}, - {"http://www.google.com/foo/bar.html;foo;param#ref", "bar.html;foo"}, + {"http://www.google.com/foo/bar.html;foo;param#ref", "bar.html"}, {"http://www.google.com/foo/bar.html?query#ref", "bar.html"}, + {"http://www.google.com/foo;/bar.html", "bar.html"}, + {"http://www.google.com/foo;/", ""}, + {"http://www.google.com/foo;", "foo"}, + {"http://www.google.com/;", ""}, + {"http://www.google.com/foo;bar;html", "foo"}, }; - for (size_t i = 0; i < ARRAYSIZE(file_cases); i++) { + for (size_t i = 0; i < arraysize(file_cases); i++) { const char* url = file_cases[i].input; int len = static_cast<int>(strlen(url)); diff --git a/chromium/url/url_util.cc b/chromium/url/url_util.cc index 9f2ad2c6909..8ab889feff4 100644 --- a/chromium/url/url_util.cc +++ b/chromium/url/url_util.cc @@ -7,6 +7,7 @@ #include <string.h> #include <vector> +#include "base/debug/leak_annotations.h" #include "base/logging.h" #include "url/url_canon_internal.h" #include "url/url_file.h" @@ -383,6 +384,7 @@ void AddStandardScheme(const char* new_scheme) { // Dulicate the scheme into a new buffer and add it to the list of standard // schemes. This pointer will be leaked on shutdown. char* dup_scheme = new char[scheme_len + 1]; + ANNOTATE_LEAKING_OBJECT_PTR(dup_scheme); memcpy(dup_scheme, new_scheme, scheme_len + 1); InitStandardSchemes(); diff --git a/chromium/url/url_util_unittest.cc b/chromium/url/url_util_unittest.cc index f84b70d0cfa..aba44e46915 100644 --- a/chromium/url/url_util_unittest.cc +++ b/chromium/url/url_util_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/url_canon.h" #include "url/url_canon_stdstring.h" @@ -159,7 +160,7 @@ TEST(URLUtilTest, DecodeURLEscapeSequences) { {"%e4%bd%a0%e5%a5%bd", "\xe4\xbd\xa0\xe5\xa5\xbd"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(decode_cases); i++) { + for (size_t i = 0; i < arraysize(decode_cases); i++) { const char* input = decode_cases[i].input; RawCanonOutputT<base::char16> output; DecodeURLEscapeSequences(input, strlen(input), &output); @@ -209,7 +210,7 @@ TEST(URLUtilTest, TestEncodeURIComponent) { "pqrstuvwxyz%7B%7C%7D~%7F"}, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(encode_cases); i++) { + for (size_t i = 0; i < arraysize(encode_cases); i++) { const char* input = encode_cases[i].input; RawCanonOutputT<char> buffer; EncodeURIComponent(input, strlen(input), &buffer); @@ -233,7 +234,7 @@ TEST(URLUtilTest, TestResolveRelativeWithNonStandardBase) { // URL doesn't alter the authority section. {"scheme://Authority/", "../path", true, "scheme://Authority/path"}, // A non-standard hierarchical base is resolved with path URL - // canoncialization rules. + // canonicalization rules. {"data:/Blah:Blah/", "file.html", true, "data:/Blah:Blah/file.html"}, {"data:/Path/../part/part2", "file.html", true, "data:/Path/../part/file.html"}, @@ -274,7 +275,7 @@ TEST(URLUtilTest, TestResolveRelativeWithNonStandardBase) { "javascript:alert('foo#badfrag" }, }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resolve_non_standard_cases); i++) { + for (size_t i = 0; i < arraysize(resolve_non_standard_cases); i++) { const ResolveRelativeCase& test_data = resolve_non_standard_cases[i]; Parsed base_parsed; ParsePathURL(test_data.base, strlen(test_data.base), false, &base_parsed); |