<!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>[183319] trunk/Source/JavaScriptCore</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/183319">183319</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2015-04-25 18:06:59 -0700 (Sat, 25 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Allow for pausing a JSContext when opening a Web Inspector
<rdar://problem/20564788>
Reviewed by Timothy Hatcher.
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::receivedSetupMessage):
* inspector/remote/RemoteInspectorConstants.h:
* inspector/remote/RemoteInspectorDebuggable.h:
* inspector/remote/RemoteInspectorDebuggableConnection.h:
* inspector/remote/RemoteInspectorDebuggableConnection.mm:
(Inspector::RemoteInspectorDebuggableConnection::setup):
On any incoming setup message, we may want to automatically
pause the debuggable. If requested, pause the debuggable
after we have setup the frontend connection.
* runtime/JSGlobalObjectDebuggable.h:
* runtime/JSGlobalObjectDebuggable.cpp:
(JSC::JSGlobalObjectDebuggable::pause):
Pass through to the inspector controller.
* inspector/JSGlobalObjectInspectorController.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::pause):
Enable pause on next statement.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllerh">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorConstantsh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggablecpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggableh">trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-04-25 Joseph Pecoraro <pecoraro@apple.com>
+
+ Allow for pausing a JSContext when opening a Web Inspector
+ <rdar://problem/20564788>
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/remote/RemoteInspector.mm:
+ (Inspector::RemoteInspector::receivedSetupMessage):
+ * inspector/remote/RemoteInspectorConstants.h:
+ * inspector/remote/RemoteInspectorDebuggable.h:
+ * inspector/remote/RemoteInspectorDebuggableConnection.h:
+ * inspector/remote/RemoteInspectorDebuggableConnection.mm:
+ (Inspector::RemoteInspectorDebuggableConnection::setup):
+ On any incoming setup message, we may want to automatically
+ pause the debuggable. If requested, pause the debuggable
+ after we have setup the frontend connection.
+
+ * runtime/JSGlobalObjectDebuggable.h:
+ * runtime/JSGlobalObjectDebuggable.cpp:
+ (JSC::JSGlobalObjectDebuggable::pause):
+ Pass through to the inspector controller.
+
+ * inspector/JSGlobalObjectInspectorController.h:
+ * inspector/JSGlobalObjectInspectorController.cpp:
+ (Inspector::JSGlobalObjectInspectorController::pause):
+ Enable pause on next statement.
+
</ins><span class="cx"> 2015-04-23 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> class methods should be non-enumerable
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -147,6 +147,16 @@
</span><span class="cx"> m_backendDispatcher->dispatch(message);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void JSGlobalObjectInspectorController::pause()
+{
+ if (!m_frontendChannel)
+ return;
+
+ ErrorString dummyError;
+ m_debuggerAgent->enable(dummyError);
+ m_debuggerAgent->pause(dummyError);
+}
+
</ins><span class="cx"> void JSGlobalObjectInspectorController::appendAPIBacktrace(ScriptCallStack* callStack)
</span><span class="cx"> {
</span><span class="cx"> #if OS(DARWIN) || (OS(LINUX) && !PLATFORM(GTK))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -80,6 +80,7 @@
</span><span class="cx"> bool includesNativeCallStackWhenReportingExceptions() const { return m_includeNativeCallStackWithExceptions; }
</span><span class="cx"> void setIncludesNativeCallStackWhenReportingExceptions(bool includesNativeCallStack) { m_includeNativeCallStackWithExceptions = includesNativeCallStack; }
</span><span class="cx">
</span><ins>+ void pause();
</ins><span class="cx"> void reportAPIException(JSC::ExecState*, JSC::JSValue exception);
</span><span class="cx">
</span><span class="cx"> JSC::ConsoleClient* consoleClient() const;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -568,7 +568,8 @@
</span><span class="cx"> RemoteInspectorDebuggableInfo debuggableInfo = it->value.second;
</span><span class="cx"> RefPtr<RemoteInspectorDebuggableConnection> connection = adoptRef(new RemoteInspectorDebuggableConnection(debuggable, connectionIdentifier, sender, debuggableInfo.type));
</span><span class="cx"> bool isAutomaticInspection = m_automaticInspectionCandidateIdentifier == debuggable->identifier();
</span><del>- if (!connection->setup(isAutomaticInspection)) {
</del><ins>+ bool automaticallyPause = [[userInfo objectForKey:WIRAutomaticallyPause] boolValue];
+ if (!connection->setup(isAutomaticInspection, automaticallyPause)) {
</ins><span class="cx"> connection->close();
</span><span class="cx"> return;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorConstantsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx"> #define WIRTypeKey @"WIRTypeKey"
</span><span class="cx"> #define WIRTypeJavaScript @"WIRTypeJavaScript"
</span><span class="cx"> #define WIRTypeWeb @"WIRTypeWeb"
</span><ins>+#define WIRAutomaticallyPause @"WIRAutomaticallyPause"
</ins><span class="cx">
</span><span class="cx"> #define WIRAutomaticInspectionEnabledKey @"WIRAutomaticInspectionEnabledKey"
</span><span class="cx"> #define WIRAutomaticInspectionSessionIdentifierKey @"WIRAutomaticInspectionSessionIdentifierKey"
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> virtual void disconnect() = 0;
</span><span class="cx"> virtual void dispatchMessageFromRemoteFrontend(const String& message) = 0;
</span><span class="cx"> virtual void setIndicating(bool) { } // Default is to do nothing.
</span><ins>+ virtual void pause() { };
</ins><span class="cx">
</span><span class="cx"> virtual bool automaticInspectionAllowed() const { return false; }
</span><span class="cx"> virtual void pauseWaitingForAutomaticInspection();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> NSString *connectionIdentifier() const;
</span><span class="cx"> unsigned identifier() const { return m_identifier; }
</span><span class="cx">
</span><del>- bool setup(bool isAutomaticInspection);
</del><ins>+ bool setup(bool isAutomaticInspection, bool automaticallyPause);
</ins><span class="cx">
</span><span class="cx"> void close();
</span><span class="cx"> void closeFromDebuggable();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx"> RemoteInspectorQueueTaskOnGlobalQueue(block);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RemoteInspectorDebuggableConnection::setup(bool isAutomaticInspection)
</del><ins>+bool RemoteInspectorDebuggableConnection::setup(bool isAutomaticInspection, bool automaticallyPause)
</ins><span class="cx"> {
</span><span class="cx"> std::lock_guard<std::mutex> lock(m_debuggableMutex);
</span><span class="cx">
</span><span class="lines">@@ -167,6 +167,9 @@
</span><span class="cx"> } else {
</span><span class="cx"> m_debuggable->connect(this, isAutomaticInspection);
</span><span class="cx"> m_connected = true;
</span><ins>+
+ if (automaticallyPause)
+ m_debuggable->pause();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> deref();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -63,6 +63,13 @@
</span><span class="cx"> m_globalObject.inspectorController().disconnectFrontend(DisconnectReason::InspectorDestroyed);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void JSGlobalObjectDebuggable::pause()
+{
+ JSLockHolder locker(&m_globalObject.vm());
+
+ m_globalObject.inspectorController().pause();
+}
+
</ins><span class="cx"> void JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend(const String& message)
</span><span class="cx"> {
</span><span class="cx"> JSLockHolder locker(&m_globalObject.vm());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h (183318 => 183319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h        2015-04-26 00:59:47 UTC (rev 183318)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h        2015-04-26 01:06:59 UTC (rev 183319)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> virtual void connect(Inspector::FrontendChannel*, bool automaticInspection) override;
</span><span class="cx"> virtual void disconnect() override;
</span><span class="cx"> virtual void dispatchMessageFromRemoteFrontend(const String& message) override;
</span><ins>+ virtual void pause() override;
</ins><span class="cx">
</span><span class="cx"> virtual bool automaticInspectionAllowed() const override { return true; }
</span><span class="cx"> virtual void pauseWaitingForAutomaticInspection() override;
</span></span></pre>
</div>
</div>
</body>
</html>