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

Unified Diff: content/browser/webui/web_ui_message_handler.cc

Issue 1960223002: MD Downloads: reset list tracker when renderer crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asdf Created 4 years, 7 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: content/browser/webui/web_ui_message_handler.cc
diff --git a/content/browser/webui/web_ui_message_handler.cc b/content/browser/webui/web_ui_message_handler.cc
index 73f780f5ea8daab61a31f874a344120ca2af8edd..56e0adcbbaa7a1919749123f767746c17f0069fa 100644
--- a/content/browser/webui/web_ui_message_handler.cc
+++ b/content/browser/webui/web_ui_message_handler.cc
@@ -21,6 +21,16 @@ void WebUIMessageHandler::AllowJavascript() {
OnJavascriptAllowed();
}
+void WebUIMessageHandler::DisallowJavascript() {
+ if (!javascript_allowed_)
+ return;
+
+ javascript_allowed_ = false;
+ DCHECK(!IsJavascriptAllowed());
+
+ OnJavascriptDisallowed();
+}
+
bool WebUIMessageHandler::IsJavascriptAllowed() const {
return javascript_allowed_ && web_ui() && web_ui()->CanCallJavascript();
}
@@ -60,11 +70,7 @@ base::string16 WebUIMessageHandler::ExtractStringValue(
}
void WebUIMessageHandler::RenderViewReused() {
- if (!javascript_allowed_)
- return;
-
- javascript_allowed_ = false;
- OnJavascriptDisallowed();
+ DisallowJavascript();
}
} // namespace content
« no previous file with comments | « chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc ('k') | content/public/browser/web_ui_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698