<!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>[188803] trunk/Source</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/188803">188803</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2015-08-21 16:57:07 -0700 (Fri, 21 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Debugger's VM should never be null
https://bugs.webkit.org/show_bug.cgi?id=148341
Reviewed by Joseph Pecoraro.
It doesn't make sense for a Debugger's VM to be null, and code related
to maintaining that illusion just caused the Web Inspector to crash on
launch (https://bugs.webkit.org/show_bug.cgi?id=148312). So, let's stop
doing that.
Now, Debugger requires its subclass to provide a never-null VM&.
Source/JavaScriptCore:
Also took the opportunity, based on review feedback, to remove some
confusion in the virtual recompileAllJSFunctions hierarchy, by eliminating
the pure virtual in ScriptDebugServer and the unnecessary override in
JSGlobalObjectScriptDebugServer.
* debugger/Debugger.cpp:
(JSC::Debugger::Debugger):
(JSC::Debugger::attach):
(JSC::Debugger::detach):
(JSC::Debugger::isAttached):
(JSC::Debugger::setSteppingMode):
(JSC::Debugger::registerCodeBlock):
(JSC::Debugger::toggleBreakpoint):
(JSC::Debugger::recompileAllJSFunctions):
(JSC::Debugger::setBreakpoint):
(JSC::Debugger::clearBreakpoints):
(JSC::Debugger::clearDebuggerRequests):
(JSC::Debugger::setBreakpointsActivated):
(JSC::Debugger::breakProgram):
(JSC::Debugger::stepOutOfFunction):
(JSC::Debugger::returnEvent):
(JSC::Debugger::didExecuteProgram):
* debugger/Debugger.h:
* inspector/JSGlobalObjectScriptDebugServer.cpp:
(Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer):
(Inspector::JSGlobalObjectScriptDebugServer::recompileAllJSFunctions):
(Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused):
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::ScriptDebugServer):
* inspector/ScriptDebugServer.h:
Source/WebCore:
* bindings/js/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer):
(WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
(WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused):
* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::recompileAllJSFunctions):
(WebCore::PageScriptDebugServer::didPause):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggercpp">trunk/Source/JavaScriptCore/debugger/Debugger.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggerh">trunk/Source/JavaScriptCore/debugger/Debugger.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectScriptDebugServercpp">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectScriptDebugServerh">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorScriptDebugServercpp">trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorScriptDebugServerh">trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsWorkerScriptDebugServercpp">trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageScriptDebugServercpp">trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebScriptDebuggermm">trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2015-08-21 Geoffrey Garen <ggaren@apple.com>
+
+ Debugger's VM should never be null
+ https://bugs.webkit.org/show_bug.cgi?id=148341
+
+ Reviewed by Joseph Pecoraro.
+
+ It doesn't make sense for a Debugger's VM to be null, and code related
+ to maintaining that illusion just caused the Web Inspector to crash on
+ launch (https://bugs.webkit.org/show_bug.cgi?id=148312). So, let's stop
+ doing that.
+
+ Now, Debugger requires its subclass to provide a never-null VM&.
+
+ Also took the opportunity, based on review feedback, to remove some
+ confusion in the virtual recompileAllJSFunctions hierarchy, by eliminating
+ the pure virtual in ScriptDebugServer and the unnecessary override in
+ JSGlobalObjectScriptDebugServer.
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::Debugger):
+ (JSC::Debugger::attach):
+ (JSC::Debugger::detach):
+ (JSC::Debugger::isAttached):
+ (JSC::Debugger::setSteppingMode):
+ (JSC::Debugger::registerCodeBlock):
+ (JSC::Debugger::toggleBreakpoint):
+ (JSC::Debugger::recompileAllJSFunctions):
+ (JSC::Debugger::setBreakpoint):
+ (JSC::Debugger::clearBreakpoints):
+ (JSC::Debugger::clearDebuggerRequests):
+ (JSC::Debugger::setBreakpointsActivated):
+ (JSC::Debugger::breakProgram):
+ (JSC::Debugger::stepOutOfFunction):
+ (JSC::Debugger::returnEvent):
+ (JSC::Debugger::didExecuteProgram):
+ * debugger/Debugger.h:
+ * inspector/JSGlobalObjectScriptDebugServer.cpp:
+ (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer):
+ (Inspector::JSGlobalObjectScriptDebugServer::recompileAllJSFunctions):
+ (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused):
+ * inspector/ScriptDebugServer.cpp:
+ (Inspector::ScriptDebugServer::ScriptDebugServer):
+ * inspector/ScriptDebugServer.h:
+
</ins><span class="cx"> 2015-08-21 Basile Clement <basile_clement@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove unused code relative to allocation sinking
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/Debugger.cpp (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/Debugger.cpp        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/JavaScriptCore/debugger/Debugger.cpp        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -79,8 +79,8 @@
</span><span class="cx"> Debugger& m_debugger;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-Debugger::Debugger(bool isInWorkerThread)
- : m_vm(nullptr)
</del><ins>+Debugger::Debugger(VM& vm, bool isInWorkerThread)
+ : m_vm(vm)
</ins><span class="cx"> , m_pauseOnExceptionsState(DontPauseOnExceptions)
</span><span class="cx"> , m_pauseOnNextStatement(false)
</span><span class="cx"> , m_isPaused(false)
</span><span class="lines">@@ -108,16 +108,12 @@
</span><span class="cx"> void Debugger::attach(JSGlobalObject* globalObject)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!globalObject->debugger());
</span><del>- if (!m_vm)
- m_vm = &globalObject->vm();
- else
- ASSERT(m_vm == &globalObject->vm());
</del><span class="cx"> globalObject->setDebugger(this);
</span><span class="cx"> m_globalObjects.add(globalObject);
</span><span class="cx">
</span><span class="cx"> // Call sourceParsed() because it will execute JavaScript in the inspector.
</span><del>- for (size_t i = 0; i < m_vm->heap.compiledCode().size(); ++i) {
- ExecutableBase* base = m_vm->heap.compiledCode()[i];
</del><ins>+ for (size_t i = 0; i < m_vm.heap.compiledCode().size(); ++i) {
+ ExecutableBase* base = m_vm.heap.compiledCode()[i];
</ins><span class="cx"> if (!base->isFunctionExecutable())
</span><span class="cx"> continue;
</span><span class="cx"> FunctionExecutable* executable = static_cast<FunctionExecutable*>(base);
</span><span class="lines">@@ -146,8 +142,6 @@
</span><span class="cx"> clearDebuggerRequests(globalObject);
</span><span class="cx">
</span><span class="cx"> globalObject->setDebugger(0);
</span><del>- if (!m_globalObjects.size())
- m_vm = nullptr;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Debugger::isAttached(JSGlobalObject* globalObject)
</span><span class="lines">@@ -181,12 +175,12 @@
</span><span class="cx">
</span><span class="cx"> void Debugger::setSteppingMode(SteppingMode mode)
</span><span class="cx"> {
</span><del>- if (mode == m_steppingMode || !m_vm)
</del><ins>+ if (mode == m_steppingMode)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_steppingMode = mode;
</span><span class="cx"> SetSteppingModeFunctor functor(this, mode);
</span><del>- m_vm->heap.forEachCodeBlock(functor);
</del><ins>+ m_vm.heap.forEachCodeBlock(functor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Debugger::registerCodeBlock(CodeBlock* codeBlock)
</span><span class="lines">@@ -271,15 +265,13 @@
</span><span class="cx">
</span><span class="cx"> void Debugger::toggleBreakpoint(Breakpoint& breakpoint, Debugger::BreakpointState enabledOrNot)
</span><span class="cx"> {
</span><del>- if (!m_vm)
- return;
</del><span class="cx"> ToggleBreakpointFunctor functor(this, breakpoint, enabledOrNot);
</span><del>- m_vm->heap.forEachCodeBlock(functor);
</del><ins>+ m_vm.heap.forEachCodeBlock(functor);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Debugger::recompileAllJSFunctions(VM* vm)
</del><ins>+void Debugger::recompileAllJSFunctions()
</ins><span class="cx"> {
</span><del>- vm->deleteAllCode();
</del><ins>+ m_vm.deleteAllCode();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BreakpointID Debugger::setBreakpoint(Breakpoint breakpoint, unsigned& actualLine, unsigned& actualColumn)
</span><span class="lines">@@ -444,10 +436,8 @@
</span><span class="cx"> m_breakpointIDToBreakpoint.clear();
</span><span class="cx"> m_sourceIDToBreakpoints.clear();
</span><span class="cx">
</span><del>- if (!m_vm)
- return;
</del><span class="cx"> ClearCodeBlockDebuggerRequestsFunctor functor(this);
</span><del>- m_vm->heap.forEachCodeBlock(functor);
</del><ins>+ m_vm.heap.forEachCodeBlock(functor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class Debugger::ClearDebuggerRequestsFunctor {
</span><span class="lines">@@ -470,9 +460,8 @@
</span><span class="cx">
</span><span class="cx"> void Debugger::clearDebuggerRequests(JSGlobalObject* globalObject)
</span><span class="cx"> {
</span><del>- ASSERT(m_vm);
</del><span class="cx"> ClearDebuggerRequestsFunctor functor(globalObject);
</span><del>- m_vm->heap.forEachCodeBlock(functor);
</del><ins>+ m_vm.heap.forEachCodeBlock(functor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Debugger::setBreakpointsActivated(bool activated)
</span><span class="lines">@@ -499,7 +488,7 @@
</span><span class="cx">
</span><span class="cx"> m_pauseOnNextStatement = true;
</span><span class="cx"> setSteppingMode(SteppingModeEnabled);
</span><del>- m_currentCallFrame = m_vm->topCallFrame;
</del><ins>+ m_currentCallFrame = m_vm.topCallFrame;
</ins><span class="cx"> ASSERT(m_currentCallFrame);
</span><span class="cx"> pauseIfNeeded(m_currentCallFrame);
</span><span class="cx"> }
</span><span class="lines">@@ -537,7 +526,7 @@
</span><span class="cx"> if (!m_isPaused)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
</del><ins>+ VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
</ins><span class="cx"> m_pauseOnCallFrame = m_currentCallFrame ? m_currentCallFrame->callerFrame(topVMEntryFrame) : 0;
</span><span class="cx"> notifyDoneProcessingDebuggerEvents();
</span><span class="cx"> }
</span><span class="lines">@@ -661,11 +650,11 @@
</span><span class="cx">
</span><span class="cx"> // Treat stepping over a return statement like stepping out.
</span><span class="cx"> if (m_currentCallFrame == m_pauseOnCallFrame) {
</span><del>- VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
</del><ins>+ VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
</ins><span class="cx"> m_pauseOnCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
</del><ins>+ VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
</ins><span class="cx"> m_currentCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -696,12 +685,12 @@
</span><span class="cx"> if (!m_currentCallFrame)
</span><span class="cx"> return;
</span><span class="cx"> if (m_currentCallFrame == m_pauseOnCallFrame) {
</span><del>- VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
</del><ins>+ VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
</ins><span class="cx"> m_pauseOnCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
</span><span class="cx"> if (!m_currentCallFrame)
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- VMEntryFrame* topVMEntryFrame = m_vm->topVMEntryFrame;
</del><ins>+ VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
</ins><span class="cx"> m_currentCallFrame = m_currentCallFrame->callerFrame(topVMEntryFrame);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/Debugger.h (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/Debugger.h        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/JavaScriptCore/debugger/Debugger.h        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -44,9 +44,11 @@
</span><span class="cx">
</span><span class="cx"> class JS_EXPORT_PRIVATE Debugger {
</span><span class="cx"> public:
</span><del>- Debugger(bool isInWorkerThread = false);
</del><ins>+ Debugger(VM&, bool isInWorkerThread = false);
</ins><span class="cx"> virtual ~Debugger();
</span><span class="cx">
</span><ins>+ VM& vm() { return m_vm; }
+
</ins><span class="cx"> JSC::DebuggerCallFrame* currentDebuggerCallFrame() const;
</span><span class="cx"> bool hasHandlerForExceptionCallback() const
</span><span class="cx"> {
</span><span class="lines">@@ -118,7 +120,7 @@
</span><span class="cx"> void didExecuteProgram(CallFrame*);
</span><span class="cx"> void didReachBreakpoint(CallFrame*);
</span><span class="cx">
</span><del>- void recompileAllJSFunctions(VM*);
</del><ins>+ virtual void recompileAllJSFunctions();
</ins><span class="cx">
</span><span class="cx"> void registerCodeBlock(CodeBlock*);
</span><span class="cx">
</span><span class="lines">@@ -185,7 +187,7 @@
</span><span class="cx">
</span><span class="cx"> void clearDebuggerRequests(JSGlobalObject*);
</span><span class="cx">
</span><del>- VM* m_vm;
</del><ins>+ VM& m_vm;
</ins><span class="cx"> HashSet<JSGlobalObject*> m_globalObjects;
</span><span class="cx">
</span><span class="cx"> PauseOnExceptionsState m_pauseOnExceptionsState;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectScriptDebugServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> namespace Inspector {
</span><span class="cx">
</span><span class="cx"> JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer(JSGlobalObject& globalObject)
</span><del>- : ScriptDebugServer(false)
</del><ins>+ : ScriptDebugServer(globalObject.vm(), false)
</ins><span class="cx"> , m_globalObject(globalObject)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -70,11 +70,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void JSGlobalObjectScriptDebugServer::recompileAllJSFunctions()
-{
- JSC::Debugger::recompileAllJSFunctions(&m_globalObject.vm());
-}
-
</del><span class="cx"> void JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused()
</span><span class="cx"> {
</span><span class="cx"> // Drop all locks so another thread can work in the VM while we are nested.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectScriptDebugServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -42,8 +42,6 @@
</span><span class="cx">
</span><span class="cx"> JSC::JSGlobalObject& globalObject() const { return m_globalObject; }
</span><span class="cx">
</span><del>- virtual void recompileAllJSFunctions() override;
-
</del><span class="cx"> private:
</span><span class="cx"> virtual ListenerSet& getListeners() override { return m_listeners; }
</span><span class="cx"> virtual void didPause(JSC::JSGlobalObject*) override { }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorScriptDebugServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -47,8 +47,8 @@
</span><span class="cx">
</span><span class="cx"> namespace Inspector {
</span><span class="cx">
</span><del>-ScriptDebugServer::ScriptDebugServer(bool isInWorkerThread)
- : Debugger(isInWorkerThread)
</del><ins>+ScriptDebugServer::ScriptDebugServer(VM& vm, bool isInWorkerThread)
+ : Debugger(vm, isInWorkerThread)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorScriptDebugServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> class ExecState;
</span><span class="cx"> class JSGlobalObject;
</span><ins>+class VM;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace Inspector {
</span><span class="lines">@@ -56,8 +57,6 @@
</span><span class="cx"> void removeBreakpoint(JSC::BreakpointID);
</span><span class="cx"> void clearBreakpoints();
</span><span class="cx">
</span><del>- virtual void recompileAllJSFunctions() = 0;
-
</del><span class="cx"> const BreakpointActions& getActionsForBreakpoint(JSC::BreakpointID);
</span><span class="cx">
</span><span class="cx"> class Task {
</span><span class="lines">@@ -71,7 +70,7 @@
</span><span class="cx"> typedef HashSet<ScriptDebugListener*> ListenerSet;
</span><span class="cx"> typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*);
</span><span class="cx">
</span><del>- ScriptDebugServer(bool isInWorkerThread = false);
</del><ins>+ ScriptDebugServer(JSC::VM&, bool isInWorkerThread = false);
</ins><span class="cx"> ~ScriptDebugServer();
</span><span class="cx">
</span><span class="cx"> virtual ListenerSet& getListeners() = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/WebCore/ChangeLog        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-08-21 Geoffrey Garen <ggaren@apple.com>
+
+ Debugger's VM should never be null
+ https://bugs.webkit.org/show_bug.cgi?id=148341
+
+ Reviewed by Joseph Pecoraro.
+
+ It doesn't make sense for a Debugger's VM to be null, and code related
+ to maintaining that illusion just caused the Web Inspector to crash on
+ launch (https://bugs.webkit.org/show_bug.cgi?id=148312). So, let's stop
+ doing that.
+
+ Now, Debugger requires its subclass to provide a never-null VM&.
+
+ * bindings/js/WorkerScriptDebugServer.cpp:
+ (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer):
+ (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
+ (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused):
+ * inspector/PageScriptDebugServer.cpp:
+ (WebCore::PageScriptDebugServer::recompileAllJSFunctions):
+ (WebCore::PageScriptDebugServer::didPause):
+
</ins><span class="cx"> 2015-08-21 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> [OS X] Remove dead code from FontCache::systemFallbackForCharacters()
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsWorkerScriptDebugServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> WorkerScriptDebugServer::WorkerScriptDebugServer(WorkerGlobalScope* context, const String& mode)
</span><del>- : ScriptDebugServer(true)
</del><ins>+ : ScriptDebugServer(context->script()->vm(), true)
</ins><span class="cx"> , m_workerGlobalScope(context)
</span><span class="cx"> , m_debuggerTaskMode(mode)
</span><span class="cx"> {
</span><span class="lines">@@ -82,10 +82,8 @@
</span><span class="cx">
</span><span class="cx"> void WorkerScriptDebugServer::recompileAllJSFunctions()
</span><span class="cx"> {
</span><del>- JSC::VM& vm = m_workerGlobalScope->script()->vm();
-
- JSC::JSLockHolder lock(vm);
- JSC::Debugger::recompileAllJSFunctions(&vm);
</del><ins>+ JSC::JSLockHolder lock(vm());
+ JSC::Debugger::recompileAllJSFunctions();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WorkerScriptDebugServer::runEventLoopWhilePaused()
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageScriptDebugServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> PageScriptDebugServer::PageScriptDebugServer(Page& page)
</span><del>- : ScriptDebugServer(false)
</del><ins>+ : ScriptDebugServer(WebCore::JSDOMWindowBase::commonVM(), false)
</ins><span class="cx"> , m_page(page)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -87,8 +87,8 @@
</span><span class="cx">
</span><span class="cx"> void PageScriptDebugServer::recompileAllJSFunctions()
</span><span class="cx"> {
</span><del>- JSLockHolder lock(JSDOMWindow::commonVM());
- Debugger::recompileAllJSFunctions(&JSDOMWindow::commonVM());
</del><ins>+ JSLockHolder lock(vm());
+ Debugger::recompileAllJSFunctions();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageScriptDebugServer::didPause(JSGlobalObject*)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> // we need to gracefully handle releasing and reacquiring the lock.
</span><span class="cx"> if (WebThreadIsEnabled()) {
</span><span class="cx"> ASSERT(WebThreadIsLockedOrDisabled());
</span><del>- JSC::JSLock::DropAllLocks dropAllLocks(WebCore::JSDOMWindowBase::commonVM());
</del><ins>+ JSC::JSLock::DropAllLocks dropAllLocks(vm());
</ins><span class="cx"> WebRunLoopEnableNested();
</span><span class="cx">
</span><span class="cx"> runEventLoopWhilePausedInternal();
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebScriptDebuggermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm (188802 => 188803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm        2015-08-21 23:50:21 UTC (rev 188802)
+++ trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm        2015-08-21 23:57:07 UTC (rev 188803)
</span><span class="lines">@@ -72,7 +72,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebScriptDebugger::WebScriptDebugger(JSGlobalObject* globalObject)
</span><del>- : m_callingDelegate(false)
</del><ins>+ : Debugger(globalObject->vm())
+ , m_callingDelegate(false)
</ins><span class="cx"> , m_globalObject(globalObject->vm(), globalObject)
</span><span class="cx"> {
</span><span class="cx"> setPauseOnExceptionsState(PauseOnAllExceptions);
</span></span></pre>
</div>
</div>
</body>
</html>