diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-03 02:19:18 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-03 02:19:18 +0000 |
commit | a8217e2c510a15dc5664ad1b1168a8e0df4493aa (patch) | |
tree | 014fc1818464d4fb8433f1cf0c03c3c6fc17347c /chrome | |
parent | 3ac565d1b634e70715be51a51a7e9999084556f9 (diff) | |
download | chromium_src-a8217e2c510a15dc5664ad1b1168a8e0df4493aa.zip chromium_src-a8217e2c510a15dc5664ad1b1168a8e0df4493aa.tar.gz chromium_src-a8217e2c510a15dc5664ad1b1168a8e0df4493aa.tar.bz2 |
Revert 130248 - Add full support for filesystem URLs.
BUG=114484
TEST=existing filesystem tests don't break
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=128753
Review URL: https://chromiumcodereview.appspot.com/7811006
TBR=ericu@google.com
Review URL: https://chromiumcodereview.appspot.com/9950079
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
19 files changed, 55 insertions, 224 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 0efd16d..010617a 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -95,7 +95,6 @@ AutocompleteInput::AutocompleteInput(const string16& text, if (((type_ == UNKNOWN) || (type_ == REQUESTED_URL) || (type_ == URL)) && canonicalized_url.is_valid() && (!canonicalized_url.IsStandard() || canonicalized_url.SchemeIsFile() || - canonicalized_url.SchemeIsFileSystem() || !canonicalized_url.host().empty())) canonicalized_url_ = canonicalized_url; @@ -167,14 +166,6 @@ AutocompleteInput::Type AutocompleteInput::Parse( return URL; } - if (LowerCaseEqualsASCII(parsed_scheme, chrome::kFileSystemScheme)) { - // This could theoretically be a strange search, but let's check. - // If it's got an inner_url with a scheme, it's a URL, whether it's valid or - // not. - if (parts->inner_parsed() && parts->inner_parsed()->scheme.is_valid()) - return URL; - } - // If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it // well enough that we can fall through to the heuristics below. If it's // something else, we can just determine our action based on what we do with @@ -464,9 +455,6 @@ void AutocompleteInput::ParseForEmphasizeComponents( host->reset(); } } - } else if (LowerCaseEqualsASCII(scheme_str, chrome::kFileSystemScheme) && - parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) { - *host = parts.inner_parsed()->host; } } diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc index 9e45132..5e2050f 100644 --- a/chrome/browser/autocomplete/autocomplete_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_unittest.cc @@ -495,12 +495,6 @@ TEST_F(AutocompleteTest, InputType) { { ASCIIToUTF16("[2001:dB8::1]"), AutocompleteInput::URL }, { ASCIIToUTF16("192.168.0.256"), AutocompleteInput::QUERY }, { ASCIIToUTF16("[foo.com]"), AutocompleteInput::QUERY }, - { ASCIIToUTF16("filesystem:http://a.com/t/bar"), AutocompleteInput::URL }, - { ASCIIToUTF16("filesystem:http:foo"), AutocompleteInput::URL }, - { ASCIIToUTF16("filesystem:file://"), AutocompleteInput::URL }, - { ASCIIToUTF16("filesystem:http"), AutocompleteInput::URL }, - { ASCIIToUTF16("filesystem:"), AutocompleteInput::URL }, - { ASCIIToUTF16("ftp:"), AutocompleteInput::URL }, }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) { diff --git a/chrome/browser/browsing_data_database_helper.cc b/chrome/browser/browsing_data_database_helper.cc index 0bc331f..ccb5615 100644 --- a/chrome/browser/browsing_data_database_helper.cc +++ b/chrome/browser/browsing_data_database_helper.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,6 +44,12 @@ BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo( BrowsingDataDatabaseHelper::DatabaseInfo::~DatabaseInfo() {} +bool BrowsingDataDatabaseHelper::DatabaseInfo::IsFileSchemeData() { + return StartsWithASCII(origin_identifier, + std::string(chrome::kFileScheme), + true); +} + BrowsingDataDatabaseHelper::BrowsingDataDatabaseHelper(Profile* profile) : is_fetching_(false), tracker_(BrowserContext::GetDatabaseTracker(profile)) { diff --git a/chrome/browser/browsing_data_database_helper.h b/chrome/browser/browsing_data_database_helper.h index 3d974ee..2d3a853 100644 --- a/chrome/browser/browsing_data_database_helper.h +++ b/chrome/browser/browsing_data_database_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,6 +41,8 @@ class BrowsingDataDatabaseHelper base::Time last_modified); ~DatabaseInfo(); + bool IsFileSchemeData(); + std::string host; std::string database_name; std::string origin_identifier; diff --git a/chrome/browser/browsing_data_indexed_db_helper.h b/chrome/browser/browsing_data_indexed_db_helper.h index 5916b40..5d7177e50 100644 --- a/chrome/browser/browsing_data_indexed_db_helper.h +++ b/chrome/browser/browsing_data_indexed_db_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -38,6 +38,10 @@ class BrowsingDataIndexedDBHelper base::Time last_modified); ~IndexedDBInfo(); + bool IsFileSchemeData() { + return origin.SchemeIsFile(); + } + GURL origin; int64 size; base::Time last_modified; diff --git a/chrome/browser/browsing_data_local_storage_helper.h b/chrome/browser/browsing_data_local_storage_helper.h index 359f14c..7f88985 100644 --- a/chrome/browser/browsing_data_local_storage_helper.h +++ b/chrome/browser/browsing_data_local_storage_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -49,6 +49,10 @@ class BrowsingDataLocalStorageHelper base::Time last_modified); ~LocalStorageInfo(); + bool IsFileSchemeData() { + return protocol == chrome::kFileScheme; + } + std::string protocol; std::string host; unsigned short port; diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index 95d3723..c4853a9 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -160,7 +160,6 @@ bool IsSensitiveURL(const GURL& url) { bool HasWebRequestScheme(const GURL& url) { return (url.SchemeIs(chrome::kAboutScheme) || url.SchemeIs(chrome::kFileScheme) || - url.SchemeIs(chrome::kFileSystemScheme) || url.SchemeIs(chrome::kFtpScheme) || url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme) || diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc index b092a7c..485435d 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.cc +++ b/chrome/browser/extensions/extension_webnavigation_api.cc @@ -49,7 +49,6 @@ const char* kValidSchemes[] = { chrome::kFtpScheme, chrome::kJavaScriptScheme, chrome::kDataScheme, - chrome::kFileSystemScheme, }; // Returns the frame ID as it will be passed to the extension: diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc index b35acf0f..de779f4 100644 --- a/chrome/browser/history/url_index_private_data.cc +++ b/chrome/browser/history/url_index_private_data.cc @@ -912,7 +912,6 @@ void URLIndexPrivateData::InitializeSchemeWhitelist( whitelist->insert(std::string(chrome::kAboutScheme)); whitelist->insert(std::string(chrome::kChromeUIScheme)); whitelist->insert(std::string(chrome::kFileScheme)); - whitelist->insert(std::string(chrome::kFileSystemScheme)); whitelist->insert(std::string(chrome::kFtpScheme)); whitelist->insert(std::string(chrome::kHttpScheme)); whitelist->insert(std::string(chrome::kHttpsScheme)); diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index 4a4a883..2e025fc 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -412,13 +412,6 @@ std::string URLFixerUpper::SegmentURL(const std::string& text, url_parse::Component(0, static_cast<int>(scheme.length()))))) return scheme; - if (scheme == chrome::kFileSystemScheme) { - // Have the GURL parser do the heavy lifting for us. - url_parse::ParseFileSystemURL(text.data(), - static_cast<int>(text.length()), parts); - return scheme; - } - if (parts->scheme.is_valid()) { // Have the GURL parser do the heavy lifting for us. url_parse::ParseStandardURL(text.data(), static_cast<int>(text.length()), @@ -485,13 +478,6 @@ GURL URLFixerUpper::FixupURL(const std::string& text, if (scheme == chrome::kFileScheme) return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); - // We handle the filesystem scheme separately. - if (scheme == chrome::kFileSystemScheme) { - if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) - return GURL(text); - return GURL(); - } - // Parse and rebuild about: and chrome: URLs, except about:blank. bool chrome_url = !LowerCaseEqualsASCII(trimmed, chrome::kAboutBlankURL) && ((scheme == chrome::kAboutScheme) || (scheme == chrome::kChromeUIScheme)); diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 575e72a..4ff951f 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -135,7 +135,6 @@ void CreateShortcut( bool IsValidUrl(const GURL& url) { static const char* const kValidUrlSchemes[] = { chrome::kFileScheme, - chrome::kFileSystemScheme, chrome::kFtpScheme, chrome::kHttpScheme, chrome::kHttpsScheme, diff --git a/chrome/common/content_settings_pattern.cc b/chrome/common/content_settings_pattern.cc index 8feef19..8008cba 100644 --- a/chrome/common/content_settings_pattern.cc +++ b/chrome/common/content_settings_pattern.cc @@ -313,33 +313,28 @@ ContentSettingsPattern ContentSettingsPattern::FromURL( scoped_ptr<ContentSettingsPattern::BuilderInterface> builder( ContentSettingsPattern::CreateBuilder(false)); - const GURL* local_url = &url; - if (url.SchemeIsFileSystem() && url.inner_url()) { - local_url = url.inner_url(); - } - if (local_url->SchemeIsFile()) { - builder->WithScheme(local_url->scheme())->WithPath(local_url->path()); + if (url.SchemeIsFile()) { + builder->WithScheme(url.scheme())->WithPath(url.path()); } else { // Please keep the order of the ifs below as URLs with an IP as host can // also have a "http" scheme. - if (local_url->HostIsIPAddress()) { - builder->WithScheme(local_url->scheme())->WithHost(local_url->host()); - } else if (local_url->SchemeIs(chrome::kHttpScheme)) { - builder->WithSchemeWildcard()->WithDomainWildcard()->WithHost( - local_url->host()); - } else if (local_url->SchemeIs(chrome::kHttpsScheme)) { - builder->WithScheme(local_url->scheme())->WithDomainWildcard()->WithHost( - local_url->host()); + if (url.HostIsIPAddress()) { + builder->WithScheme(url.scheme())->WithHost(url.host()); + } else if (url.SchemeIs(chrome::kHttpScheme)) { + builder->WithSchemeWildcard()->WithDomainWildcard()->WithHost(url.host()); + } else if (url.SchemeIs(chrome::kHttpsScheme)) { + builder->WithScheme(url.scheme())->WithDomainWildcard()->WithHost( + url.host()); } else { // Unsupported scheme } - if (local_url->port().empty()) { - if (local_url->SchemeIs(chrome::kHttpsScheme)) + if (url.port().empty()) { + if (url.SchemeIs(chrome::kHttpsScheme)) builder->WithPort(GetDefaultPort(chrome::kHttpsScheme)); else builder->WithPortWildcard(); } else { - builder->WithPort(local_url->port()); + builder->WithPort(url.port()); } } return builder->Build(); @@ -351,18 +346,14 @@ ContentSettingsPattern ContentSettingsPattern::FromURLNoWildcard( scoped_ptr<ContentSettingsPattern::BuilderInterface> builder( ContentSettingsPattern::CreateBuilder(false)); - const GURL* local_url = &url; - if (url.SchemeIsFileSystem() && url.inner_url()) { - local_url = url.inner_url(); - } - if (local_url->SchemeIsFile()) { - builder->WithScheme(local_url->scheme())->WithPath(local_url->path()); + if (url.SchemeIsFile()) { + builder->WithScheme(url.scheme())->WithPath(url.path()); } else { - builder->WithScheme(local_url->scheme())->WithHost(local_url->host()); - if (local_url->port().empty()) { - builder->WithPort(GetDefaultPort(local_url->scheme())); + builder->WithScheme(url.scheme())->WithHost(url.host()); + if (url.port().empty()) { + builder->WithPort(GetDefaultPort(url.scheme())); } else { - builder->WithPort(local_url->port()); + builder->WithPort(url.port()); } } return builder->Build(); @@ -423,13 +414,8 @@ bool ContentSettingsPattern::Matches( if (!is_valid_) return false; - const GURL* local_url = &url; - if (url.SchemeIsFileSystem() && url.inner_url()) { - local_url = url.inner_url(); - } - // Match the scheme part. - const std::string scheme(local_url->scheme()); + const std::string scheme(url.scheme()); if (!parts_.is_scheme_wildcard && parts_.scheme != scheme) { return false; @@ -437,17 +423,11 @@ bool ContentSettingsPattern::Matches( // File URLs have no host. Matches if the pattern has the path wildcard set, // or if the path in the URL is identical to the one in the pattern. - // For filesystem:file URLs, the path used is the filesystem type, so all - // filesystem:file:///temporary/... are equivalent. - // TODO(markusheintz): Content settings should be defined for all files on - // a machine. Unless there is a good use case for supporting paths for file - // patterns, stop supporting path for file patterns. if (!parts_.is_scheme_wildcard && scheme == chrome::kFileScheme) - return parts_.is_path_wildcard || - parts_.path == std::string(local_url->path()); + return parts_.is_path_wildcard || parts_.path == std::string(url.path()); // Match the host part. - const std::string host(net::TrimEndingDot(local_url->host())); + const std::string host(net::TrimEndingDot(url.host())); if (!parts_.has_domain_wildcard) { if (parts_.host != host) return false; @@ -461,7 +441,7 @@ bool ContentSettingsPattern::Matches( return true; // Match the port part. - std::string port(local_url->port()); + std::string port(url.port()); // Use the default port if the port string is empty. GURL returns an empty // string if no port at all was specified or if the default port was diff --git a/chrome/common/content_settings_pattern_unittest.cc b/chrome/common/content_settings_pattern_unittest.cc index bd79338..f0eeca5 100644 --- a/chrome/common/content_settings_pattern_unittest.cc +++ b/chrome/common/content_settings_pattern_unittest.cc @@ -73,7 +73,6 @@ TEST(ContentSettingsPatternTest, FromURL) { pattern = ContentSettingsPattern::FromURL(GURL("https://www.google.com:443")); EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com"))); - EXPECT_TRUE(pattern.Matches(GURL("https://foo.www.google.com"))); EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com:443"))); EXPECT_FALSE(pattern.Matches(GURL("https://www.google.com:444"))); EXPECT_FALSE(pattern.Matches(GURL("http://www.google.com:443"))); @@ -90,49 +89,6 @@ TEST(ContentSettingsPatternTest, FromURL) { EXPECT_EQ("file:///foo/bar.html", pattern.ToString()); } -TEST(ContentSettingsPatternTest, FilesystemUrls) { - ContentSettingsPattern pattern = - ContentSettingsPattern::FromURL(GURL("http://www.google.com")); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:http://www.google.com/temporary/"))); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:http://foo.www.google.com/temporary/"))); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:http://www.google.com:80/temporary/"))); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:http://www.google.com:81/temporary/"))); - - pattern = ContentSettingsPattern::FromURL(GURL("https://www.google.com")); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:https://www.google.com/temporary/"))); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:https://www.google.com:443/temporary/"))); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:https://foo.www.google.com/temporary/"))); - EXPECT_FALSE(pattern.Matches( - GURL("filesystem:https://www.google.com:81/temporary/"))); - - // A pattern from a filesystem URLs is equivalent to a pattern from the inner - // URL of the filesystem URL. - ContentSettingsPattern pattern2 = ContentSettingsPattern::FromURL( - GURL("filesystem:https://www.google.com/temporary/")); - EXPECT_EQ(ContentSettingsPattern::IDENTITY, pattern.Compare(pattern2)); - - EXPECT_STREQ("https://[*.]www.google.com:443", pattern2.ToString().c_str()); - - pattern = - ContentSettingsPattern::FromURL( - GURL("filesystem:file:///temporary/foo/bar")); - EXPECT_TRUE(pattern.Matches(GURL("filesystem:file:///temporary/"))); - EXPECT_TRUE(pattern.Matches(GURL("filesystem:file:///temporary/test.txt"))); - EXPECT_TRUE(pattern.Matches(GURL("file:///temporary"))); - EXPECT_FALSE(pattern.Matches(GURL("file://foo/bar"))); - pattern2 = - ContentSettingsPattern::FromURL( - GURL("filesystem:file:///persistent/foo2/bar2")); - EXPECT_EQ(ContentSettingsPattern::IDENTITY, pattern.Compare(pattern2)); -} - TEST(ContentSettingsPatternTest, FromURLNoWildcard) { // If no port is specifed GURLs always use the default port for the schemes // HTTP and HTTPS. Hence a GURL always carries a port specification either @@ -158,21 +114,8 @@ TEST(ContentSettingsPatternTest, FromURLNoWildcard) { EXPECT_TRUE(pattern.Matches(GURL("https://www.example.com"))); EXPECT_FALSE(pattern.Matches(GURL("http://foo.www.example.com"))); - // Pattern for filesystem URLs - pattern = - ContentSettingsPattern::FromURLNoWildcard( - GURL("filesystem:http://www.google.com/temporary/")); - EXPECT_TRUE(pattern.IsValid()); - EXPECT_TRUE(pattern.Matches(GURL("http://www.google.com"))); - EXPECT_FALSE(pattern.Matches(GURL("http://foo.www.google.com"))); - EXPECT_TRUE(pattern.Matches( - GURL("filesystem:http://www.google.com/persistent/"))); - EXPECT_FALSE(pattern.Matches( - GURL("filesystem:https://www.google.com/persistent/"))); - EXPECT_FALSE(pattern.Matches( - GURL("filesystem:https://www.google.com:81/temporary/"))); - EXPECT_FALSE(pattern.Matches( - GURL("filesystem:https://foo.www.google.com/temporary/"))); + pattern = ContentSettingsPattern::FromURLNoWildcard( + GURL("https://www.example.com")); } TEST(ContentSettingsPatternTest, Wildcard) { diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index d6b52f7..ecf3d16 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -2477,27 +2477,16 @@ FileBrowserHandler* Extension::LoadFileBrowserHandler( return NULL; } StringToLowerASCII(&filter); - if (!StartsWithASCII(filter, - std::string(chrome::kFileSystemScheme) + ':', - true)) { - *error = ExtensionErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidURLPatternError, filter); - return NULL; - } - // The user inputs filesystem:*; we don't actually implement scheme - // wildcards in URLPattern, so transform to what will match correctly. - filter.replace(0, 11, "chrome-extension://*/"); - URLPattern pattern(URLPattern::SCHEME_EXTENSION); - pattern.set_partial_filesystem_support_hack(true); + URLPattern pattern(URLPattern::SCHEME_FILESYSTEM); if (pattern.Parse(filter) != URLPattern::PARSE_SUCCESS) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( errors::kInvalidURLPatternError, filter); return NULL; } std::string path = pattern.path(); - bool allowed = path == "/*" || path == "/*.*" || - (path.compare(0, 3, "/*.") == 0 && - path.find_first_of('*', 3) == std::string::npos); + bool allowed = path == "*" || path == "*.*" || + (path.compare(0, 2, "*.") == 0 && + path.find_first_of('*', 2) == std::string::npos); if (!allowed) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( errors::kInvalidURLPatternError, filter); diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc index 5d3ec71..9f141b5 100644 --- a/chrome/common/extensions/extension_manifests_unittest.cc +++ b/chrome/common/extensions/extension_manifests_unittest.cc @@ -1095,7 +1095,6 @@ TEST_F(ExtensionManifestTest, FileBrowserHandlers) { scoped_refptr<Extension> extension( LoadAndExpectSuccess("filebrowser_valid.json")); - ASSERT_TRUE(extension.get()); ASSERT_TRUE(extension->file_browser_handlers() != NULL); ASSERT_EQ(extension->file_browser_handlers()->size(), 1U); const FileBrowserHandler* action = diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc index c0b04b7..ac64811 100644 --- a/chrome/common/extensions/url_pattern.cc +++ b/chrome/common/extensions/url_pattern.cc @@ -97,14 +97,12 @@ bool IsValidPortForScheme(const std::string scheme, const std::string& port) { URLPattern::URLPattern() : valid_schemes_(SCHEME_NONE), match_all_urls_(false), - partial_filesystem_support_hack_(false), match_subdomains_(false), port_("*") {} URLPattern::URLPattern(int valid_schemes) : valid_schemes_(valid_schemes), match_all_urls_(false), - partial_filesystem_support_hack_(false), match_subdomains_(false), port_("*") {} @@ -113,7 +111,6 @@ URLPattern::URLPattern(int valid_schemes, const std::string& pattern) // appropriate when we know |pattern| is valid. : valid_schemes_(valid_schemes), match_all_urls_(false), - partial_filesystem_support_hack_(false), match_subdomains_(false), port_("*") { if (PARSE_SUCCESS != Parse(pattern)) @@ -298,27 +295,14 @@ bool URLPattern::SetPort(const std::string& port) { } bool URLPattern::MatchesURL(const GURL& test) const { - const GURL* test_url = &test; - bool has_inner_url = test.inner_url() != NULL; - - if (partial_filesystem_support_hack_ != has_inner_url) - return false; - - if (has_inner_url) - test_url = test.inner_url(); - - if (!MatchesScheme(test_url->scheme())) + if (!MatchesScheme(test.scheme())) return false; if (match_all_urls_) return true; - std::string path_for_request = test.PathForRequest(); - if (has_inner_url) - path_for_request = test_url->path() + path_for_request; - - return MatchesSecurityOriginHelper(*test_url) && - MatchesPath(path_for_request); + return MatchesSecurityOriginHelper(test) && + MatchesPath(test.PathForRequest()); } bool URLPattern::MatchesSecurityOrigin(const GURL& test) const { @@ -449,10 +433,6 @@ bool URLPattern::OverlapsWith(const URLPattern& other) const { DCHECK(path_.find('*') == path_.size() - 1); DCHECK(other.path().find('*') == other.path().size() - 1); - if (partial_filesystem_support_hack_ != - other.partial_filesystem_support_hack()) - return false; - if (!MatchesPath(other.path().substr(0, other.path().size() - 1)) && !other.MatchesPath(path_.substr(0, path_.size() - 1))) return false; diff --git a/chrome/common/extensions/url_pattern.h b/chrome/common/extensions/url_pattern.h index 3cde957..6a83c01 100644 --- a/chrome/common/extensions/url_pattern.h +++ b/chrome/common/extensions/url_pattern.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ @@ -119,15 +119,6 @@ class URLPattern { bool match_all_urls() const { return match_all_urls_; } void SetMatchAllURLs(bool val); - // Returns true if this pattern matches inner URLs of filesystem: URLs only. - // Returns false if this pattern matches only non-filesystem URLs. - bool partial_filesystem_support_hack() const { - return partial_filesystem_support_hack_; - } - void set_partial_filesystem_support_hack(bool val) { - partial_filesystem_support_hack_ = val; - } - // Sets the scheme for pattern matches. This can be a single '*' if the // pattern matches all valid schemes (as defined by the valid_schemes_ // property). Returns false on failure (if the scheme is not valid). @@ -213,11 +204,6 @@ class URLPattern { // True if this is a special-case "<all_urls>" pattern. bool match_all_urls_; - // True if we're trying to match against the inner URL of a filesystem URL; - // this is a temporary hack so as not to break ChromeOS as we work on full - // support. - bool partial_filesystem_support_hack_; - // The scheme for the pattern. std::string scheme_; diff --git a/chrome/common/extensions/url_pattern_unittest.cc b/chrome/common/extensions/url_pattern_unittest.cc index 10dff3d..3996b99 100644 --- a/chrome/common/extensions/url_pattern_unittest.cc +++ b/chrome/common/extensions/url_pattern_unittest.cc @@ -110,11 +110,6 @@ TEST(ExtensionURLPatternTest, Match2) { EXPECT_TRUE(pattern.MatchesURL(GURL("https://www.google.com/foobar"))); EXPECT_FALSE(pattern.MatchesURL(GURL("http://www.google.com/foo"))); EXPECT_FALSE(pattern.MatchesURL(GURL("https://www.google.com/"))); - EXPECT_FALSE(pattern.MatchesURL( - GURL("filesystem:https://www.google.com/foobar/"))); - pattern.set_partial_filesystem_support_hack(true); - EXPECT_TRUE(pattern.MatchesURL( - GURL("filesystem:https://www.google.com/foobar/bas"))); } // subdomains @@ -132,11 +127,6 @@ TEST(URLPatternTest, Match3) { EXPECT_TRUE(pattern.MatchesURL( GURL("http://monkey.images.google.com/foooobar"))); EXPECT_FALSE(pattern.MatchesURL(GURL("http://yahoo.com/foobar"))); - EXPECT_FALSE(pattern.MatchesURL( - GURL("filesystem:http://google.com/foobar/"))); - pattern.set_partial_filesystem_support_hack(true); - EXPECT_FALSE(pattern.MatchesURL( - GURL("filesystem:http://google.com/temporary/foobar"))); } // glob escaping @@ -236,7 +226,6 @@ TEST(ExtensionURLPatternTest, Match11) { EXPECT_TRUE(pattern.MatchesScheme("http")); EXPECT_TRUE(pattern.MatchesScheme("https")); EXPECT_TRUE(pattern.MatchesScheme("file")); - EXPECT_TRUE(pattern.MatchesScheme("filesystem")); EXPECT_TRUE(pattern.MatchesScheme("chrome-extension")); EXPECT_TRUE(pattern.match_subdomains()); EXPECT_TRUE(pattern.match_all_urls()); @@ -268,7 +257,6 @@ TEST(ExtensionURLPatternTest, Match12) { EXPECT_TRUE(pattern.MatchesScheme("http")); EXPECT_TRUE(pattern.MatchesScheme("https")); EXPECT_TRUE(pattern.MatchesScheme("file")); - EXPECT_TRUE(pattern.MatchesScheme("filesystem")); EXPECT_TRUE(pattern.MatchesScheme("javascript")); EXPECT_TRUE(pattern.MatchesScheme("data")); EXPECT_TRUE(pattern.MatchesScheme("about")); @@ -380,11 +368,6 @@ TEST(ExtensionURLPatternTest, Match17) { EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com:80/foo"))); EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com/foo"))); EXPECT_FALSE(pattern.MatchesURL(GURL("http://www.example.com:8080/foo"))); - EXPECT_FALSE(pattern.MatchesURL( - GURL("filesystem:http://www.example.com:8080/foo/"))); - EXPECT_FALSE(pattern.MatchesURL(GURL("filesystem:http://www.example.com/f/foo"))); - pattern.set_partial_filesystem_support_hack(true); - EXPECT_FALSE(pattern.MatchesURL(GURL("filesystem:http://www.example.com/f/foo"))); } // Explicit port wildcard @@ -401,8 +384,6 @@ TEST(ExtensionURLPatternTest, Match18) { EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com:80/foo"))); EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com/foo"))); EXPECT_TRUE(pattern.MatchesURL(GURL("http://www.example.com:8080/foo"))); - EXPECT_FALSE(pattern.MatchesURL( - GURL("filesystem:http://www.example.com:8080/foo/"))); } // chrome-extension:// @@ -421,11 +402,6 @@ TEST(ExtensionURLPatternTest, Match19) { EXPECT_TRUE(pattern.MatchesURL( GURL("chrome-extension://ftw/https://google.com"))); EXPECT_FALSE(pattern.MatchesURL(GURL("chrome-extension://foobar"))); - EXPECT_FALSE(pattern.MatchesURL( - GURL("filesystem:chrome-extension://ftw/t/file.txt"))); - pattern.set_partial_filesystem_support_hack(true); - EXPECT_TRUE(pattern.MatchesURL( - GURL("filesystem:chrome-extension://ftw/t/file.txt"))); }; static const struct GetAsStringPatterns { diff --git a/chrome/test/data/extensions/api_test/filebrowser_component/main.js b/chrome/test/data/extensions/api_test/filebrowser_component/main.js index 53fc279..f3ca290 100644 --- a/chrome/test/data/extensions/api_test/filebrowser_component/main.js +++ b/chrome/test/data/extensions/api_test/filebrowser_component/main.js @@ -14,7 +14,7 @@ This component extension test does the following: var cleanupError = 'Got unexpected error while cleaning up test directory.'; -// Class specified by the client running the TestRunner. +// Class specified by the client runnig the TestRunner. // |expectedTasks| should contain list of actions defined for abc files defined // by filesystem_handler part of the test. // |fileVerifierFunction| method that will verify test results received from the @@ -86,9 +86,7 @@ TestExpectations.prototype.verifyTasks = function(tasks, patterns = patterns.sort(); expectedPatterns = expectedPatterns.sort(); for (var j = 0; j < patterns.length; ++j) { - var translatedPattern = expectedPatterns[j].replace( - /^filesystem:/, "chrome-extension://*/"); - if (patterns[j] != translatedPattern) { + if (patterns[j] != expectedPatterns[j]) { errorCallback({message: 'Wrong patterns set for task ' + taskName + '. ' + 'Got: ' + patterns + |