summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/glue/media/simple_data_source.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc
index a9daf10..6207ddd 100644
--- a/webkit/glue/media/simple_data_source.cc
+++ b/webkit/glue/media/simple_data_source.cc
@@ -12,6 +12,22 @@
#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/webappcachecontext.h"
+namespace {
+
+const char kHttpScheme[] = "http";
+const char kHttpsScheme[] = "https";
+const char kFtpScheme[] = "ftp";
+
+// A helper method that accepts only HTTP, HTTPS and FILE protocol.
+bool IsSchemeSupported(const GURL& url) {
+ return url.SchemeIs(kHttpScheme) ||
+ url.SchemeIs(kHttpsScheme) ||
+ url.SchemeIs(kFtpScheme) ||
+ url.SchemeIsFile();
+}
+
+} // namespace
+
namespace webkit_glue {
SimpleDataSource::SimpleDataSource(MessageLoop* render_loop, int32 routing_id)
@@ -44,7 +60,8 @@ bool SimpleDataSource::Initialize(const std::string& url) {
// Validate the URL.
SetURL(GURL(url));
- if (!url_.is_valid()) {
+ if (!url_.is_valid() || !IsSchemeSupported(url_)) {
+ host_->Error(media::PIPELINE_ERROR_NETWORK);
return false;
}