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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/PageDebuggerAgent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 DEFINE_TRACE(PageDebuggerAgent) 67 DEFINE_TRACE(PageDebuggerAgent)
68 { 68 {
69 visitor->trace(m_pageScriptDebugServer); 69 visitor->trace(m_pageScriptDebugServer);
70 visitor->trace(m_pageAgent); 70 visitor->trace(m_pageAgent);
71 visitor->trace(m_overlay); 71 visitor->trace(m_overlay);
72 InspectorDebuggerAgent::trace(visitor); 72 InspectorDebuggerAgent::trace(visitor);
73 } 73 }
74 74
75 bool PageDebuggerAgent::canExecuteScripts() const
76 {
77 ScriptController& scriptController = m_pageAgent->inspectedFrame()->script() ;
78 return scriptController.canExecuteScripts(NotAboutToExecuteScript);
79 }
80
81 void PageDebuggerAgent::enable(ErrorString* errorString)
82 {
83 if (!canExecuteScripts()) {
84 *errorString = "Script execution is prohibited";
85 return;
86 }
87 InspectorDebuggerAgent::enable(errorString);
88 }
89
75 void PageDebuggerAgent::enable() 90 void PageDebuggerAgent::enable()
76 { 91 {
92 ASSERT(canExecuteScripts());
77 InspectorDebuggerAgent::enable(); 93 InspectorDebuggerAgent::enable();
78 m_instrumentingAgents->setPageDebuggerAgent(this); 94 m_instrumentingAgents->setPageDebuggerAgent(this);
79 } 95 }
80 96
81 void PageDebuggerAgent::disable() 97 void PageDebuggerAgent::disable()
82 { 98 {
83 InspectorDebuggerAgent::disable(); 99 InspectorDebuggerAgent::disable();
84 m_instrumentingAgents->setPageDebuggerAgent(0); 100 m_instrumentingAgents->setPageDebuggerAgent(0);
85 } 101 }
86 102
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return; 167 return;
152 reset(); 168 reset();
153 } 169 }
154 170
155 void PageDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) 171 void PageDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*)
156 { 172 {
157 resetModifiedSources(); 173 resetModifiedSources();
158 } 174 }
159 175
160 } // namespace blink 176 } // namespace blink
OLDNEW
« 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