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

Unified Diff: chrome/renderer/render_view.cc

Issue 5766003: Temporarily avoid process swaps for renderer navigations away from an app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only swap for non-app URLs Created 10 years 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
« no previous file with comments | « chrome/browser/extensions/extension_browsertests_misc.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index f62a2e97fdbee4ef76cdf022aa77debd66836845..ed043ae8446287d65ddd0a035dc1fd7b28652990 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -391,6 +391,20 @@ static bool CrossesExtensionExtents(WebFrame* frame, const GURL& new_url) {
return !ExtensionRendererInfo::InSameExtent(old_url, new_url);
}
+// Returns true if the frame is in an extension app's extent.
+static bool InExtensionExtent(WebFrame* frame) {
+ if (!RenderThread::current())
darin (slow to review) 2010/12/14 17:17:40 what is the purpose of this null check? i don't s
Charlie Reis 2010/12/14 18:52:29 We don't need this function anymore, but the same
+ return false;
+
+ // If the URL is still empty, this is a window.open navigation. Check the
+ // opener's URL.
+ GURL old_url(frame->url());
+ if (old_url.is_empty() && frame->opener())
darin (slow to review) 2010/12/14 17:17:40 Why do you bother checking frame->opener() here?
Charlie Reis 2010/12/14 18:52:29 No longer needed here, but still used in CrossesEx
+ old_url = frame->opener()->url();
+
+ return ExtensionRendererInfo::GetByURL(old_url) != NULL;
+}
+
// Returns the ISO 639_1 language code of the specified |text|, or 'unknown'
// if it failed.
static std::string DetermineTextLanguage(const string16& text) {
@@ -3001,7 +3015,13 @@ WebNavigationPolicy RenderView::decidePolicyForNavigation(
// TODO(erikkay) This is happening inside of a check to is_content_initiated
// which means that things like the back button won't trigger it. Is that
// OK?
- if (CrossesExtensionExtents(frame, url)) {
+ if (CrossesExtensionExtents(frame, url) &&
+ // Temporary workaround for crbug.com/65953: Only swap processes if we
darin (slow to review) 2010/12/14 17:17:40 nit: Comments like this should have a TODO(creis)
Charlie Reis 2010/12/14 18:52:29 Done.
+ // are not already in an app, and only if window.opener is null, since
+ // we do not yet restore window.opener if the window navigates back to
+ // this process later.
+ !InExtensionExtent(frame) &&
+ frame->opener() == NULL) {
darin (slow to review) 2010/12/14 17:17:40 style nit: prefer "!frame->opener()"
Charlie Reis 2010/12/14 18:52:29 Simplified by removing this part of the check and
// Include the referrer in this case since we're going from a hosted web
// page. (the packaged case is handled previously by the extension
// navigation test)
« no previous file with comments | « chrome/browser/extensions/extension_browsertests_misc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698