summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-05 13:55:54 +0000
committercreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-05 13:55:54 +0000
commitf89b2a2bb1450b4ad13de1b35ab76f707536c21b (patch)
tree5867c8359c65fe1f63dec5f39788acc62c4de626
parente087d17d2b2ec5137420280b7bac56545f1fb823 (diff)
downloadchromium_src-f89b2a2bb1450b4ad13de1b35ab76f707536c21b.zip
chromium_src-f89b2a2bb1450b4ad13de1b35ab76f707536c21b.tar.gz
chromium_src-f89b2a2bb1450b4ad13de1b35ab76f707536c21b.tar.bz2
Remove webview-based behavior from --site-per-process flag.
We're getting close to actually swapping RenderFrameHosts instead. BUG=99379, 314791 TEST=none Review URL: https://codereview.chromium.org/53153008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232969 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest_manager.cc80
-rw-r--r--content/browser/loader/resource_loader.cc30
-rw-r--r--content/browser/plugin_service_impl.cc19
-rw-r--r--content/public/common/content_switches.cc9
4 files changed, 35 insertions, 103 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.cc b/content/browser/browser_plugin/browser_plugin_guest_manager.cc
index 3f6963c..7e2ad44 100644
--- a/content/browser/browser_plugin/browser_plugin_guest_manager.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest_manager.cc
@@ -4,7 +4,6 @@
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
-#include "base/command_line.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/browser_plugin/browser_plugin_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
@@ -13,7 +12,6 @@
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/content_export.h"
#include "content/public/browser/user_metrics.h"
-#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
@@ -44,7 +42,6 @@ BrowserPluginGuest* BrowserPluginGuestManager::CreateGuest(
int instance_id,
const BrowserPluginHostMsg_Attach_Params& params,
scoped_ptr<base::DictionaryValue> extra_params) {
- SiteInstance* guest_site_instance = NULL;
RenderProcessHost* embedder_process_host =
embedder_site_instance->GetProcess();
// Validate that the partition id coming from the renderer is valid UTF-8,
@@ -59,54 +56,39 @@ BrowserPluginGuest* BrowserPluginGuestManager::CreateGuest(
return NULL;
}
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kSitePerProcess)) {
- // When --site-per-process is specified, the behavior of BrowserPlugin
- // as <webview> is broken and we use it for rendering out-of-process
- // iframes instead. We use the src URL sent by the renderer to find the
- // right process in which to place this instance.
- // Note: Since BrowserPlugin doesn't support cross-process navigation,
- // the instance will stay in the initially assigned process, regardless
- // of the site it is navigated to.
- // TODO(nasko): Fix this, and such that cross-process navigations are
- // supported.
- guest_site_instance =
- embedder_site_instance->GetRelatedSiteInstance(GURL(params.src));
- } else {
- // We usually require BrowserPlugins to be hosted by a storage isolated
- // extension. We treat WebUI pages as a special case if they host the
- // BrowserPlugin in a component extension iframe. In that case, we use the
- // iframe's URL to determine the extension.
- const GURL& embedder_site_url = embedder_site_instance->GetSiteURL();
- GURL validated_frame_url(params.embedder_frame_url);
- RenderViewHost::FilterURL(
- embedder_process_host, false, &validated_frame_url);
- const std::string& host = content::HasWebUIScheme(embedder_site_url) ?
- validated_frame_url.host() : embedder_site_url.host();
+ // We usually require BrowserPlugins to be hosted by a storage isolated
+ // extension. We treat WebUI pages as a special case if they host the
+ // BrowserPlugin in a component extension iframe. In that case, we use the
+ // iframe's URL to determine the extension.
+ const GURL& embedder_site_url = embedder_site_instance->GetSiteURL();
+ GURL validated_frame_url(params.embedder_frame_url);
+ RenderViewHost::FilterURL(
+ embedder_process_host, false, &validated_frame_url);
+ const std::string& host = content::HasWebUIScheme(embedder_site_url) ?
+ validated_frame_url.host() : embedder_site_url.host();
- std::string url_encoded_partition = net::EscapeQueryParamValue(
- params.storage_partition_id, false);
- // The SiteInstance of a given webview tag is based on the fact that it's
- // a guest process in addition to which platform application the tag
- // belongs to and what storage partition is in use, rather than the URL
- // that the tag is being navigated to.
- GURL guest_site(base::StringPrintf("%s://%s/%s?%s",
- kGuestScheme,
- host.c_str(),
- params.persist_storage ? "persist" : "",
- url_encoded_partition.c_str()));
+ std::string url_encoded_partition = net::EscapeQueryParamValue(
+ params.storage_partition_id, false);
+ // The SiteInstance of a given webview tag is based on the fact that it's
+ // a guest process in addition to which platform application the tag
+ // belongs to and what storage partition is in use, rather than the URL
+ // that the tag is being navigated to.
+ GURL guest_site(base::StringPrintf("%s://%s/%s?%s",
+ kGuestScheme,
+ host.c_str(),
+ params.persist_storage ? "persist" : "",
+ url_encoded_partition.c_str()));
- // 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.
- guest_site_instance = GetGuestSiteInstance(guest_site);
- 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(
- embedder_site_instance->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 = GetGuestSiteInstance(guest_site);
+ 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(
+ embedder_site_instance->GetBrowserContext(), guest_site);
}
return WebContentsImpl::CreateGuest(
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
index cc5cab6..4b90e97 100644
--- a/content/browser/loader/resource_loader.cc
+++ b/content/browser/loader/resource_loader.cc
@@ -18,12 +18,10 @@
#include "content/public/browser/cert_store.h"
#include "content/public/browser/resource_context.h"
#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
-#include "content/public/browser/site_instance.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/process_type.h"
#include "content/public/common/resource_response.h"
-#include "content/public/common/url_constants.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
@@ -473,34 +471,6 @@ void ResourceLoader::CompleteResponseStarted() {
scoped_refptr<ResourceResponse> response(new ResourceResponse());
PopulateResourceResponse(request_.get(), response.get());
- // The --site-per-process flag enables an out-of-process iframes
- // prototype. It works by changing the MIME type of cross-site subframe
- // responses to a Chrome specific one. This new type causes the subframe
- // to be replaced by a <webview> tag with the same URL, which results in
- // using a renderer in a different process.
- //
- // For prototyping purposes, we will use a small hack to ensure same site
- // iframes are not changed. We can compare the URL for the subframe
- // request with the referrer. If the two don't match, then it should be a
- // cross-site iframe.
- // Also, we don't do the MIME type change for chrome:// URLs, as those
- // require different privileges and are not allowed in regular renderers.
- //
- // The usage of SiteInstance::IsSameWebSite is safe on the IO thread,
- // if the browser_context parameter is NULL. This does not work for hosted
- // apps, but should be fine for prototyping.
- // TODO(nasko): Once the SiteInstance check is fixed, ensure we do the
- // right thing here. http://crbug.com/160576
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kSitePerProcess) &&
- GetRequestInfo()->GetResourceType() == ResourceType::SUB_FRAME &&
- response->head.mime_type == "text/html" &&
- !request_->url().SchemeIs(chrome::kChromeUIScheme) &&
- !SiteInstance::IsSameWebSite(NULL, request_->url(),
- GURL(request_->referrer()))) {
- response->head.mime_type = "application/browser-plugin";
- }
-
if (request_->ssl_info().cert.get()) {
int cert_id = CertStore::GetInstance()->StoreCert(
request_->ssl_info().cert.get(), info->GetChildID());
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index b46af4f..1e4083d 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -171,25 +171,8 @@ void PluginServiceImpl::Init() {
RegisterPepperPlugins();
- // The --site-per-process flag enables an out-of-process iframes
- // prototype, which uses WebView for rendering. We need to register the MIME
- // type we use with the plugin, so the renderer can instantiate it.
- const CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kSitePerProcess)) {
- WebPluginInfo webview_plugin(
- ASCIIToUTF16("WebView Tag"),
- base::FilePath(),
- ASCIIToUTF16("1.2.3.4"),
- ASCIIToUTF16("Browser Plugin."));
- webview_plugin.type = WebPluginInfo::PLUGIN_TYPE_NPAPI;
- WebPluginMimeType webview_plugin_mime_type;
- webview_plugin_mime_type.mime_type = "application/browser-plugin";
- webview_plugin_mime_type.file_extensions.push_back("*");
- webview_plugin.mime_types.push_back(webview_plugin_mime_type);
- RegisterInternalPlugin(webview_plugin, true);
- }
-
// Load any specified on the command line as well.
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
base::FilePath path =
command_line->GetSwitchValuePath(switches::kLoadPlugin);
if (!path.empty())
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 461ec96..4b76e07 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -785,12 +785,9 @@ const char kSingleProcess[] = "single-process";
// http://www.chromium.org/developers/design-documents/site-isolation
//
// Unlike --enable-strict-site-isolation (which allows cross-site iframes),
-// this flag blocks cross-site documents even in iframes, until out-of-process
-// iframe support is available. Cross-site network requests do attach the
-// normal set of cookies, but a renderer process is only allowed to view or
-// modify cookies for its own site (via JavaScript).
-// TODO(irobert): Implement the cross-site document blocking in
-// http://crbug.com/159215.
+// this flag does not affect which cookies are attached to cross-site requests.
+// Support is being added to render cross-site iframes in a different process
+// than their parent pages.
const char kSitePerProcess[] = "site-per-process";
// Skip gpu info collection, blacklist loading, and blacklist auto-update