Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Unified Diff: chrome/browser/geolocation/chrome_geolocation_permission_context.cc

Issue 23440030: GeolocationPermissionContext: only use origin from embedder url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Retry upload. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/geolocation/chrome_geolocation_permission_context.cc
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
index e3bfc924f2cb2f1abdae72804f1179212c514c76..9940625545460252bf0f7532dcfec87b8563705b 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
@@ -9,6 +9,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/permission_request_id.h"
@@ -94,7 +95,7 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
return;
}
- GURL embedder = web_contents->GetURL();
+ GURL embedder = web_contents->GetLastCommittedURL();
bulach 2013/09/12 16:28:41 .GetOrigin() ?
Michael van Ouwerkerk 2013/09/12 16:50:41 Much nicer. Done.
if (!requesting_frame.is_valid() || !embedder.is_valid()) {
LOG(WARNING) << "Attempt to use geolocation from an invalid URL: "
<< requesting_frame << "," << embedder
@@ -103,6 +104,14 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
return;
}
+ if (embedder.has_ref()) {
+ // The ref (the hash) is not important here, and including it may cause a
+ // comparison failure later because it can change.
+ std::vector<std::string> parts;
+ base::SplitString(embedder.spec(), '#', &parts);
+ embedder = GURL(parts[0]);
+ }
bulach 2013/09/12 16:28:41 see above, I think we should just use .GetOrigin()
Michael van Ouwerkerk 2013/09/12 16:50:41 Done.
+
DecidePermission(id, requesting_frame, embedder, callback);
}

Powered by Google App Engine
This is Rietveld 408576698