| Index: chrome/renderer/content_settings_observer.cc
|
| diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc
|
| index fea2747a4fa9b11a3dcdf016b77f12605a785dba..0ca36ff7040493780369266779dd60ed7e4051b6 100644
|
| --- a/chrome/renderer/content_settings_observer.cc
|
| +++ b/chrome/renderer/content_settings_observer.cc
|
| @@ -16,6 +16,7 @@
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
| +#include "webkit/glue/weburlresponse_extradata_impl.h"
|
|
|
| using WebKit::WebDataSource;
|
| using WebKit::WebFrame;
|
| @@ -312,6 +313,13 @@ void ContentSettingsObserver::ClearBlockedContentSettings() {
|
| }
|
|
|
| bool ContentSettingsObserver::IsWhitelistedForContentSettings(WebFrame* frame) {
|
| + // Whitelist ftp directory listings, as they require JavaScript to function
|
| + // properly.
|
| + webkit_glue::WebURLResponseExtraDataImpl* extra_data =
|
| + static_cast<webkit_glue::WebURLResponseExtraDataImpl*>(
|
| + frame->dataSource()->response().extraData());
|
| + if (extra_data && extra_data->is_ftp_directory_listing())
|
| + return true;
|
| return IsWhitelistedForContentSettings(frame->document().securityOrigin(),
|
| frame->document().url());
|
| }
|
| @@ -334,14 +342,11 @@ bool ContentSettingsObserver::IsWhitelistedForContentSettings(
|
| if (EqualsASCII(origin.protocol(), chrome::kChromeInternalScheme))
|
| return true;
|
|
|
| - // If the scheme is ftp: or file:, an empty file name indicates a directory
|
| - // listing, which requires JavaScript to function properly.
|
| - const char* kDirProtocols[] = { chrome::kFtpScheme, chrome::kFileScheme };
|
| - for (size_t i = 0; i < arraysize(kDirProtocols); ++i) {
|
| - if (EqualsASCII(origin.protocol(), kDirProtocols[i])) {
|
| - return document_url.SchemeIs(kDirProtocols[i]) &&
|
| - document_url.ExtractFileName().empty();
|
| - }
|
| + // If the scheme is file:, an empty file name indicates a directory listing,
|
| + // which requires JavaScript to function properly.
|
| + if (EqualsASCII(origin.protocol(), chrome::kFileScheme)) {
|
| + return document_url.SchemeIs(chrome::kFileScheme) &&
|
| + document_url.ExtractFileName().empty();
|
| }
|
|
|
| return false;
|
|
|