OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 PageDebuggerAgent::~PageDebuggerAgent() | 59 PageDebuggerAgent::~PageDebuggerAgent() |
60 { | 60 { |
61 } | 61 } |
62 | 62 |
63 DEFINE_TRACE(PageDebuggerAgent) | 63 DEFINE_TRACE(PageDebuggerAgent) |
64 { | 64 { |
65 visitor->trace(m_inspectedFrames); | 65 visitor->trace(m_inspectedFrames); |
66 InspectorDebuggerAgent::trace(visitor); | 66 InspectorDebuggerAgent::trace(visitor); |
67 } | 67 } |
68 | 68 |
69 bool PageDebuggerAgent::canExecuteScripts() const | |
70 { | |
71 ScriptController& scriptController = m_inspectedFrames->root()->script(); | |
72 return scriptController.canExecuteScripts(NotAboutToExecuteScript); | |
73 } | |
74 | |
75 void PageDebuggerAgent::enable(ErrorString* errorString) | 69 void PageDebuggerAgent::enable(ErrorString* errorString) |
76 { | 70 { |
77 if (!canExecuteScripts()) { | |
78 *errorString = "Script execution is prohibited"; | |
79 return; | |
80 } | |
81 InspectorDebuggerAgent::enable(errorString); | 71 InspectorDebuggerAgent::enable(errorString); |
82 } | 72 } |
83 | 73 |
84 void PageDebuggerAgent::disable(ErrorString* errorString) | 74 void PageDebuggerAgent::disable(ErrorString* errorString) |
85 { | 75 { |
86 m_compiledScriptURLs.clear(); | 76 m_compiledScriptURLs.clear(); |
87 InspectorDebuggerAgent::disable(errorString); | 77 InspectorDebuggerAgent::disable(errorString); |
88 } | 78 } |
89 | 79 |
90 void PageDebuggerAgent::restore() | 80 void PageDebuggerAgent::restore() |
91 { | 81 { |
92 if (canExecuteScripts()) | 82 InspectorDebuggerAgent::restore(); |
93 InspectorDebuggerAgent::restore(); | |
94 } | 83 } |
95 | 84 |
96 | 85 |
97 } // namespace blink | 86 } // namespace blink |
OLD | NEW |