Index: chrome/browser/extensions/extension_protocol.cc |
diff --git a/chrome/browser/extensions/extension_protocol.cc b/chrome/browser/extensions/extension_protocol.cc |
index 6eda9ef0f778e2c8f6b25dd422c6dad317e4a318..bb9d0cb839c04baba3a51d933ac359b48547690f 100644 |
--- a/chrome/browser/extensions/extension_protocol.cc |
+++ b/chrome/browser/extensions/extension_protocol.cc |
@@ -40,12 +40,12 @@ FilePath GetPathForExtensionResource(const FilePath& extension_path, |
if (!net::FileURLToFilePath(file_url, &ret_val)) |
return FilePath(); |
- if (!file_util::AbsolutePath(&ret_val)) |
- return FilePath(); |
- |
// Double-check that the path we ended up with is actually inside the |
- // extension root. |
- if (!extension_path.Contains(ret_val)) |
+ // extension root. We can do this with a simple prefix match because: |
+ // a) We control the prefix on both sides, and they should match. |
+ // b) GURL normalizes things like "../" and "//" before it gets to us. |
+ if (ret_val.value().find(extension_path.value() + |
+ FilePath::kSeparators[0]) != 0) |
return FilePath(); |
return ret_val; |