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

Unified Diff: chrome/browser/ui/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/unload_controller.cc
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc
index a30878d4f8401ef91a6bb32f0c9d2d675f9e32f5..af1ec1e1dc1f8bddc78fd062393dbd78f5560236 100644
--- a/chrome/browser/ui/unload_controller.cc
+++ b/chrome/browser/ui/unload_controller.cc
@@ -17,6 +17,8 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/browser/extension_registry.h"
+#include "extensions/common/constants.h"
namespace chrome {
@@ -51,6 +53,14 @@ bool UnloadController::ShouldRunUnloadEventsHelper(
}
bool UnloadController::RunUnloadEventsHelper(content::WebContents* contents) {
+ GURL url = contents->GetLastCommittedURL();
Charlie Reis 2016/09/21 18:29:33 Same.
Devlin 2016/09/22 00:35:21 Done.
+ if (url.SchemeIs(extensions::kExtensionScheme) &&
+ !extensions::ExtensionRegistry::Get(browser_->profile())
+ ->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