summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_process_impl.cc2
-rw-r--r--chrome/browser/extensions/extension_resource_protocols.cc81
-rw-r--r--chrome/browser/extensions/extension_resource_protocols.h15
-rw-r--r--chrome/browser/extensions/extension_resource_request_policy_apitest.cc16
-rw-r--r--chrome/browser/profiles/profile_io_data.cc6
-rw-r--r--chrome/browser/resources/extension_resource/demo/library.js5
-rw-r--r--chrome/chrome_browser_extensions.gypi2
-rw-r--r--chrome/chrome_resources.gyp8
-rw-r--r--chrome/common/chrome_content_client.cc2
-rw-r--r--chrome/common/chrome_paths.cc6
-rw-r--r--chrome/common/chrome_paths.h1
-rw-r--r--chrome/common/extensions/csp_validator.cc5
-rw-r--r--chrome/common/extensions/csp_validator_unittest.cc2
-rw-r--r--chrome/common/extensions/extension.cc2
-rw-r--r--chrome/common/extensions/extension_file_util.cc19
-rw-r--r--chrome/common/extensions/extension_file_util.h4
-rw-r--r--chrome/common/extensions/extension_file_util_unittest.cc70
-rw-r--r--chrome/common/url_constants.cc1
-rw-r--r--chrome/common/url_constants.h4
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc22
-rw-r--r--chrome/renderer/extensions/extension_resource_request_policy.cc22
-rw-r--r--chrome/renderer/extensions/extension_resource_request_policy.h11
-rw-r--r--chrome/test/data/extensions/api_test/accessible_cer/background.js9
-rw-r--r--chrome/test/data/extensions/api_test/accessible_cer/main.html7
-rw-r--r--chrome/test/data/extensions/api_test/accessible_cer/manifest.json9
-rw-r--r--chrome/test/data/extensions/api_test/extension_resource_request_policy/web_accessible/nonaccessible_chrome_resource_scheme.html13
26 files changed, 10 insertions, 334 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 3903ab4..ef593ea 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -149,8 +149,6 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme(
chrome::kExtensionScheme);
- ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme(
- chrome::kExtensionResourceScheme);
extension_event_router_forwarder_ = new ExtensionEventRouterForwarder;
diff --git a/chrome/browser/extensions/extension_resource_protocols.cc b/chrome/browser/extensions/extension_resource_protocols.cc
deleted file mode 100644
index 2385355..0000000
--- a/chrome/browser/extensions/extension_resource_protocols.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "chrome/browser/extensions/extension_resource_protocols.h"
-
-#include "base/file_path.h"
-#include "base/path_service.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/extensions/extension_file_util.h"
-#include "content/public/browser/browser_thread.h"
-#include "net/url_request/url_request_file_job.h"
-
-namespace {
-
-class ExtensionResourcesJob : public net::URLRequestFileJob {
- public:
- explicit ExtensionResourcesJob(net::URLRequest* request)
- : net::URLRequestFileJob(request, FilePath()) { }
-
- virtual void Start() OVERRIDE;
-
- protected:
- ~ExtensionResourcesJob() { }
-
- void ResolvePath();
- void ResolvePathDone();
-
- private:
- content::BrowserThread::ID thread_id_;
-};
-
-void ExtensionResourcesJob::Start() {
- bool result =
- content::BrowserThread::GetCurrentThreadIdentifier(&thread_id_);
- CHECK(result) << "Can not get thread id.";
- content::BrowserThread::PostTask(
- content::BrowserThread::FILE, FROM_HERE,
- base::Bind(&ExtensionResourcesJob::ResolvePath, this));
-}
-
-void ExtensionResourcesJob::ResolvePath() {
- FilePath root_path;
- PathService::Get(chrome::DIR_RESOURCES_EXTENSION, &root_path);
- file_path_ = extension_file_util::ExtensionResourceURLToFilePath(
- request()->url(), root_path);
- content::BrowserThread::PostTask(
- thread_id_, FROM_HERE,
- base::Bind(&ExtensionResourcesJob::ResolvePathDone, this));
-}
-
-void ExtensionResourcesJob::ResolvePathDone() {
- net::URLRequestFileJob::Start();
-}
-
-class ExtensionResourceProtocolHandler
- : public net::URLRequestJobFactory::ProtocolHandler {
- public:
- ExtensionResourceProtocolHandler() {}
- virtual ~ExtensionResourceProtocolHandler() {}
-
- virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request) const OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ExtensionResourceProtocolHandler);
-};
-
-// Creates URLRequestJobs for chrome-extension-resource:// URLs.
-net::URLRequestJob*
-ExtensionResourceProtocolHandler::MaybeCreateJob(
- net::URLRequest* request) const {
- return new ExtensionResourcesJob(request);
-}
-
-} // namespace
-
-net::URLRequestJobFactory::ProtocolHandler*
-CreateExtensionResourceProtocolHandler() {
- return new ExtensionResourceProtocolHandler();
-}
diff --git a/chrome/browser/extensions/extension_resource_protocols.h b/chrome/browser/extensions/extension_resource_protocols.h
deleted file mode 100644
index a93d67d..0000000
--- a/chrome/browser/extensions/extension_resource_protocols.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2012 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_BROWSER_EXTENSIONS_EXTENSION_RESOURCE_PROTOCOLS_H_
-#define CHROME_BROWSER_EXTENSIONS_EXTENSION_RESOURCE_PROTOCOLS_H_
-#pragma once
-
-#include "net/url_request/url_request_job_factory.h"
-
-// Creates the handlers for the chrome-extension-resource:// scheme.
-net::URLRequestJobFactory::ProtocolHandler*
-CreateExtensionResourceProtocolHandler();
-
-#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_RESOURCE_PROTOCOLS_H_
diff --git a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc
index a7f57de..7529ada 100644
--- a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc
+++ b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc
@@ -193,17 +193,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest,
L"window.domAutomationController.send(document.title)",
&result));
EXPECT_EQ("Image failed to load", result);
-
- GURL nonaccessible_cer_resource(
- test_server()->GetURL(
- "files/extensions/api_test/extension_resource_request_policy/"
- "web_accessible/nonaccessible_chrome_resource_scheme.html"));
- ui_test_utils::NavigateToURL(browser(), nonaccessible_cer_resource);
- ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
- browser()->GetSelectedWebContents()->GetRenderViewHost(), L"",
- L"window.domAutomationController.send(document.title)",
- &result));
- EXPECT_EQ("Loading CER:// failed.", result);
}
IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, Iframe) {
@@ -216,8 +205,3 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, Iframe) {
"extension_resource_request_policy/web_accessible",
"iframe.html"));
}
-
-IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest,
- ExtensionAccessibleResources) {
- ASSERT_TRUE(RunExtensionSubtest("accessible_cer", "main.html")) << message_;
-}
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index b137006..6ea6e86 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/extensions/extension_info_map.h"
#include "chrome/browser/extensions/extension_protocols.h"
-#include "chrome/browser/extensions/extension_resource_protocols.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/chrome_cookie_notification_details.h"
@@ -303,7 +302,6 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
#endif // defined(OS_CHROMEOS)
chrome::kBlobScheme,
chrome::kFileSystemScheme,
- chrome::kExtensionResourceScheme,
};
for (size_t i = 0; i < arraysize(kProtocolList); ++i) {
if (scheme == kProtocolList[i])
@@ -517,10 +515,6 @@ void ProfileIOData::LazyInitialize() const {
profile_params_->extension_info_map));
DCHECK(set_protocol);
set_protocol = job_factory_->SetProtocolHandler(
- chrome::kExtensionResourceScheme,
- CreateExtensionResourceProtocolHandler());
- DCHECK(set_protocol);
- set_protocol = job_factory_->SetProtocolHandler(
chrome::kChromeUIScheme,
ChromeURLDataManagerBackend::CreateProtocolHandler(
chrome_url_data_manager_backend_.get()));
diff --git a/chrome/browser/resources/extension_resource/demo/library.js b/chrome/browser/resources/extension_resource/demo/library.js
deleted file mode 100644
index 167786a..0000000
--- a/chrome/browser/resources/extension_resource/demo/library.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2012 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.
-
-var _demo = {};
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 5731025..d7db9a2 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -334,8 +334,6 @@
'browser/extensions/extension_protocols.h',
'browser/extensions/extension_record_api.cc',
'browser/extensions/extension_record_api.h',
- 'browser/extensions/extension_resource_protocols.cc',
- 'browser/extensions/extension_resource_protocols.h',
'browser/extensions/extension_scoped_prefs.h',
'browser/extensions/extension_service.cc',
'browser/extensions/extension_service.h',
diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp
index e704b2b..c9ac561 100644
--- a/chrome/chrome_resources.gyp
+++ b/chrome/chrome_resources.gyp
@@ -69,14 +69,6 @@
},
],
'includes': [ '../build/grit_target.gypi' ],
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)/resources/extension/demo',
- 'files': [
- 'browser/resources/extension_resource/demo/library.js',
- ],
- },
- ]
},
{
# TODO(mark): It would be better if each static library that needed
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index edb2e1c..369bc0a 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -379,8 +379,6 @@ void ChromeContentClient::AddAdditionalSchemes(
std::vector<std::string>* savable_schemes) {
standard_schemes->push_back(kExtensionScheme);
savable_schemes->push_back(kExtensionScheme);
- standard_schemes->push_back(kExtensionResourceScheme);
- savable_schemes->push_back(kExtensionResourceScheme);
#if defined(OS_CHROMEOS)
standard_schemes->push_back(kCrosScheme);
#endif
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index edeb082..4bd6bf0 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -307,12 +307,6 @@ bool PathProvider(int key, FilePath* result) {
return false;
cur = cur.Append(FILE_PATH_LITERAL("resources.pak"));
break;
- case chrome::DIR_RESOURCES_EXTENSION:
- if (!PathService::Get(base::DIR_MODULE, &cur))
- return false;
- cur = cur.Append(FILE_PATH_LITERAL("resources"))
- .Append(FILE_PATH_LITERAL("extension"));
- break;
#if defined(OS_CHROMEOS)
case chrome::FILE_CHROMEOS_API:
if (!PathService::Get(base::DIR_MODULE, &cur))
diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h
index a3991c6..61fa4f6f 100644
--- a/chrome/common/chrome_paths.h
+++ b/chrome/common/chrome_paths.h
@@ -96,7 +96,6 @@ enum {
FILE_RESOURCES_PACK, // Full path to the .pak file containing
// binary data (e.g., html files and images
// used by interal pages).
- DIR_RESOURCES_EXTENSION, // Full path to extension resources.
#if defined(OS_CHROMEOS)
FILE_CHROMEOS_API, // Full path to chrome os api shared object.
#endif
diff --git a/chrome/common/extensions/csp_validator.cc b/chrome/common/extensions/csp_validator.cc
index 7b28bdf..e80468b 100644
--- a/chrome/common/extensions/csp_validator.cc
+++ b/chrome/common/extensions/csp_validator.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.
@@ -43,8 +43,7 @@ bool HasOnlySecureTokens(StringTokenizer& tokenizer) {
source == "'none'" ||
StartsWithASCII(source, "https://", true) ||
StartsWithASCII(source, "chrome://", true) ||
- StartsWithASCII(source, "chrome-extension://", true) ||
- StartsWithASCII(source, "chrome-extension-resource:", true)) {
+ StartsWithASCII(source, "chrome-extension://", true)) {
continue;
}
diff --git a/chrome/common/extensions/csp_validator_unittest.cc b/chrome/common/extensions/csp_validator_unittest.cc
index 5b9bfbe..b7fa4da 100644
--- a/chrome/common/extensions/csp_validator_unittest.cc
+++ b/chrome/common/extensions/csp_validator_unittest.cc
@@ -60,8 +60,6 @@ TEST(ExtensionCSPValidator, IsSecure) {
"default-src 'self' chrome://resources"));
EXPECT_TRUE(ContentSecurityPolicyIsSecure(
"default-src 'self' chrome-extension://aabbcc"));
- EXPECT_TRUE(ContentSecurityPolicyIsSecure(
- "default-src 'self' chrome-extension-resource://aabbcc"));
EXPECT_FALSE(ContentSecurityPolicyIsSecure(
"default-src 'self' https:"));
EXPECT_FALSE(ContentSecurityPolicyIsSecure(
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 91c21df..7799938 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -76,7 +76,7 @@ const char kPrivate[] = "PRIVATE";
const int kRSAKeySize = 1024;
const char kDefaultContentSecurityPolicy[] =
- "script-src 'self' chrome-extension-resource:; object-src 'self'";
+ "script-src 'self'; object-src 'self'";
// Converts a normal hexadecimal string into the alphabet used by extensions.
// We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a
diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc
index 848625e..3f9a9b9 100644
--- a/chrome/common/extensions/extension_file_util.cc
+++ b/chrome/common/extensions/extension_file_util.cc
@@ -635,25 +635,6 @@ FilePath ExtensionURLToRelativeFilePath(const GURL& url) {
return path;
}
-FilePath ExtensionResourceURLToFilePath(const GURL& url, const FilePath& root) {
- std::string host = net::UnescapeURLComponent(url.host(),
- net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS);
- if (host.empty())
- return FilePath();
-
- FilePath relative_path = ExtensionURLToRelativeFilePath(url);
- if (relative_path.empty())
- return FilePath();
-
- FilePath path = root.AppendASCII(host).Append(relative_path);
- if (!file_util::PathExists(path) ||
- !file_util::AbsolutePath(&path) ||
- !root.IsParent(path)) {
- return FilePath();
- }
- return path;
-}
-
FilePath GetUserDataTempDir() {
// We do file IO in this function, but only when the current profile's
// Temp directory has never been used before, or in a rare error case.
diff --git a/chrome/common/extensions/extension_file_util.h b/chrome/common/extensions/extension_file_util.h
index 1ad1120..1ab3f07 100644
--- a/chrome/common/extensions/extension_file_util.h
+++ b/chrome/common/extensions/extension_file_util.h
@@ -100,10 +100,6 @@ bool CheckForIllegalFilenames(const FilePath& extension_path,
// Get a relative file path from a chrome-extension:// URL.
FilePath ExtensionURLToRelativeFilePath(const GURL& url);
-// Get a full file path from a chrome-extension-resource:// URL, If the URL
-// points a file outside of root, this function will return empty FilePath.
-FilePath ExtensionResourceURLToFilePath(const GURL& url, const FilePath& root);
-
// Get a path to a temp directory for unpacking an extension.
// This is essentially PathService::Get(chrome::DIR_USER_DATA_TEMP, ...),
// with a histogram that allows us to understand why it is failing.
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc
index eef0a63..e2d1066 100644
--- a/chrome/common/extensions/extension_file_util_unittest.cc
+++ b/chrome/common/extensions/extension_file_util_unittest.cc
@@ -215,8 +215,9 @@ TEST(ExtensionFileUtil, FailLoadingNonUTF8Scripts) {
"It isn't UTF-8 encoded.", error.c_str());
}
-TEST(ExtensionFileUtil, ExtensionURLToRelativeFilePath) {
#define URL_PREFIX "chrome-extension://extension-id/"
+
+TEST(ExtensionFileUtil, ExtensionURLToRelativeFilePath) {
struct TestCase {
const char* url;
const char* expected_relative_path;
@@ -242,7 +243,6 @@ TEST(ExtensionFileUtil, ExtensionURLToRelativeFilePath) {
{ URL_PREFIX "\\\\foo\\simple.html",
"foo/simple.html" },
};
-#undef URL_PREFIX
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
GURL url(test_cases[i].url);
@@ -261,72 +261,6 @@ TEST(ExtensionFileUtil, ExtensionURLToRelativeFilePath) {
}
}
-TEST(ExtensionFileUtil, ExtensionResourceURLToFilePath) {
- // Setup filesystem for testing.
- FilePath root_path;
- ASSERT_TRUE(file_util::CreateNewTempDirectory(
- FILE_PATH_LITERAL(""), &root_path));
- ASSERT_TRUE(file_util::AbsolutePath(&root_path));
-
- FilePath api_path = root_path.Append(FILE_PATH_LITERAL("apiname"));
- ASSERT_TRUE(file_util::CreateDirectory(api_path));
-
- const char data[] = "Test Data";
- FilePath resource_path = api_path.Append(FILE_PATH_LITERAL("test.js"));
- ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data)));
- resource_path = api_path.Append(FILE_PATH_LITERAL("escape spaces.js"));
- ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data)));
-
-#ifdef FILE_PATH_USES_WIN_SEPARATORS
-#define SEP "\\"
-#else
-#define SEP "/"
-#endif
-#define URL_PREFIX "chrome-extension-resource://"
- struct TestCase {
- const char* url;
- const FilePath::CharType* expected_path;
- } test_cases[] = {
- { URL_PREFIX "apiname/test.js",
- FILE_PATH_LITERAL("test.js") },
- { URL_PREFIX "/apiname/test.js",
- FILE_PATH_LITERAL("test.js") },
- // Test % escape
- { URL_PREFIX "apiname/%74%65st.js",
- FILE_PATH_LITERAL("test.js") },
- { URL_PREFIX "apiname/escape%20spaces.js",
- FILE_PATH_LITERAL("escape spaces.js") },
- // Test file does not exist.
- { URL_PREFIX "apiname/directory/to/file.js",
- NULL },
- // Test apiname/../../test.js
- { URL_PREFIX "apiname/../../test.js",
- FILE_PATH_LITERAL("test.js") },
- { URL_PREFIX "apiname/..%2F../test.js",
- NULL },
- { URL_PREFIX "apiname/f/../../../test.js",
- FILE_PATH_LITERAL("test.js") },
- { URL_PREFIX "apiname/f%2F..%2F..%2F../test.js",
- NULL },
- };
-#undef SEP
-#undef URL_PREFIX
-
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
- GURL url(test_cases[i].url);
- FilePath expected_path;
- if (test_cases[i].expected_path)
- expected_path = root_path.Append(FILE_PATH_LITERAL("apiname")).Append(
- test_cases[i].expected_path);
- FilePath actual_path =
- extension_file_util::ExtensionResourceURLToFilePath(url, root_path);
- EXPECT_EQ(expected_path.value(), actual_path.value()) <<
- " For the path " << url;
- }
- // Remove temp files.
- ASSERT_TRUE(file_util::Delete(root_path, true));
-}
-
static scoped_refptr<Extension> LoadExtensionManifest(
DictionaryValue* manifest,
const FilePath& manifest_dir,
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index b00a417..3df1a91 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -426,6 +426,5 @@ const char* const kChromeDebugURLs[] = {
int kNumberOfChromeDebugURLs = static_cast<int>(arraysize(kChromeDebugURLs));
const char kExtensionScheme[] = "chrome-extension";
-const char kExtensionResourceScheme[] = "chrome-extension-resource";
} // namespace chrome
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index d97ce50..b451e5c 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -352,10 +352,6 @@ extern int kNumberOfChromeDebugURLs;
// Canonical schemes you can use as input to GURL.SchemeIs().
extern const char kExtensionScheme[];
-
-// Canonical schemes you can use as input to GURL.SchemeIs().
-extern const char kExtensionResourceScheme[];
-
#if defined(OS_CHROMEOS)
extern const char kDriveScheme[];
#endif
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index ddd22ac..4013b92f 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -231,14 +231,6 @@ void ChromeContentRendererClient::RenderThreadStarted() {
// chrome-extension: resources should be allowed to receive CORS requests.
WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_scheme);
-
- WebString extension_resource_scheme(
- ASCIIToUTF16(chrome::kExtensionResourceScheme));
- WebSecurityPolicy::registerURLSchemeAsSecure(extension_resource_scheme);
-
- // chrome-extension-resource: resources should be allowed to receive CORS
- // requests.
- WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_resource_scheme);
}
void ChromeContentRendererClient::RenderViewCreated(
@@ -752,8 +744,9 @@ bool ChromeContentRendererClient::ShouldFork(WebFrame* frame,
bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame,
const GURL& url,
GURL* new_url) {
- // Check whether the request should be allowed. If not allowed, we reset the
- // URL to something invalid to prevent the request and cause an error.
+ // If the request is for an extension resource, check whether it should be
+ // allowed. If not allowed, we reset the URL to something invalid to prevent
+ // the request and cause an error.
if (url.SchemeIs(chrome::kExtensionScheme) &&
!ExtensionResourceRequestPolicy::CanRequestResource(
url,
@@ -761,15 +754,6 @@ bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame,
extension_dispatcher_->extensions())) {
*new_url = GURL("chrome-extension://invalid/");
return true;
-
- }
-
- if (url.SchemeIs(chrome::kExtensionResourceScheme) &&
- !ExtensionResourceRequestPolicy::CanRequestExtensionResourceScheme(
- url,
- frame)) {
- *new_url = GURL("chrome-extension-resource://invalid/");
- return true;
}
return false;
diff --git a/chrome/renderer/extensions/extension_resource_request_policy.cc b/chrome/renderer/extensions/extension_resource_request_policy.cc
index 6e62a85..c7b5b5a 100644
--- a/chrome/renderer/extensions/extension_resource_request_policy.cc
+++ b/chrome/renderer/extensions/extension_resource_request_policy.cc
@@ -81,27 +81,5 @@ bool ExtensionResourceRequestPolicy::CanRequestResource(
return true;
}
-// static
-bool ExtensionResourceRequestPolicy::CanRequestExtensionResourceScheme(
- const GURL& resource_url,
- WebKit::WebFrame* frame) {
- CHECK(resource_url.SchemeIs(chrome::kExtensionResourceScheme));
-
- GURL frame_url = frame->document().url();
- if (!frame_url.is_empty() &&
- !frame_url.SchemeIs(chrome::kExtensionScheme)) {
- std::string message = base::StringPrintf(
- "Denying load of %s. chrome-extension-resources:// can only be "
- "loaded from extensions.",
- resource_url.spec().c_str());
- frame->addMessageToConsole(
- WebKit::WebConsoleMessage(WebKit::WebConsoleMessage::LevelError,
- WebKit::WebString::fromUTF8(message)));
- return false;
- }
-
- return true;
-}
-
ExtensionResourceRequestPolicy::ExtensionResourceRequestPolicy() {
}
diff --git a/chrome/renderer/extensions/extension_resource_request_policy.h b/chrome/renderer/extensions/extension_resource_request_policy.h
index 329b5a0..cb59bca 100644
--- a/chrome/renderer/extensions/extension_resource_request_policy.h
+++ b/chrome/renderer/extensions/extension_resource_request_policy.h
@@ -12,20 +12,13 @@ namespace WebKit {
class WebFrame;
}
-// Encapsulates the policy for when chrome-extension:// and
-// chrome-extension-resource:// URLs can be requested.
+// Encapsulates the policy for when chrome-extension:// URLs can be requested.
class ExtensionResourceRequestPolicy {
public:
- // Returns true if the chrome-extension:// |resource_url| can be requested
- // from |frame_url|.
+ // Returns true if the |resource_url| can be requested from |frame_url|.
static bool CanRequestResource(const GURL& resource_url,
WebKit::WebFrame* frame,
const ExtensionSet* loaded_extensions);
- // Returns true if the chrome-extension-resource:// |resource_url| can be
- // requested from |frame_url|.
- static bool CanRequestExtensionResourceScheme(
- const GURL& resource_url,
- WebKit::WebFrame* frame);
private:
ExtensionResourceRequestPolicy();
diff --git a/chrome/test/data/extensions/api_test/accessible_cer/background.js b/chrome/test/data/extensions/api_test/accessible_cer/background.js
deleted file mode 100644
index 709c9d0..0000000
--- a/chrome/test/data/extensions/api_test/accessible_cer/background.js
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright (c) 2012 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.
-
-if (typeof(_demo) == 'undefined') {
- chrome.test.fail();
-} else {
- chrome.test.succeed();
-}
diff --git a/chrome/test/data/extensions/api_test/accessible_cer/main.html b/chrome/test/data/extensions/api_test/accessible_cer/main.html
deleted file mode 100644
index 9eca644..0000000
--- a/chrome/test/data/extensions/api_test/accessible_cer/main.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<head>
-<title>CER access test</title>
-<script type="text/javascript" src="chrome-extension-resource://demo/library.js"></script>
-<script type="text/javascript" src="background.js"></script>
-</head>
-</html>
diff --git a/chrome/test/data/extensions/api_test/accessible_cer/manifest.json b/chrome/test/data/extensions/api_test/accessible_cer/manifest.json
deleted file mode 100644
index 6b3b692..0000000
--- a/chrome/test/data/extensions/api_test/accessible_cer/manifest.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "name": "Access chrome-extension-resource:// test",
- "version": "0.1",
- "manifest_version": 2,
- "description": "Access chrome-extension-resource:// test",
- "background": {
- "page": "main.html"
- }
-}
diff --git a/chrome/test/data/extensions/api_test/extension_resource_request_policy/web_accessible/nonaccessible_chrome_resource_scheme.html b/chrome/test/data/extensions/api_test/extension_resource_request_policy/web_accessible/nonaccessible_chrome_resource_scheme.html
deleted file mode 100644
index 3ddcd28..0000000
--- a/chrome/test/data/extensions/api_test/extension_resource_request_policy/web_accessible/nonaccessible_chrome_resource_scheme.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<head>
-<title>CER access test</title>
-<script type="text/javascript" src="chrome-extension-resource://demo/library.js"></script>
-<script type="text/javascript">
- if (typeof(_demo) == 'undefined') {
- document.title = 'Loading CER:// failed.';
- } else {
- document.title = 'Loading CER:// load succeeded.';
- }
-</script>
-</head>
-</html>