summaryrefslogtreecommitdiffstats
path: root/extensions/renderer
diff options
context:
space:
mode:
authorpalmer <palmer@chromium.org>2016-02-03 15:21:36 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-03 23:22:25 +0000
commit5c437bcc7a51edbef45242c5173cf7871fde2866 (patch)
treecff6102f961c969435e9698cb821715f69ca64b2 /extensions/renderer
parenta2280cd27bd434f6033d3ab0c70886c06e3882b0 (diff)
downloadchromium_src-5c437bcc7a51edbef45242c5173cf7871fde2866.zip
chromium_src-5c437bcc7a51edbef45242c5173cf7871fde2866.tar.gz
chromium_src-5c437bcc7a51edbef45242c5173cf7871fde2866.tar.bz2
Make extensions use a correct same-origin check.
GURL::GetOrigin does not do the right thing for all types of URLs. BUG=573317 Review URL: https://codereview.chromium.org/1658913002 Cr-Commit-Position: refs/heads/master@{#373381}
Diffstat (limited to 'extensions/renderer')
-rw-r--r--extensions/renderer/file_system_natives.cc7
-rw-r--r--extensions/renderer/programmatic_script_injector.cc3
2 files changed, 6 insertions, 4 deletions
diff --git a/extensions/renderer/file_system_natives.cc b/extensions/renderer/file_system_natives.cc
index 1274509..2b70062 100644
--- a/extensions/renderer/file_system_natives.cc
+++ b/extensions/renderer/file_system_natives.cc
@@ -13,6 +13,7 @@
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebDOMFileSystem.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "url/origin.h"
namespace extensions {
@@ -42,8 +43,8 @@ void FileSystemNatives::GetIsolatedFileSystem(
extensions::ScriptContext::GetDataSourceURLForFrame(webframe);
CHECK(context_url.SchemeIs(extensions::kExtensionScheme));
- std::string name(storage::GetIsolatedFileSystemName(context_url.GetOrigin(),
- file_system_id));
+ const GURL origin(url::Origin(context_url).Serialize());
+ std::string name(storage::GetIsolatedFileSystemName(origin, file_system_id));
// The optional second argument is the subfolder within the isolated file
// system at which to root the DOMFileSystem we're returning to the caller.
@@ -54,7 +55,7 @@ void FileSystemNatives::GetIsolatedFileSystem(
}
GURL root_url(storage::GetIsolatedFileSystemRootURIString(
- context_url.GetOrigin(), file_system_id, optional_root_name));
+ origin, file_system_id, optional_root_name));
args.GetReturnValue().Set(
blink::WebDOMFileSystem::create(webframe,
diff --git a/extensions/renderer/programmatic_script_injector.cc b/extensions/renderer/programmatic_script_injector.cc
index f576305..13f0a20 100644
--- a/extensions/renderer/programmatic_script_injector.cc
+++ b/extensions/renderer/programmatic_script_injector.cc
@@ -20,6 +20,7 @@
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
+#include "url/origin.h"
namespace extensions {
@@ -132,7 +133,7 @@ void ProgrammaticScriptInjector::OnWillNotInject(
if (url_.SchemeIs(url::kAboutScheme)) {
error = ErrorUtils::FormatErrorMessage(
manifest_errors::kCannotAccessAboutUrl, url_.spec(),
- effective_url_.GetOrigin().spec());
+ url::Origin(effective_url_).Serialize());
} else {
// TODO(?) It would be nice to show kCannotAccessPageWithUrl here if
// this is triggered by an extension with tabs permission. See