<!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>[42187] trunk/WebCore</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/42187">42187</a></dd>
<dt>Author</dt> <dd>dglazkov@chromium.org</dd>
<dt>Date</dt> <dd>2009-04-02 14:48:16 -0700 (Thu, 02 Apr 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>2009-04-02  Dimitri Glazkov  &lt;dglazkov@chromium.org&gt;

        Reviewed by Timothy Hatcher.

        https://bugs.webkit.org/show_bug.cgi?id=25010
        Refactor InspectorController to replace all JS function invocations with
        ScriptFunctionCall.

        * bindings/js/ScriptFunctionCall.cpp:
        (WebCore::ScriptFunctionCall::appendArgument): Added int, UString,
            and JSValuePtr methods.
        (WebCore::ScriptFunctionCall::call): Added simplified, exception-eating
            method.
        * bindings/js/ScriptFunctionCall.h: Decls for above.
        * bindings/js/ScriptObjectQuarantine.cpp: Added helper for Node and DOMWindow.
        (WebCore::getQuarantinedScriptObject):
        * bindings/js/ScriptObjectQuarantine.h: Decls for above.
        * inspector/InspectorController.cpp:
        (WebCore::callSimpleFunction): Made into a static.
        (WebCore::InspectorController::focusNode): Refactored to use ScriptFunctionCall.
        (WebCore::InspectorController::toggleRecordButton): Ditto.
        (WebCore::InspectorController::startGroup): Ditto.
        (WebCore::InspectorController::setAttachedWindow): Ditto.
        (WebCore::InspectorController::inspectedWindowScriptObjectCleared): Ditto.
        (WebCore::InspectorController::addScriptProfile): Ditto.
        (WebCore::InspectorController::didParseSource): Ditto.
        (WebCore::InspectorController::failedToParseSource): Ditto.
        (WebCore::InspectorController::didPause): Ditto.
        * inspector/InspectorController.h: Removed callFunction and callSimpleFunction
            decls.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorebindingsjsScriptFunctionCallcpp">trunk/WebCore/bindings/js/ScriptFunctionCall.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsScriptFunctionCallh">trunk/WebCore/bindings/js/ScriptFunctionCall.h</a></li>
<li><a href="#trunkWebCorebindingsjsScriptObjectQuarantinecpp">trunk/WebCore/bindings/js/ScriptObjectQuarantine.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsScriptObjectQuarantineh">trunk/WebCore/bindings/js/ScriptObjectQuarantine.h</a></li>
<li><a href="#trunkWebCoreinspectorInspectorControllercpp">trunk/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkWebCoreinspectorInspectorControllerh">trunk/WebCore/inspector/InspectorController.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (42186 => 42187)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-04-02 21:30:01 UTC (rev 42186)
+++ trunk/WebCore/ChangeLog        2009-04-02 21:48:16 UTC (rev 42187)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2009-04-02  Dimitri Glazkov  &lt;dglazkov@chromium.org&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25010
+        Refactor InspectorController to replace all JS function invocations with
+        ScriptFunctionCall.
+
+        * bindings/js/ScriptFunctionCall.cpp:
+        (WebCore::ScriptFunctionCall::appendArgument): Added int, UString,
+            and JSValuePtr methods.
+        (WebCore::ScriptFunctionCall::call): Added simplified, exception-eating
+            method.
+        * bindings/js/ScriptFunctionCall.h: Decls for above.
+        * bindings/js/ScriptObjectQuarantine.cpp: Added helper for Node and DOMWindow.
+        (WebCore::getQuarantinedScriptObject):
+        * bindings/js/ScriptObjectQuarantine.h: Decls for above.
+        * inspector/InspectorController.cpp:
+        (WebCore::callSimpleFunction): Made into a static.
+        (WebCore::InspectorController::focusNode): Refactored to use ScriptFunctionCall.
+        (WebCore::InspectorController::toggleRecordButton): Ditto.
+        (WebCore::InspectorController::startGroup): Ditto.
+        (WebCore::InspectorController::setAttachedWindow): Ditto.
+        (WebCore::InspectorController::inspectedWindowScriptObjectCleared): Ditto.
+        (WebCore::InspectorController::addScriptProfile): Ditto.
+        (WebCore::InspectorController::didParseSource): Ditto.
+        (WebCore::InspectorController::failedToParseSource): Ditto.
+        (WebCore::InspectorController::didPause): Ditto.
+        * inspector/InspectorController.h: Removed callFunction and callSimpleFunction
+            decls.
+
</ins><span class="cx"> 2009-04-02  Jian Li  &lt;jianli@chromium.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Darin Fisher.
</span></span></pre></div>
<a id="trunkWebCorebindingsjsScriptFunctionCallcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/ScriptFunctionCall.cpp (42186 => 42187)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/ScriptFunctionCall.cpp        2009-04-02 21:30:01 UTC (rev 42186)
+++ trunk/WebCore/bindings/js/ScriptFunctionCall.cpp        2009-04-02 21:48:16 UTC (rev 42187)
</span><span class="lines">@@ -34,7 +34,9 @@
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><span class="cx"> #include &quot;ScriptString.h&quot;
</span><span class="cx"> #include &quot;ScriptValue.h&quot;
</span><ins>+
</ins><span class="cx"> #include &lt;runtime/JSLock.h&gt;
</span><ins>+#include &lt;runtime/UString.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace JSC;
</span><span class="cx"> 
</span><span class="lines">@@ -68,6 +70,16 @@
</span><span class="cx">     m_arguments.append(jsString(m_exec, argument));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScriptFunctionCall::appendArgument(const JSC::UString&amp; argument)
+{
+    m_arguments.append(jsString(m_exec, argument));
+}
+
+void ScriptFunctionCall::appendArgument(JSC::JSValuePtr argument)
+{
+    m_arguments.append(argument);
+}
+
</ins><span class="cx"> void ScriptFunctionCall::appendArgument(long long argument)
</span><span class="cx"> {
</span><span class="cx">     JSLock lock(false);
</span><span class="lines">@@ -80,6 +92,12 @@
</span><span class="cx">     m_arguments.append(jsNumber(m_exec, argument));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScriptFunctionCall::appendArgument(int argument)
+{
+    JSLock lock(false);
+    m_arguments.append(jsNumber(m_exec, argument));
+}
+
</ins><span class="cx"> void ScriptFunctionCall::appendArgument(bool argument)
</span><span class="cx"> {
</span><span class="cx">     m_arguments.append(jsBoolean(argument));
</span><span class="lines">@@ -113,6 +131,12 @@
</span><span class="cx">     return ScriptValue(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ScriptValue ScriptFunctionCall::call()
+{
+    bool hadException = false;
+    return call(hadException);
+}
+
</ins><span class="cx"> ScriptObject ScriptFunctionCall::construct(bool&amp; hadException)
</span><span class="cx"> {
</span><span class="cx">     JSObject* thisObject = m_thisObject.jsObject();
</span></span></pre></div>
<a id="trunkWebCorebindingsjsScriptFunctionCallh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/ScriptFunctionCall.h (42186 => 42187)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/ScriptFunctionCall.h        2009-04-02 21:30:01 UTC (rev 42186)
+++ trunk/WebCore/bindings/js/ScriptFunctionCall.h        2009-04-02 21:48:16 UTC (rev 42187)
</span><span class="lines">@@ -37,6 +37,11 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;runtime/ArgList.h&gt;
</span><span class="cx"> 
</span><ins>+namespace JSC {
+    class UString;
+    class JSValuePtr;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">     class ScriptValue;
</span><span class="cx">     class ScriptString;
</span><span class="lines">@@ -50,10 +55,14 @@
</span><span class="cx">         void appendArgument(const ScriptString&amp;);
</span><span class="cx">         void appendArgument(const ScriptValue&amp;);
</span><span class="cx">         void appendArgument(const String&amp;);
</span><ins>+        void appendArgument(const JSC::UString&amp;);
+        void appendArgument(JSC::JSValuePtr);
</ins><span class="cx">         void appendArgument(long long);
</span><span class="cx">         void appendArgument(unsigned int);
</span><ins>+        void appendArgument(int);
</ins><span class="cx">         void appendArgument(bool);
</span><span class="cx">         ScriptValue call(bool&amp; hadException);
</span><ins>+        ScriptValue call();
</ins><span class="cx">         ScriptObject construct(bool&amp; hadException);
</span><span class="cx"> 
</span><span class="cx">     protected:
</span></span></pre></div>
<a id="trunkWebCorebindingsjsScriptObjectQuarantinecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/ScriptObjectQuarantine.cpp (42186 => 42187)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/ScriptObjectQuarantine.cpp        2009-04-02 21:30:01 UTC (rev 42186)
+++ trunk/WebCore/bindings/js/ScriptObjectQuarantine.cpp        2009-04-02 21:48:16 UTC (rev 42187)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include &quot;JSStorage.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><span class="cx"> #include &quot;JSInspectedObjectWrapper.h&quot;
</span><ins>+#include &quot;JSNode.h&quot;
</ins><span class="cx"> #include &quot;ScriptObject.h&quot;
</span><span class="cx"> #include &quot;ScriptValue.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -82,4 +83,30 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool getQuarantinedScriptObject(Node* node, ScriptObject&amp; quarantinedObject)
+{
+    ExecState* exec = scriptStateFromNode(node);
+    if (!exec)
+        return false;
+
+    JSLock lock(false);
+    quarantinedObject = ScriptObject(asObject(JSInspectedObjectWrapper::wrap(exec, toJS(exec, node))));
+
+    return true;
+}
+
+bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject&amp; quarantinedObject)
+{
+    ASSERT(domWindow);
+
+    JSDOMWindow* window = toJSDOMWindow(domWindow-&gt;frame());
+    ExecState* exec = window-&gt;globalExec();
+
+    JSLock lock(false);
+    quarantinedObject = ScriptObject(asObject(JSInspectedObjectWrapper::wrap(exec, window)));
+
+    return true;
+}
+
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCorebindingsjsScriptObjectQuarantineh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/ScriptObjectQuarantine.h (42186 => 42187)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/ScriptObjectQuarantine.h        2009-04-02 21:30:01 UTC (rev 42186)
+++ trunk/WebCore/bindings/js/ScriptObjectQuarantine.h        2009-04-02 21:48:16 UTC (rev 42187)
</span><span class="lines">@@ -36,7 +36,9 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx">     class Database;
</span><ins>+    class DOMWindow;
</ins><span class="cx">     class Frame;
</span><ins>+    class Node;
</ins><span class="cx">     class ScriptObject;
</span><span class="cx">     class ScriptValue;
</span><span class="cx">     class Storage;
</span><span class="lines">@@ -45,6 +47,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool getQuarantinedScriptObject(Database* database, ScriptObject&amp; quarantinedObject);
</span><span class="cx">     bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject&amp; quarantinedObject);
</span><ins>+    bool getQuarantinedScriptObject(Node* node, ScriptObject&amp; quarantinedObject);
+    bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject&amp; quarantinedObject);
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/inspector/InspectorController.cpp (42186 => 42187)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/inspector/InspectorController.cpp        2009-04-02 21:30:01 UTC (rev 42186)
+++ trunk/WebCore/inspector/InspectorController.cpp        2009-04-02 21:48:16 UTC (rev 42187)
</span><span class="lines">@@ -67,6 +67,9 @@
</span><span class="cx"> #include &quot;ResourceResponse.h&quot;
</span><span class="cx"> #include &quot;ScriptCallStack.h&quot;
</span><span class="cx"> #include &quot;ScriptController.h&quot;
</span><ins>+#include &quot;ScriptFunctionCall.h&quot;
+#include &quot;ScriptObject.h&quot;
+#include &quot;ScriptObjectQuarantine.h&quot;
</ins><span class="cx"> #include &quot;ScriptString.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="lines">@@ -115,21 +118,6 @@
</span><span class="cx">     return JSRetainPtr&lt;JSStringRef&gt;(Adopt, JSStringCreateWithUTF8CString(str));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static JSRetainPtr&lt;JSStringRef&gt; jsStringRef(const SourceCode&amp; str)
-{
-    return JSRetainPtr&lt;JSStringRef&gt;(Adopt, JSStringCreateWithCharacters(str.data(), str.length()));
-}
-
-static JSRetainPtr&lt;JSStringRef&gt; jsStringRef(const String&amp; str)
-{
-    return JSRetainPtr&lt;JSStringRef&gt;(Adopt, JSStringCreateWithCharacters(str.characters(), str.length()));
-}
-
-static JSRetainPtr&lt;JSStringRef&gt; jsStringRef(const UString&amp; str)
-{
-    return JSRetainPtr&lt;JSStringRef&gt;(Adopt, OpaqueJSString::create(str).releaseRef());
-}
-
</del><span class="cx"> static String toString(JSContextRef context, JSValueRef value, JSValueRef* exception)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_ARG(value, value);
</span><span class="lines">@@ -143,35 +131,12 @@
</span><span class="cx"> 
</span><span class="cx"> #define HANDLE_EXCEPTION(context, exception) handleException((context), (exception), __LINE__)
</span><span class="cx"> 
</span><del>-JSValueRef InspectorController::callSimpleFunction(JSContextRef context, JSObjectRef thisObject, const char* functionName) const
</del><ins>+static void callSimpleFunction(JSContextRef context, JSObjectRef thisObject, const char* functionName)
</ins><span class="cx"> {
</span><del>-    JSValueRef exception = 0;
-    return callFunction(context, thisObject, functionName, 0, 0, exception);
</del><ins>+    ScriptFunctionCall function(toJS(context), toJS(thisObject), functionName);
+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValueRef InspectorController::callFunction(JSContextRef context, JSObjectRef thisObject, const char* functionName, size_t argumentCount, const JSValueRef arguments[], JSValueRef&amp; exception) const
-{
-    ASSERT_ARG(context, context);
-    ASSERT_ARG(thisObject, thisObject);
-
-    if (exception)
-        return JSValueMakeUndefined(context);
-
-    JSValueRef functionProperty = JSObjectGetProperty(context, thisObject, jsStringRef(functionName).get(), &amp;exception);
-    if (HANDLE_EXCEPTION(context, exception))
-        return JSValueMakeUndefined(context);
-
-    JSObjectRef function = JSValueToObject(context, functionProperty, &amp;exception);
-    if (HANDLE_EXCEPTION(context, exception))
-        return JSValueMakeUndefined(context);
-
-    JSValueRef result = JSObjectCallAsFunction(context, function, thisObject, argumentCount, arguments, &amp;exception);
-    if (HANDLE_EXCEPTION(context, exception))
-        return JSValueMakeUndefined(context);
-
-    return result;
-}
-
</del><span class="cx"> bool InspectorController::addSourceToFrame(const String&amp; mimeType, const String&amp; source, Node* frameNode)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_ARG(frameNode, frameNode);
</span><span class="lines">@@ -409,23 +374,16 @@
</span><span class="cx">     ASSERT(m_scriptObject);
</span><span class="cx">     ASSERT(m_nodeToFocus);
</span><span class="cx"> 
</span><del>-    Frame* frame = m_nodeToFocus-&gt;document()-&gt;frame();
-    if (!frame)
</del><ins>+    ScriptObject quarantinedNode;
+    if (!getQuarantinedScriptObject(m_nodeToFocus.get(), quarantinedNode))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    ExecState* exec = toJSDOMWindow(frame)-&gt;globalExec();
</del><ins>+    ScriptFunctionCall function(toJS(m_scriptContext), toJS(m_scriptObject), &quot;updateFocusedNode&quot;);
+    function.appendArgument(quarantinedNode);
</ins><span class="cx"> 
</span><del>-    JSValueRef arg0;
-
-    {
-        JSC::JSLock lock(false);
-        arg0 = toRef(JSInspectedObjectWrapper::wrap(exec, toJS(exec, m_nodeToFocus.get())));
-    }
-
</del><span class="cx">     m_nodeToFocus = 0;
</span><span class="cx"> 
</span><del>-    JSValueRef exception = 0;
-    callFunction(m_scriptContext, m_scriptObject, &quot;updateFocusedNode&quot;, 1, &amp;arg0, exception);
</del><ins>+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::highlight(Node* node)
</span><span class="lines">@@ -527,13 +485,13 @@
</span><span class="cx">     if (!m_scriptContext)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    JSValueRef exception = 0;
-    JSValueRef isProvingValue = JSValueMakeBoolean(m_scriptContext, isProfiling);
-    callFunction(m_scriptContext, m_scriptObject, &quot;setRecordingProfile&quot;, 1, &amp;isProvingValue, exception);
</del><ins>+    ScriptFunctionCall function(toJS(m_scriptContext), toJS(m_scriptObject), &quot;setRecordingProfile&quot;);
+    function.appendArgument(isProfiling);
+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack)
</span><del>-{    
</del><ins>+{
</ins><span class="cx">     ++m_groupLevel;
</span><span class="cx"> 
</span><span class="cx">     addConsoleMessage(callStack-&gt;state(), new ConsoleMessage(source, StartGroupMessageLevel, callStack, m_groupLevel));
</span><span class="lines">@@ -594,10 +552,9 @@
</span><span class="cx">     if (!enabled() || !m_scriptContext || !m_scriptObject)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    JSValueRef attachedValue = JSValueMakeBoolean(m_scriptContext, attached);
-
-    JSValueRef exception = 0;
-    callFunction(m_scriptContext, m_scriptObject, &quot;setAttachedWindow&quot;, 1, &amp;attachedValue, exception);
</del><ins>+    ScriptFunctionCall function(toJS(m_scriptContext), toJS(m_scriptObject), &quot;setAttachedWindow&quot;);
+    function.appendArgument(attached);
+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::setAttachedWindowHeight(unsigned height)
</span><span class="lines">@@ -646,18 +603,13 @@
</span><span class="cx">     if (!enabled() || !m_scriptContext || !m_scriptObject)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    JSDOMWindow* win = toJSDOMWindow(frame);
-    ExecState* exec = win-&gt;globalExec();
</del><ins>+    ScriptObject domWindow;
+    if (!getQuarantinedScriptObject(frame-&gt;domWindow(), domWindow))
+        return;
</ins><span class="cx"> 
</span><del>-    JSValueRef arg0;
-
-    {
-        JSC::JSLock lock(false);
-        arg0 = toRef(JSInspectedObjectWrapper::wrap(exec, win));
-    }
-
-    JSValueRef exception = 0;
-    callFunction(m_scriptContext, m_scriptObject, &quot;inspectedWindowCleared&quot;, 1, &amp;arg0, exception);
</del><ins>+    ScriptFunctionCall function(toJS(m_scriptContext), toJS(m_scriptObject), &quot;inspectedWindowCleared&quot;);
+    function.appendArgument(domWindow);
+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::windowScriptObjectAvailable()
</span><span class="lines">@@ -904,10 +856,10 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::addScriptProfile(Profile* profile)
</span><span class="cx"> {
</span><ins>+    ScriptFunctionCall function(toJS(m_scriptContext), toJS(m_scriptObject), &quot;addProfile&quot;);
</ins><span class="cx">     JSLock lock(false);
</span><del>-    JSValueRef exception = 0;
-    JSValueRef profileObject = toRef(toJS(toJS(m_scriptContext), profile));
-    callFunction(m_scriptContext, m_scriptObject, &quot;addProfile&quot;, 1, &amp;profileObject, exception);
</del><ins>+    function.appendArgument(toJS(toJS(m_scriptContext), profile));
+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::resetScriptObjects()
</span><span class="lines">@@ -1564,33 +1516,28 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::didParseSource(ExecState*, const SourceCode&amp; source)
</span><span class="cx"> {
</span><del>-    JSValueRef sourceIDValue = JSValueMakeNumber(m_scriptContext, source.provider()-&gt;asID());
-    JSValueRef sourceURLValue = JSValueMakeString(m_scriptContext, jsStringRef(source.provider()-&gt;url()).get());
-    JSValueRef sourceValue = JSValueMakeString(m_scriptContext, jsStringRef(source).get());
-    JSValueRef firstLineValue = JSValueMakeNumber(m_scriptContext, source.firstLine());
-
-    JSValueRef exception = 0;
-    JSValueRef arguments[] = { sourceIDValue, sourceURLValue, sourceValue, firstLineValue };
-    callFunction(m_scriptContext, m_scriptObject, &quot;parsedScriptSource&quot;, 4, arguments, exception);
</del><ins>+    ScriptFunctionCall function(toJS(m_scriptContext), toJS(m_scriptObject), &quot;parsedScriptSource&quot;);
+    function.appendArgument(static_cast&lt;long long&gt;(source.provider()-&gt;asID()));
+    function.appendArgument(source.provider()-&gt;url());
+    function.appendArgument(source.data());
+    function.appendArgument(source.firstLine());
+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::failedToParseSource(ExecState*, const SourceCode&amp; source, int errorLine, const UString&amp; errorMessage)
</span><span class="cx"> {
</span><del>-    JSValueRef sourceURLValue = JSValueMakeString(m_scriptContext, jsStringRef(source.provider()-&gt;url()).get());
-    JSValueRef sourceValue = JSValueMakeString(m_scriptContext, jsStringRef(source.data()).get());
-    JSValueRef firstLineValue = JSValueMakeNumber(m_scriptContext, source.firstLine());
-    JSValueRef errorLineValue = JSValueMakeNumber(m_scriptContext, errorLine);
-    JSValueRef errorMessageValue = JSValueMakeString(m_scriptContext, jsStringRef(errorMessage).get());
-
-    JSValueRef exception = 0;
-    JSValueRef arguments[] = { sourceURLValue, sourceValue, firstLineValue, errorLineValue, errorMessageValue };
-    callFunction(m_scriptContext, m_scriptObject, &quot;failedToParseScriptSource&quot;, 5, arguments, exception);
</del><ins>+    ScriptFunctionCall function(toJS(m_scriptContext), toJS(m_scriptObject), &quot;failedToParseScriptSource&quot;);
+    function.appendArgument(source.provider()-&gt;url());
+    function.appendArgument(source.data());
+    function.appendArgument(source.firstLine());
+    function.appendArgument(errorLine);
+    function.appendArgument(errorMessage);
+    function.call();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::didPause()
</span><span class="cx"> {
</span><del>-    JSValueRef exception = 0;
-    callFunction(m_scriptContext, m_scriptObject, &quot;pausedScript&quot;, 0, 0, exception);
</del><ins>+    callSimpleFunction(m_scriptContext, m_scriptObject, &quot;pausedScript&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkWebCoreinspectorInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/inspector/InspectorController.h (42186 => 42187)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/inspector/InspectorController.h        2009-04-02 21:30:01 UTC (rev 42186)
+++ trunk/WebCore/inspector/InspectorController.h        2009-04-02 21:48:16 UTC (rev 42187)
</span><span class="lines">@@ -275,9 +275,6 @@
</span><span class="cx">     void pruneResources(ResourcesMap*, DocumentLoader* loaderToKeep = 0);
</span><span class="cx">     void removeAllResources(ResourcesMap* map) { pruneResources(map); }
</span><span class="cx"> 
</span><del>-    JSValueRef callSimpleFunction(JSContextRef, JSObjectRef thisObject, const char* functionName) const;
-    JSValueRef callFunction(JSContextRef, JSObjectRef thisObject, const char* functionName, size_t argumentCount, const JSValueRef arguments[], JSValueRef&amp; exception) const;
-
</del><span class="cx">     bool handleException(JSContextRef, JSValueRef exception, unsigned lineNumber) const;
</span><span class="cx"> 
</span><span class="cx">     void showWindow();
</span></span></pre>
</div>
</div>

</body>
</html>