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

Unified Diff: chrome/browser/ui/browser.cc

Issue 10020046: Merge 131370 - Don't recreate background windows when allow_js_access if false (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: Created 8 years, 8 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/ui/browser.cc
===================================================================
--- chrome/browser/ui/browser.cc (revision 131819)
+++ chrome/browser/ui/browser.cc (working copy)
@@ -2339,18 +2339,23 @@
return false;
}
- // Only allow a single background contents per app. If one already exists,
- // close it (even if it was specified in the manifest).
+ // Only allow a single background contents per app.
+ bool allow_js_access = extension->allow_background_js_access();
BackgroundContents* existing =
service->GetAppBackgroundContents(ASCIIToUTF16(extension->id()));
if (existing) {
+ // For non-scriptable background contents, ignore the request altogether,
+ // (returning true, so that a regular WebContents isn't created either).
+ if (!allow_js_access)
+ return true;
+ // For scriptable background pages, if one already exists, close it (even
+ // if it was specified in the manifest).
DLOG(INFO) << "Closing existing BackgroundContents for " << opener_url;
delete existing;
}
// If script access is not allowed, create the the background contents in a
// new SiteInstance, so that a separate process is used.
- bool allow_js_access = extension->allow_background_js_access();
scoped_refptr<content::SiteInstance> site_instance =
allow_js_access ?
opener_site_instance :

Powered by Google App Engine
This is Rietveld 408576698