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

Unified Diff: chrome/browser/extensions/active_tab_permission_granter.cc

Issue 475333006: Don't clear the activeTab permission for same-origin navigations when the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/extensions/active_tab_permission_granter.cc
diff --git a/chrome/browser/extensions/active_tab_permission_granter.cc b/chrome/browser/extensions/active_tab_permission_granter.cc
index 608eaa171c31549c8176b39df6c3d9ebb9ef7a7e..6e25db1006c10f07b0b0119a2685e735dd485eaa 100644
--- a/chrome/browser/extensions/active_tab_permission_granter.cc
+++ b/chrome/browser/extensions/active_tab_permission_granter.cc
@@ -11,6 +11,7 @@
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_messages.h"
+#include "extensions/common/feature_switch.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/user_script.h"
@@ -90,7 +91,15 @@ void ActiveTabPermissionGranter::DidNavigateMainFrame(
if (details.is_in_page)
return;
DCHECK(details.is_main_frame); // important: sub-frames don't get granted!
- ClearActiveExtensionsAndNotify();
+
+ // See http://crbug.com/404243 for why we do this. Only do this when the
+ // script-require-action flag is on, since it's not clear it's generally a
+ // good idea. However, the scripts-require-action feature is all-but unusable
+ // without this behaviour.
+ if (details.previous_url.GetOrigin() != details.entry->GetURL().GetOrigin() ||
Devlin 2014/08/15 21:24:00 I seem to recall that NavigationEntries are one of
not at google - send to devlin 2014/08/15 21:38:29 Ah yes, good point. Fixed.
+ !FeatureSwitch::scripts_require_action()->IsEnabled()) {
+ ClearActiveExtensionsAndNotify();
+ }
}
void ActiveTabPermissionGranter::WebContentsDestroyed() {

Powered by Google App Engine
This is Rietveld 408576698