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

Unified Diff: Source/core/inspector/PageDebuggerAgent.cpp

Issue 1132793002: DevTools: do not enable debugger for pages where script execution is prohibited (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « Source/core/inspector/PageDebuggerAgent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/PageDebuggerAgent.cpp
diff --git a/Source/core/inspector/PageDebuggerAgent.cpp b/Source/core/inspector/PageDebuggerAgent.cpp
index f0adbadeb2bb12da4df928bea1dd823eb514652c..49e8dca3b2d8e34f1b80a89241a43d3cc7723bbf 100644
--- a/Source/core/inspector/PageDebuggerAgent.cpp
+++ b/Source/core/inspector/PageDebuggerAgent.cpp
@@ -72,8 +72,24 @@ DEFINE_TRACE(PageDebuggerAgent)
InspectorDebuggerAgent::trace(visitor);
}
+bool PageDebuggerAgent::canExecuteScripts() const
+{
+ ScriptController& scriptController = m_pageAgent->inspectedFrame()->script();
+ return scriptController.canExecuteScripts(NotAboutToExecuteScript);
+}
+
+void PageDebuggerAgent::enable(ErrorString* errorString)
+{
+ if (!canExecuteScripts()) {
+ *errorString = "Script execution is prohibited";
+ return;
+ }
+ InspectorDebuggerAgent::enable(errorString);
+}
+
void PageDebuggerAgent::enable()
{
+ ASSERT(canExecuteScripts());
InspectorDebuggerAgent::enable();
m_instrumentingAgents->setPageDebuggerAgent(this);
}
« no previous file with comments | « Source/core/inspector/PageDebuggerAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698