<!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>[80188] 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/80188">80188</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2011-03-02 17:17:45 -0800 (Wed, 02 Mar 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make the runJavaScriptInMainFrame callback send a WKSerializedScriptValueRef.

Source/WebCore: Export SerializedScriptValue::create(JSC::ExecState* exec, JSC::JSValue value).

Reviewed by Darin Adler.

* WebCore.exp.in: Added __ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueE.

Source/WebKit2: Make the runJavaScriptInMainFrame callback send a WKSerializedScriptValueRef.

https://webkit.org/b/55623

Reviewed by Darin Adler.

* UIProcess/API/C/WKPage.cpp:
(WKPageRunJavaScriptInMainFrame): Use ScriptValueCallback.
(callRunJavaScriptBlockAndRelease): Use WKSerializedScriptValueRef.
* UIProcess/API/C/WKPage.h: Use WKSerializedScriptValueRef.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close): Call invalidateCallbackMap for m_scriptValueCallbacks.
(WebKit::WebPageProxy::runJavaScriptInMainFrame): Take a ScriptValueCallback.
(WebKit::WebPageProxy::scriptValueCallback): Added. Create a WebSerializedScriptValue
from the DataReference before calling the callback.
(WebKit::WebPageProxy::processDidCrash): Call invalidateCallbackMap for m_scriptValueCallbacks.
* UIProcess/WebPageProxy.h: Added ScriptValueCallback and m_scriptValueCallbacks.
* UIProcess/WebPageProxy.messages.in: Added ScriptValueCallback.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScriptInMainFrame): Create a DataReference from a WebCore::SerializedScriptValue.
And use ScriptValueCallback to send the message back.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagecpp">trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPageh">trunk/Source/WebKit2/UIProcess/API/C/WKPage.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebCore/ChangeLog      2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -1,3 +1,11 @@
</span><ins>+2011-03-02  Timothy Hatcher  <timothy@apple.com>
+
+        Export SerializedScriptValue::create(JSC::ExecState* exec, JSC::JSValue value).
+
+        Reviewed by Darin Adler.
+
+        * WebCore.exp.in: Added __ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueE.
+
</ins><span class="cx"> 2011-03-02  Daniel Cheng  <dcheng@chromium.org>
</span><span class="cx"> 
</span><span class="cx">         Reviewed by David Levin.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in      2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebCore/WebCore.exp.in 2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -528,6 +528,7 @@
</span><span class="cx"> __ZN7WebCore21SVGDocumentExtensions21sampleAnimationAtTimeERKN3WTF6StringEPNS_14SVGSMILElementEd
</span><span class="cx"> __ZN7WebCore21SerializedScriptValue11deserializeEPK15OpaqueJSContextPPK13OpaqueJSValue
</span><span class="cx"> __ZN7WebCore21SerializedScriptValue6createEPK15OpaqueJSContextPK13OpaqueJSValuePS6_
</span><ins>+__ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueE
</ins><span class="cx"> __ZN7WebCore21SerializedScriptValueC1ERN3WTF6VectorIhLm0EEE
</span><span class="cx"> __ZN7WebCore21SerializedScriptValueD1Ev
</span><span class="cx"> __ZN7WebCore21UserContentURLPattern5parseERKN3WTF6StringE
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog   2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebKit2/ChangeLog      2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2011-03-02  Timothy Hatcher  <timothy@apple.com>
+
+        Make the runJavaScriptInMainFrame callback send a WKSerializedScriptValueRef.
+
+        https://webkit.org/b/55623
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageRunJavaScriptInMainFrame): Use ScriptValueCallback.
+        (callRunJavaScriptBlockAndRelease): Use WKSerializedScriptValueRef.
+        * UIProcess/API/C/WKPage.h: Use WKSerializedScriptValueRef.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::close): Call invalidateCallbackMap for m_scriptValueCallbacks.
+        (WebKit::WebPageProxy::runJavaScriptInMainFrame): Take a ScriptValueCallback.
+        (WebKit::WebPageProxy::scriptValueCallback): Added. Create a WebSerializedScriptValue
+        from the DataReference before calling the callback.
+        (WebKit::WebPageProxy::processDidCrash): Call invalidateCallbackMap for m_scriptValueCallbacks.
+        * UIProcess/WebPageProxy.h: Added ScriptValueCallback and m_scriptValueCallbacks.
+        * UIProcess/WebPageProxy.messages.in: Added ScriptValueCallback.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::runJavaScriptInMainFrame): Create a DataReference from a WebCore::SerializedScriptValue.
+        And use ScriptValueCallback to send the message back.
+
</ins><span class="cx"> 2011-03-02  Jessie Berlin  <jberlin@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Adam Roben.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp  2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp     2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -397,11 +397,11 @@
</span><span class="cx"> 
</span><span class="cx"> void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback)
</span><span class="cx"> {
</span><del>-    toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), StringCallback::create(context, callback));
</del><ins>+    toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), ScriptValueCallback::create(context, callback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #ifdef __BLOCKS__
</span><del>-static void callRunJavaScriptBlockAndRelease(WKStringRef resultValue, WKErrorRef error, void* context)
</del><ins>+static void callRunJavaScriptBlockAndRelease(WKSerializedScriptValueRef resultValue, WKErrorRef error, void* context)
</ins><span class="cx"> {
</span><span class="cx">     WKPageRunJavaScriptBlock block = (WKPageRunJavaScriptBlock)context;
</span><span class="cx">     block(resultValue, error);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h    2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h       2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -339,10 +339,10 @@
</span><span class="cx"> WK_EXPORT void WKPageSetPageResourceLoadClient(WKPageRef page, const WKPageResourceLoadClient* client);
</span><span class="cx"> WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client);
</span><span class="cx"> 
</span><del>-typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, WKErrorRef, void*);
</del><ins>+typedef void (*WKPageRunJavaScriptFunction)(WKSerializedScriptValueRef, WKErrorRef, void*);
</ins><span class="cx"> WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void* context, WKPageRunJavaScriptFunction function);
</span><span class="cx"> #ifdef __BLOCKS__
</span><del>-typedef void (^WKPageRunJavaScriptBlock)(WKStringRef, WKErrorRef);
</del><ins>+typedef void (^WKPageRunJavaScriptBlock)(WKSerializedScriptValueRef, WKErrorRef);
</ins><span class="cx"> WK_EXPORT void WKPageRunJavaScriptInMainFrame_b(WKPageRef page, WKStringRef script, WKPageRunJavaScriptBlock block);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp  2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp     2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -311,6 +311,7 @@
</span><span class="cx">     invalidateCallbackMap(m_voidCallbacks);
</span><span class="cx">     invalidateCallbackMap(m_dataCallbacks);
</span><span class="cx">     invalidateCallbackMap(m_stringCallbacks);
</span><ins>+    invalidateCallbackMap(m_scriptValueCallbacks);
</ins><span class="cx">     invalidateCallbackMap(m_computedPagesCallbacks);
</span><span class="cx"> 
</span><span class="cx">     Vector<WebEditCommandProxy*> editCommandVector;
</span><span class="lines">@@ -1112,12 +1113,12 @@
</span><span class="cx"> {
</span><span class="cx">     process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
</span><span class="cx"> }
</span><del>-    
-void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<StringCallback> prpCallback)
</del><ins>+
+void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
</ins><span class="cx"> {
</span><del>-    RefPtr<StringCallback> callback = prpCallback;
</del><ins>+    RefPtr<ScriptValueCallback> callback = prpCallback;
</ins><span class="cx">     uint64_t callbackID = callback->callbackID();
</span><del>-    m_stringCallbacks.set(callbackID, callback.get());
</del><ins>+    m_scriptValueCallbacks.set(callbackID, callback.get());
</ins><span class="cx">     process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2442,6 +2443,21 @@
</span><span class="cx">     callback->performCallbackWithReturnValue(resultString.impl());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::scriptValueCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
+{
+    RefPtr<ScriptValueCallback> callback = m_scriptValueCallbacks.take(callbackID);
+    if (!callback) {
+        // FIXME: Log error or assert.
+        return;
+    }
+
+    Vector<uint8_t> data;
+    data.reserveInitialCapacity(dataReference.size());
+    data.append(dataReference.data(), dataReference.size());
+
+    callback->performCallbackWithReturnValue(WebSerializedScriptValue::adopt(data).get());
+}
+
</ins><span class="cx"> void WebPageProxy::computedPagesCallback(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
</span><span class="cx"> {
</span><span class="cx">     RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
</span><span class="lines">@@ -2547,6 +2563,7 @@
</span><span class="cx">     invalidateCallbackMap(m_voidCallbacks);
</span><span class="cx">     invalidateCallbackMap(m_dataCallbacks);
</span><span class="cx">     invalidateCallbackMap(m_stringCallbacks);
</span><ins>+    invalidateCallbackMap(m_scriptValueCallbacks);
</ins><span class="cx">     invalidateCallbackMap(m_computedPagesCallbacks);
</span><span class="cx"> 
</span><span class="cx">     Vector<WebEditCommandProxy*> editCommandVector;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h    2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h       2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -113,6 +113,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> typedef GenericCallback<WKStringRef, StringImpl*> StringCallback;
</span><ins>+typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback;
</ins><span class="cx"> 
</span><span class="cx"> class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
</span><span class="cx"> public:
</span><span class="lines">@@ -303,7 +304,7 @@
</span><span class="cx">     void getSelectionOrContentsAsString(PassRefPtr<StringCallback>);
</span><span class="cx">     void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
</span><span class="cx">     void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
</span><del>-    void runJavaScriptInMainFrame(const String&, PassRefPtr<StringCallback>);
</del><ins>+    void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>);
</ins><span class="cx">     void forceRepaint(PassRefPtr<VoidCallback>);
</span><span class="cx"> 
</span><span class="cx">     float headerHeight(WebFrameProxy*);
</span><span class="lines">@@ -574,6 +575,7 @@
</span><span class="cx">     void voidCallback(uint64_t);
</span><span class="cx">     void dataCallback(const CoreIPC::DataReference&, uint64_t);
</span><span class="cx">     void stringCallback(const String&, uint64_t);
</span><ins>+    void scriptValueCallback(const CoreIPC::DataReference&, uint64_t);
</ins><span class="cx">     void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
</span><span class="cx"> 
</span><span class="cx">     void focusedFrameChanged(uint64_t frameID);
</span><span class="lines">@@ -623,6 +625,7 @@
</span><span class="cx">     HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
</span><span class="cx">     HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks;
</span><span class="cx">     HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks;
</span><ins>+    HashMap<uint64_t, RefPtr<ScriptValueCallback> > m_scriptValueCallbacks;
</ins><span class="cx">     HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks;
</span><span class="cx"> 
</span><span class="cx">     HashSet<WebEditCommandProxy*> m_editCommandSet;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in  2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in     2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -119,6 +119,7 @@
</span><span class="cx">     VoidCallback(uint64_t callbackID)
</span><span class="cx">     DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
</span><span class="cx">     StringCallback(WTF::String resultString, uint64_t callbackID)
</span><ins>+    ScriptValueCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
</ins><span class="cx">     ComputedPagesCallback(Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
</span><span class="cx"> 
</span><span class="cx">     ViewScaleFactorDidChange(double scaleFactor)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (80187 => 80188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp      2011-03-03 01:12:30 UTC (rev 80187)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-03-03 01:17:45 UTC (rev 80188)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx"> #include <WebCore/RenderView.h>
</span><span class="cx"> #include <WebCore/ReplaceSelectionCommand.h>
</span><span class="cx"> #include <WebCore/ResourceRequest.h>
</span><ins>+#include <WebCore/SerializedScriptValue.h>
</ins><span class="cx"> #include <WebCore/Settings.h>
</span><span class="cx"> #include <WebCore/SharedBuffer.h>
</span><span class="cx"> #include <WebCore/SubstituteData.h>
</span><span class="lines">@@ -1194,13 +1195,15 @@
</span><span class="cx">     // NOTE: We need to be careful when running scripts that the objects we depend on don't
</span><span class="cx">     // disappear during script execution.
</span><span class="cx"> 
</span><ins>+    CoreIPC::DataReference dataReference;
+
</ins><span class="cx">     JSLock lock(SilenceAssertionsOnly);
</span><del>-    JSValue resultValue = m_mainFrame->coreFrame()->script()->executeScript(script, true).jsValue();
-    String resultString;
-    if (resultValue)
-        resultString = ustringToString(resultValue.toString(m_mainFrame->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec()));
</del><ins>+    if (JSValue resultValue = m_mainFrame->coreFrame()->script()->executeScript(script, true).jsValue()) {
+        if (RefPtr<SerializedScriptValue> serializedResultValue = SerializedScriptValue::create(m_mainFrame->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec(), resultValue))
+           dataReference = CoreIPC::DataReference(serializedResultValue->data().data(), serializedResultValue->data().size());
+    }
</ins><span class="cx"> 
</span><del>-    send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
</del><ins>+    send(Messages::WebPageProxy::ScriptValueCallback(dataReference, callbackID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::getContentsAsString(uint64_t callbackID)
</span></span></pre>
</div>
</div>

</body>
</html>