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

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

Issue 2355183002: [Extensions] Don't run unload listeners when an extension is removed (Closed)
Patch Set: ready Created 4 years, 3 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/fast_unload_controller.cc
diff --git a/chrome/browser/ui/fast_unload_controller.cc b/chrome/browser/ui/fast_unload_controller.cc
index f0577567cf6954b3b9301a5314ab721e5a3b683d..be5dae9059ea044edbd57fc22705c75bcefe20e6 100644
--- a/chrome/browser/ui/fast_unload_controller.cc
+++ b/chrome/browser/ui/fast_unload_controller.cc
@@ -22,10 +22,11 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
+#include "extensions/browser/extension_registry.h"
+#include "extensions/common/constants.h"
namespace chrome {
-
////////////////////////////////////////////////////////////////////////////////
// DetachedWebContentsDelegate will delete web contents when they close.
class FastUnloadController::DetachedWebContentsDelegate
@@ -82,6 +83,14 @@ bool FastUnloadController::ShouldRunUnloadEventsHelper(
bool FastUnloadController::RunUnloadEventsHelper(
content::WebContents* contents) {
+ GURL url = contents->GetLastCommittedURL();
Charlie Reis 2016/09/21 18:29:33 Let's add a comment, like: Don't run unload for ex
Devlin 2016/09/22 00:35:21 Done.
+ if (url.SchemeIs(extensions::kExtensionScheme) &&
+ !extensions::ExtensionRegistry::Get(browser_->profile())
Charlie Reis 2016/09/21 18:29:33 You would know better than I do, but does this nee
Devlin 2016/09/22 00:35:21 Probably should, yes. Added. An OWNER here can d
+ ->enabled_extensions()
+ .GetExtensionOrAppByURL(url)) {
+ return false;
+ }
+
// Special case for when we quit an application. The Devtools window can
// close if it's beforeunload event has already fired which will happen due
// to the interception of it's content's beforeunload.

Powered by Google App Engine
This is Rietveld 408576698