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

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

Issue 1896463003: WebUI: Add JavaScript lifecycle-control to WebUIMessageHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: 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 44f065d44ed6f90d94387cd2af0e9ffdbb029779..4daf294d7f0ba30b6e6c72da37aa9c36763f3480 100644
--- a/content/browser/webui/web_ui_message_handler.cc
+++ b/content/browser/webui/web_ui_message_handler.cc
@@ -11,6 +11,14 @@
namespace content {
+void WebUIMessageHandler::AllowJavascript() {
+ if (javascript_allowed_)
+ return;
+
Dan Beam 2016/04/18 23:13:20 we should be checking this was called validly here
tommycli 2016/04/19 17:45:38 Done.
+ javascript_allowed_ = true;
+ OnJavascriptAllowed();
+}
+
bool WebUIMessageHandler::ExtractIntegerValue(const base::ListValue* value,
int* out_int) {
std::string string_value;
@@ -45,4 +53,12 @@ base::string16 WebUIMessageHandler::ExtractStringValue(
return base::string16();
}
+void WebUIMessageHandler::RenderViewReused() {
+ if (!javascript_allowed_)
+ return;
+
+ javascript_allowed_ = false;
+ OnJavascriptDisallowed();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698