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

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: Remove unnecessary RenderThread check. 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/app_process_apitest.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..08681233dbac56ee801adae66c5b3fc9b523c473 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -378,17 +378,19 @@ static bool IsWhitelistedForContentSettings(WebFrame* frame) {
// Returns true if the frame is navigating to an URL either into or out of an
// extension app's extent.
-static bool CrossesExtensionExtents(WebFrame* frame, const GURL& new_url) {
- if (!RenderThread::current())
- return false;
-
+// TODO(creis): Temporary workaround for crbug.com/65953: Only return true if
+// we would enter an extension app's extent from a non-app. We avoid swapping
+// processes to exit an app for now, since we do not yet restore context (such
+// as window.opener) if the window navigates back.
+static bool CrossesIntoExtensionExtent(WebFrame* frame, const GURL& new_url) {
// 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())
old_url = frame->opener()->url();
- return !ExtensionRendererInfo::InSameExtent(old_url, new_url);
+ return !ExtensionRendererInfo::InSameExtent(old_url, new_url) &&
+ !ExtensionRendererInfo::GetByURL(old_url);
}
// Returns the ISO 639_1 language code of the specified |text|, or 'unknown'
@@ -3001,7 +3003,10 @@ 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)) {
+ // TODO(creis): For now, we only swap processes to enter an app and not
+ // exit it, since we currently lose context (e.g., window.opener) if the
+ // window navigates back. See crbug.com/65953.
+ if (CrossesIntoExtensionExtent(frame, url)) {
// 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/app_process_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698