<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173333] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173333">173333</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-05 14:08:14 -0700 (Fri, 05 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: breakpoint actions should work regardless of Content Security Policy
https://bugs.webkit.org/show_bug.cgi?id=136542

Patch by Matt Baker &lt;mattbaker@apple.com&gt; on 2014-09-05
Reviewed by Mark Lam.

Source/JavaScriptCore:

Added JSC::DebuggerEvalEnabler, an RAII object which enables eval on a
JSGlobalObject for the duration of a scope, returning the eval enabled state to its
original value when the scope exits. Used by JSC::DebuggerCallFrame::evaluate
to allow breakpoint actions to execute JS in pages with a Content Security Policy
that would normally prohibit this (such as Inspector's Main.html).

Refactored Inspector::InjectedScriptBase to use the RAII object instead of manually
setting eval enabled and then resetting the original eval enabled state.

NOTE: The JS::DebuggerEvalEnabler constructor checks the passed in ExecState pointer
for null to be equivalent with the original code in Inspector::InjectedScriptBase.
InjectedScriptBase is getting the ExecState from ScriptObject::scriptState(), which
can currently be null.

* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluate):
* debugger/DebuggerEvalEnabler.h: Added.
(JSC::DebuggerEvalEnabler::DebuggerEvalEnabler):
(JSC::DebuggerEvalEnabler::~DebuggerEvalEnabler):
* inspector/InjectedScriptBase.cpp:
(Inspector::InjectedScriptBase::callFunctionWithEvalEnabled):

LayoutTests:

Added test for &quot;Evaluate JavaScript&quot; breakpoint actions for breakpoints set on
pages with a CSP that does not allow 'unsafe-eval'.

* inspector/debugger/breakpoint-action-eval-expected.txt: Added.
* inspector/debugger/breakpoint-action-eval.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp">trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScriptBasecpp">trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectordebuggerbreakpointactionevalexpectedtxt">trunk/LayoutTests/inspector/debugger/breakpoint-action-eval-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggerbreakpointactionevalhtml">trunk/LayoutTests/inspector/debugger/breakpoint-action-eval.html</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggerEvalEnablerh">trunk/Source/JavaScriptCore/debugger/DebuggerEvalEnabler.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (173332 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-05 20:57:55 UTC (rev 173332)
+++ trunk/LayoutTests/ChangeLog        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-09-05  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: breakpoint actions should work regardless of Content Security Policy
+        https://bugs.webkit.org/show_bug.cgi?id=136542
+
+        Reviewed by Mark Lam.
+
+        Added test for &quot;Evaluate JavaScript&quot; breakpoint actions for breakpoints set on
+        pages with a CSP that does not allow 'unsafe-eval'.
+
+        * inspector/debugger/breakpoint-action-eval-expected.txt: Added.
+        * inspector/debugger/breakpoint-action-eval.html: Added.
+
</ins><span class="cx"> 2014-09-05  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [SOUP] Implement ResourceResponse::platformSuggestedFilename() when USE(SOUP) is enabled.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggerbreakpointactionevalexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/debugger/breakpoint-action-eval-expected.txt (0 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/breakpoint-action-eval-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-action-eval-expected.txt        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Testing that &quot;Evaluate JavaScript&quot; breakpoint actions work correctly in the presense of a Content Security Policy that doesn't include 'unsafe-eval'.
+
+inside breakpointActions a:(42) b:([object Object])
+Breakpoint action evaluated. a:(42) b:([object Object])
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggerbreakpointactionevalhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/debugger/breakpoint-action-eval.html (0 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/breakpoint-action-eval.html                                (rev 0)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-action-eval.html        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'self' 'unsafe-inline'&quot;&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../http/tests/inspector/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../http/tests/inspector/debugger/debugger-test.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;./resources/breakpoint.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function runBreakpointActions()
+{
+    setTimeout(function() { breakpointActions(42, {x:220, y:284}); }, 0);
+}
+
+function action(a, b)
+{
+    InspectorTestProxy.addResult(&quot;Breakpoint action evaluated. a:(&quot; + a + &quot;) b:(&quot; + b + &quot;)&quot;);
+    InspectorTestProxy.completeTest();
+}
+
+function test()
+{
+    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+        var scriptObject = event.data.script;
+
+        if (!/breakpoint\.js$/.test(scriptObject.url))
+            return;
+
+        var location = scriptObject.createSourceCodeLocation(4, 0);
+        // Create the breakpoint and its actions before sending anything to the backend.
+        var breakpoint = new WebInspector.Breakpoint(location);
+        breakpoint.autoContinue = true;
+        breakpoint.createAction(WebInspector.BreakpointAction.Type.Evaluate, null, &quot;action(a, b)&quot;);
+
+        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+
+        InspectorTest.evaluateInPage(&quot;runBreakpointActions()&quot;);
+    });
+
+    InspectorTest.reloadPage();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+    &lt;p&gt;Testing that &quot;Evaluate JavaScript&quot; breakpoint actions work correctly in the presense of a Content Security Policy that doesn't include 'unsafe-eval'.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (173332 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-09-05 20:57:55 UTC (rev 173332)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-09-05  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: breakpoint actions should work regardless of Content Security Policy
+        https://bugs.webkit.org/show_bug.cgi?id=136542
+
+        Reviewed by Mark Lam.
+
+        Added JSC::DebuggerEvalEnabler, an RAII object which enables eval on a 
+        JSGlobalObject for the duration of a scope, returning the eval enabled state to its
+        original value when the scope exits. Used by JSC::DebuggerCallFrame::evaluate 
+        to allow breakpoint actions to execute JS in pages with a Content Security Policy
+        that would normally prohibit this (such as Inspector's Main.html).
+
+        Refactored Inspector::InjectedScriptBase to use the RAII object instead of manually
+        setting eval enabled and then resetting the original eval enabled state.
+
+        NOTE: The JS::DebuggerEvalEnabler constructor checks the passed in ExecState pointer
+        for null to be equivalent with the original code in Inspector::InjectedScriptBase.
+        InjectedScriptBase is getting the ExecState from ScriptObject::scriptState(), which
+        can currently be null.
+
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * debugger/DebuggerCallFrame.cpp:
+        (JSC::DebuggerCallFrame::evaluate):
+        * debugger/DebuggerEvalEnabler.h: Added.
+        (JSC::DebuggerEvalEnabler::DebuggerEvalEnabler):
+        (JSC::DebuggerEvalEnabler::~DebuggerEvalEnabler):
+        * inspector/InjectedScriptBase.cpp:
+        (Inspector::InjectedScriptBase::callFunctionWithEvalEnabled):
+
</ins><span class="cx"> 2014-09-05  peavo@outlook.com  &lt;peavo@outlook.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WinCairo] jsc.exe won't run.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj (173332 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2014-09-05 20:57:55 UTC (rev 173332)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -974,6 +974,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\debugger\Breakpoint.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\debugger\Debugger.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\debugger\DebuggerCallFrame.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\debugger\DebuggerEvalEnabler.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\debugger\DebuggerPrimitives.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\debugger\DebuggerScope.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\dfg\DFGAbstractHeap.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters (173332 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2014-09-05 20:57:55 UTC (rev 173332)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -1958,6 +1958,9 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\debugger\DebuggerCallFrame.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;debugger&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\debugger\DebuggerEvalEnabler.h&quot;&gt;
+      &lt;Filter&gt;debugger&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\debugger\DebuggerPrimitives.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;debugger&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (173332 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-09-05 20:57:55 UTC (rev 173332)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -1172,6 +1172,7 @@
</span><span class="cx">                 65C0285C1717966800351E35 /* ARMv7DOpcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C0285A1717966800351E35 /* ARMv7DOpcode.cpp */; };
</span><span class="cx">                 65C0285D1717966800351E35 /* ARMv7DOpcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C0285B1717966800351E35 /* ARMv7DOpcode.h */; };
</span><span class="cx">                 65FB5117184EEE7000C12B70 /* ProtoCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */; };
</span><ins>+                6AD2CB4D19B9140100065719 /* DebuggerEvalEnabler.h in Headers */ = {isa = PBXBuildFile; fileRef = 6AD2CB4C19B9140100065719 /* DebuggerEvalEnabler.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7C008CD2186F8A9300955C24 /* JSPromiseFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C008CD0186F8A9300955C24 /* JSPromiseFunctions.cpp */; };
</span><span class="cx">                 7C008CD3186F8A9300955C24 /* JSPromiseFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C008CD1186F8A9300955C24 /* JSPromiseFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7C008CDA187124BB00955C24 /* JSPromiseDeferred.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C008CD8187124BB00955C24 /* JSPromiseDeferred.cpp */; };
</span><span class="lines">@@ -2811,6 +2812,7 @@
</span><span class="cx">                 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonIdentifiers.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 65FB5115184EE8F800C12B70 /* ProtoCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtoCallFrame.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtoCallFrame.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                6AD2CB4C19B9140100065719 /* DebuggerEvalEnabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerEvalEnabler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 704FD35305697E6D003DBED9 /* BooleanObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BooleanObject.h; sourceTree = &quot;&lt;group&gt;&quot;; tabWidth = 8; };
</span><span class="cx">                 7C008CD0186F8A9300955C24 /* JSPromiseFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = JSPromiseFunctions.cpp; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
</span><span class="cx">                 7C008CD1186F8A9300955C24 /* JSPromiseFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPromiseFunctions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4216,6 +4218,7 @@
</span><span class="cx">                                 F692A8590255597D01FF60F7 /* Debugger.h */,
</span><span class="cx">                                 149559ED0DDCDDF700648087 /* DebuggerCallFrame.cpp */,
</span><span class="cx">                                 1480DB9B0DDC227F003CFDF2 /* DebuggerCallFrame.h */,
</span><ins>+                                6AD2CB4C19B9140100065719 /* DebuggerEvalEnabler.h */,
</ins><span class="cx">                                 FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */,
</span><span class="cx">                                 0F2D4DDB19832D34007D4B19 /* DebuggerScope.cpp */,
</span><span class="cx">                                 0F2D4DDC19832D34007D4B19 /* DebuggerScope.h */,
</span><span class="lines">@@ -5752,6 +5755,7 @@
</span><span class="cx">                                 A1A009C11831A26E00CF8711 /* ARM64Assembler.h in Headers */,
</span><span class="cx">                                 86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */,
</span><span class="cx">                                 C49FE4AB19AAC86100F40CE9 /* generate_protocol_types_header.py in Headers */,
</span><ins>+                                6AD2CB4D19B9140100065719 /* DebuggerEvalEnabler.h in Headers */,
</ins><span class="cx">                                 C49FE4AC19AAC86100F40CE9 /* generate_protocol_types_implementation.py in Headers */,
</span><span class="cx">                                 658D3A5619638268003C45D6 /* VMEntryRecord.h in Headers */,
</span><span class="cx">                                 2AD2EDFB19799E38004D6478 /* EnumerationMode.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp (173332 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2014-09-05 20:57:55 UTC (rev 173332)
+++ trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;DebuggerCallFrame.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CodeBlock.h&quot;
</span><ins>+#include &quot;DebuggerEvalEnabler.h&quot;
</ins><span class="cx"> #include &quot;DebuggerScope.h&quot;
</span><span class="cx"> #include &quot;Interpreter.h&quot;
</span><span class="cx"> #include &quot;JSActivation.h&quot;
</span><span class="lines">@@ -186,6 +187,7 @@
</span><span class="cx">     if (!callFrame-&gt;codeBlock())
</span><span class="cx">         return JSValue();
</span><span class="cx">     
</span><ins>+    DebuggerEvalEnabler evalEnabler(callFrame);
</ins><span class="cx">     VM&amp; vm = callFrame-&gt;vm();
</span><span class="cx">     EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), callFrame-&gt;codeBlock()-&gt;isStrictMode());
</span><span class="cx">     if (vm.exception()) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerEvalEnablerh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/debugger/DebuggerEvalEnabler.h (0 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/DebuggerEvalEnabler.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/debugger/DebuggerEvalEnabler.h        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DebuggerEvalEnabler_h
+#define DebuggerEvalEnabler_h
+
+#include &quot;CallFrame.h&quot;
+#include &quot;JSGlobalObject.h&quot;
+
+namespace JSC {
+
+class DebuggerEvalEnabler {
+public:
+    explicit DebuggerEvalEnabler(const ExecState* exec)
+        : m_exec(exec)
+        , m_evalWasDisabled(false)
+    {
+        if (exec) {
+            JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
+            m_evalWasDisabled = !globalObject-&gt;evalEnabled();
+            if (m_evalWasDisabled)
+                globalObject-&gt;setEvalEnabled(true, globalObject-&gt;evalDisabledErrorMessage());
+        }
+    }
+
+    ~DebuggerEvalEnabler()
+    {
+        if (m_evalWasDisabled) {
+            JSGlobalObject* globalObject = m_exec-&gt;lexicalGlobalObject();
+            globalObject-&gt;setEvalEnabled(false, globalObject-&gt;evalDisabledErrorMessage());
+        }
+    }
+
+private:
+    const ExecState* m_exec;
+    bool m_evalWasDisabled;
+};
+
+} // namespace JSC
+
+#endif // DebuggerEvalEnabler_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp (173332 => 173333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp        2014-09-05 20:57:55 UTC (rev 173332)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp        2014-09-05 21:08:14 UTC (rev 173333)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx"> 
</span><ins>+#include &quot;DebuggerEvalEnabler.h&quot;
</ins><span class="cx"> #include &quot;InspectorValues.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &quot;JSGlobalObject.h&quot;
</span><span class="lines">@@ -81,19 +82,13 @@
</span><span class="cx">         m_environment-&gt;willCallInjectedScriptFunction(m_injectedScriptObject.scriptState(), name(), 1);
</span><span class="cx"> 
</span><span class="cx">     JSC::ExecState* scriptState = m_injectedScriptObject.scriptState();
</span><del>-    bool evalIsDisabled = false;
-    if (scriptState) {
-        evalIsDisabled = !scriptState-&gt;lexicalGlobalObject()-&gt;evalEnabled();
-        // Temporarily enable allow evals for inspector.
-        if (evalIsDisabled)
-            scriptState-&gt;lexicalGlobalObject()-&gt;setEvalEnabled(true);
</del><ins>+    Deprecated::ScriptValue resultValue;
+
+    {
+        JSC::DebuggerEvalEnabler evalEnabler(scriptState);
+        resultValue = function.call(hadException);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Deprecated::ScriptValue resultValue = function.call(hadException);
-
-    if (evalIsDisabled)
-        scriptState-&gt;lexicalGlobalObject()-&gt;setEvalEnabled(false);
-
</del><span class="cx">     if (m_environment)
</span><span class="cx">         m_environment-&gt;didCallInjectedScriptFunction(m_injectedScriptObject.scriptState());
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>