summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_embedder.cc
diff options
context:
space:
mode:
authornasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-09 05:50:41 +0000
committernasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-09 05:50:41 +0000
commitbf572c99cd4e9500f76cd03d31c63fd754ffc331 (patch)
tree2b2aba53c5bf993e7e42c53b64aee63f0480428d /content/browser/browser_plugin/browser_plugin_embedder.cc
parent243bf2244695c5a07bb7ebb6ec0674050297d42d (diff)
downloadchromium_src-bf572c99cd4e9500f76cd03d31c63fd754ffc331.zip
chromium_src-bf572c99cd4e9500f76cd03d31c63fd754ffc331.tar.gz
chromium_src-bf572c99cd4e9500f76cd03d31c63fd754ffc331.tar.bz2
Combine webview tags with the same partition in the same renderer process.
BUG=138296 Review URL: https://chromiumcodereview.appspot.com/11359110 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_embedder.cc')
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index b789f88..2f02f39 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -107,8 +107,26 @@ void BrowserPluginEmbedder::CreateGuest(
base::StringPrintf("%s://%s/%s?%s", chrome::kGuestScheme,
host.c_str(), params.persist_storage ? "persist" : "",
url_encoded_partition.c_str()));
- SiteInstance* guest_site_instance = SiteInstance::CreateForURL(
- web_contents()->GetBrowserContext(), guest_site);
+
+ // If we already have a webview tag in the same app using the same storage
+ // partition, we should use the same SiteInstance so the existing tag and
+ // the new tag can script each other.
+ SiteInstance* guest_site_instance = NULL;
+ for (ContainerInstanceMap::const_iterator it =
+ guest_web_contents_by_instance_id_.begin();
+ it != guest_web_contents_by_instance_id_.end(); ++it) {
+ if (it->second->GetSiteInstance()->GetSiteURL() == guest_site) {
+ guest_site_instance = it->second->GetSiteInstance();
+ break;
+ }
+ }
+ if (!guest_site_instance) {
+ // Create the SiteInstance in a new BrowsingInstance, which will ensure that
+ // webview tags are also not allowed to send messages across different
+ // partitions.
+ guest_site_instance = SiteInstance::CreateForURL(
+ web_contents()->GetBrowserContext(), guest_site);
+ }
guest_web_contents = WebContentsImpl::CreateGuest(
web_contents()->GetBrowserContext(),