[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.20-204-g221d8e8

yurys at chromium.org yurys at chromium.org
Wed Feb 10 22:16:26 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 2dd8bfe818eb8a2fcfa7f93ebbc82bff6d512776
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 5 14:08:31 2010 +0000

    2010-02-05  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            - Use SerializedScriptValue for passing data between injected script and
            inspector frontend.
            - Remove custom JSON implementation from the instpector utility script.
            - Make sure that only objects created in the same ScriptState can be values
            of ScriptObject/Array properties and arguments to ScriptFunctionCall. We don't
            want ScriptObjects to leak between contexts.
            - Use ScriptState of the 'this' object in ScriptFunctionCall instead of passing
            it as additional parameter.
    
            https://bugs.webkit.org/show_bug.cgi?id=33592
    
            * bindings/js/JSInjectedScriptHostCustom.cpp:
            (WebCore::JSInjectedScriptHost::reportDidDispatchOnInjectedScript):
            * bindings/js/ScriptArray.cpp:
            (WebCore::ScriptArray::set):
            * bindings/js/ScriptFunctionCall.cpp:
            (WebCore::ScriptFunctionCall::ScriptFunctionCall):
            (WebCore::ScriptFunctionCall::appendArgument):
            * bindings/js/ScriptFunctionCall.h:
            * bindings/js/ScriptObject.cpp:
            (WebCore::ScriptObject::set):
            * bindings/js/ScriptValue.cpp:
            (WebCore::ScriptValue::serialize):
            (WebCore::ScriptValue::deserialize):
            * bindings/js/ScriptValue.h:
            * bindings/v8/ScriptArray.cpp:
            (WebCore::ScriptArray::set):
            * bindings/v8/ScriptFunctionCall.cpp:
            (WebCore::ScriptFunctionCall::ScriptFunctionCall):
            (WebCore::ScriptFunctionCall::appendArgument):
            * bindings/v8/ScriptFunctionCall.h:
            * bindings/v8/ScriptObject.cpp:
            (WebCore::ScriptObject::set):
            * bindings/v8/ScriptState.h:
            * bindings/v8/ScriptValue.cpp:
            (WebCore::ScriptValue::serialize):
            (WebCore::deserialize):
            * bindings/v8/ScriptValue.h:
            * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
            (WebCore::V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback):
            * inspector/InjectedScript.cpp:
            (WebCore::InjectedScript::dispatch):
            (WebCore::InjectedScript::callFrames):
            (WebCore::InjectedScript::wrapForConsole):
            (WebCore::InjectedScript::releaseWrapperObjectGroup):
            * inspector/InjectedScript.h:
            * inspector/InjectedScriptHost.cpp:
            (WebCore::InjectedScriptHost::reportDidDispatchOnInjectedScript):
            * inspector/InjectedScriptHost.h:
            * inspector/InjectedScriptHost.idl:
            * inspector/InspectorBackend.cpp:
            (WebCore::InspectorBackend::dispatchOnInjectedScript):
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::setFrontendProxyObject):
            (WebCore::InspectorController::didPause):
            (WebCore::InspectorController::didEvaluateForTestInFrontend):
            * inspector/InspectorFrontend.cpp:
            (WebCore::InspectorFrontend::InspectorFrontend):
            (WebCore::InspectorFrontend::newScriptArray):
            (WebCore::InspectorFrontend::newScriptObject):
            (WebCore::InspectorFrontend::populateFrontendSettings):
            (WebCore::InspectorFrontend::updateConsoleMessageExpiredCount):
            (WebCore::InspectorFrontend::addConsoleMessage):
            (WebCore::InspectorFrontend::updateConsoleMessageRepeatCount):
            (WebCore::InspectorFrontend::updateResource):
            (WebCore::InspectorFrontend::removeResource):
            (WebCore::InspectorFrontend::didGetResourceContent):
            (WebCore::InspectorFrontend::updateFocusedNode):
            (WebCore::InspectorFrontend::setAttachedWindow):
            (WebCore::InspectorFrontend::addRecordToTimeline):
            (WebCore::InspectorFrontend::parsedScriptSource):
            (WebCore::InspectorFrontend::failedToParseScriptSource):
            (WebCore::InspectorFrontend::addProfileHeader):
            (WebCore::InspectorFrontend::setRecordingProfile):
            (WebCore::InspectorFrontend::didGetProfileHeaders):
            (WebCore::InspectorFrontend::didGetProfile):
            (WebCore::InspectorFrontend::pausedScript):
            (WebCore::InspectorFrontend::setDocument):
            (WebCore::InspectorFrontend::setDetachedRoot):
            (WebCore::InspectorFrontend::setChildNodes):
            (WebCore::InspectorFrontend::childNodeCountUpdated):
            (WebCore::InspectorFrontend::childNodeInserted):
            (WebCore::InspectorFrontend::childNodeRemoved):
            (WebCore::InspectorFrontend::attributesUpdated):
            (WebCore::InspectorFrontend::didRemoveNode):
            (WebCore::InspectorFrontend::didGetChildNodes):
            (WebCore::InspectorFrontend::didApplyDomChange):
            (WebCore::InspectorFrontend::didGetEventListenersForNode):
            (WebCore::InspectorFrontend::didGetCookies):
            (WebCore::InspectorFrontend::didDispatchOnInjectedScript):
            (WebCore::InspectorFrontend::addDatabase):
            (WebCore::InspectorFrontend::selectDatabase):
            (WebCore::InspectorFrontend::didGetDatabaseTableNames):
            (WebCore::InspectorFrontend::addDOMStorage):
            (WebCore::InspectorFrontend::selectDOMStorage):
            (WebCore::InspectorFrontend::didGetDOMStorageEntries):
            (WebCore::InspectorFrontend::didSetDOMStorageItem):
            (WebCore::InspectorFrontend::didRemoveDOMStorageItem):
            (WebCore::InspectorFrontend::updateDOMStorage):
            (WebCore::InspectorFrontend::addNodesToSearchResult):
            (WebCore::InspectorFrontend::contextMenuItemSelected):
            (WebCore::InspectorFrontend::evaluateForTestInFrontend):
            (WebCore::InspectorFrontend::callSimpleFunction):
            * inspector/InspectorFrontend.h:
            (WebCore::InspectorFrontend::scriptState):
            * inspector/front-end/InjectedScript.js:
            (injectedScriptConstructor):
            (injectedScriptConstructor.):
            * inspector/front-end/InjectedScriptAccess.js:
            (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName.myCallback):
            (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName):
            (InjectedScriptAccess._installHandler):
            * inspector/front-end/inspector.js:
            (WebInspector.pausedScript):
            (WebInspector.addConsoleMessage):
    
    2010-02-05  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Remove unused inmport of ScriptFunctionCall.h
    
            https://bugs.webkit.org/show_bug.cgi?id=33592
    
            * Api/qwebelement.cpp:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 95a80b9..2b2f820 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,123 @@
+2010-02-05  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        - Use SerializedScriptValue for passing data between injected script and
+        inspector frontend.
+        - Remove custom JSON implementation from the instpector utility script.
+        - Make sure that only objects created in the same ScriptState can be values
+        of ScriptObject/Array properties and arguments to ScriptFunctionCall. We don't
+        want ScriptObjects to leak between contexts.
+        - Use ScriptState of the 'this' object in ScriptFunctionCall instead of passing
+        it as additional parameter.
+
+        https://bugs.webkit.org/show_bug.cgi?id=33592
+
+        * bindings/js/JSInjectedScriptHostCustom.cpp:
+        (WebCore::JSInjectedScriptHost::reportDidDispatchOnInjectedScript):
+        * bindings/js/ScriptArray.cpp:
+        (WebCore::ScriptArray::set):
+        * bindings/js/ScriptFunctionCall.cpp:
+        (WebCore::ScriptFunctionCall::ScriptFunctionCall):
+        (WebCore::ScriptFunctionCall::appendArgument):
+        * bindings/js/ScriptFunctionCall.h:
+        * bindings/js/ScriptObject.cpp:
+        (WebCore::ScriptObject::set):
+        * bindings/js/ScriptValue.cpp:
+        (WebCore::ScriptValue::serialize):
+        (WebCore::ScriptValue::deserialize):
+        * bindings/js/ScriptValue.h:
+        * bindings/v8/ScriptArray.cpp:
+        (WebCore::ScriptArray::set):
+        * bindings/v8/ScriptFunctionCall.cpp:
+        (WebCore::ScriptFunctionCall::ScriptFunctionCall):
+        (WebCore::ScriptFunctionCall::appendArgument):
+        * bindings/v8/ScriptFunctionCall.h:
+        * bindings/v8/ScriptObject.cpp:
+        (WebCore::ScriptObject::set):
+        * bindings/v8/ScriptState.h:
+        * bindings/v8/ScriptValue.cpp:
+        (WebCore::ScriptValue::serialize):
+        (WebCore::deserialize):
+        * bindings/v8/ScriptValue.h:
+        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+        (WebCore::V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback):
+        * inspector/InjectedScript.cpp:
+        (WebCore::InjectedScript::dispatch):
+        (WebCore::InjectedScript::callFrames):
+        (WebCore::InjectedScript::wrapForConsole):
+        (WebCore::InjectedScript::releaseWrapperObjectGroup):
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScriptHost.cpp:
+        (WebCore::InjectedScriptHost::reportDidDispatchOnInjectedScript):
+        * inspector/InjectedScriptHost.h:
+        * inspector/InjectedScriptHost.idl:
+        * inspector/InspectorBackend.cpp:
+        (WebCore::InspectorBackend::dispatchOnInjectedScript):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::setFrontendProxyObject):
+        (WebCore::InspectorController::didPause):
+        (WebCore::InspectorController::didEvaluateForTestInFrontend):
+        * inspector/InspectorFrontend.cpp:
+        (WebCore::InspectorFrontend::InspectorFrontend):
+        (WebCore::InspectorFrontend::newScriptArray):
+        (WebCore::InspectorFrontend::newScriptObject):
+        (WebCore::InspectorFrontend::populateFrontendSettings):
+        (WebCore::InspectorFrontend::updateConsoleMessageExpiredCount):
+        (WebCore::InspectorFrontend::addConsoleMessage):
+        (WebCore::InspectorFrontend::updateConsoleMessageRepeatCount):
+        (WebCore::InspectorFrontend::updateResource):
+        (WebCore::InspectorFrontend::removeResource):
+        (WebCore::InspectorFrontend::didGetResourceContent):
+        (WebCore::InspectorFrontend::updateFocusedNode):
+        (WebCore::InspectorFrontend::setAttachedWindow):
+        (WebCore::InspectorFrontend::addRecordToTimeline):
+        (WebCore::InspectorFrontend::parsedScriptSource):
+        (WebCore::InspectorFrontend::failedToParseScriptSource):
+        (WebCore::InspectorFrontend::addProfileHeader):
+        (WebCore::InspectorFrontend::setRecordingProfile):
+        (WebCore::InspectorFrontend::didGetProfileHeaders):
+        (WebCore::InspectorFrontend::didGetProfile):
+        (WebCore::InspectorFrontend::pausedScript):
+        (WebCore::InspectorFrontend::setDocument):
+        (WebCore::InspectorFrontend::setDetachedRoot):
+        (WebCore::InspectorFrontend::setChildNodes):
+        (WebCore::InspectorFrontend::childNodeCountUpdated):
+        (WebCore::InspectorFrontend::childNodeInserted):
+        (WebCore::InspectorFrontend::childNodeRemoved):
+        (WebCore::InspectorFrontend::attributesUpdated):
+        (WebCore::InspectorFrontend::didRemoveNode):
+        (WebCore::InspectorFrontend::didGetChildNodes):
+        (WebCore::InspectorFrontend::didApplyDomChange):
+        (WebCore::InspectorFrontend::didGetEventListenersForNode):
+        (WebCore::InspectorFrontend::didGetCookies):
+        (WebCore::InspectorFrontend::didDispatchOnInjectedScript):
+        (WebCore::InspectorFrontend::addDatabase):
+        (WebCore::InspectorFrontend::selectDatabase):
+        (WebCore::InspectorFrontend::didGetDatabaseTableNames):
+        (WebCore::InspectorFrontend::addDOMStorage):
+        (WebCore::InspectorFrontend::selectDOMStorage):
+        (WebCore::InspectorFrontend::didGetDOMStorageEntries):
+        (WebCore::InspectorFrontend::didSetDOMStorageItem):
+        (WebCore::InspectorFrontend::didRemoveDOMStorageItem):
+        (WebCore::InspectorFrontend::updateDOMStorage):
+        (WebCore::InspectorFrontend::addNodesToSearchResult):
+        (WebCore::InspectorFrontend::contextMenuItemSelected):
+        (WebCore::InspectorFrontend::evaluateForTestInFrontend):
+        (WebCore::InspectorFrontend::callSimpleFunction):
+        * inspector/InspectorFrontend.h:
+        (WebCore::InspectorFrontend::scriptState):
+        * inspector/front-end/InjectedScript.js:
+        (injectedScriptConstructor):
+        (injectedScriptConstructor.):
+        * inspector/front-end/InjectedScriptAccess.js:
+        (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName.myCallback):
+        (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName):
+        (InjectedScriptAccess._installHandler):
+        * inspector/front-end/inspector.js:
+        (WebInspector.pausedScript):
+        (WebInspector.addConsoleMessage):
+
 2010-02-05  Tor Arne Vestbø  <tor.arne.vestbo at nokia.com>
 
         Reviewed by Simon Hausmann.
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 96c5c43..3db894d 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -53,6 +53,7 @@
 #include "Node.h"
 #include "Page.h"
 #if ENABLE(DOM_STORAGE)
+#include "SerializedScriptValue.h"
 #include "Storage.h"
 #include "JSStorage.h"
 #endif
@@ -61,6 +62,7 @@
 #include <parser/SourceCode.h>
 #include <runtime/JSArray.h>
 #include <runtime/JSLock.h>
+#include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -195,6 +197,24 @@ JSValue JSInjectedScriptHost::selectDOMStorage(ExecState*, const ArgList& args)
 }
 #endif
 
+JSValue JSInjectedScriptHost::reportDidDispatchOnInjectedScript(ExecState* exec, const ArgList& args)
+{
+    if (args.size() < 3)
+        return jsUndefined();
+    
+    if (!args.at(0).isInt32())
+        return jsUndefined();
+    int callId = args.at(0).asInt32();
+    
+    RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(exec, args.at(1)));
+    
+    bool isException;
+    if (!args.at(2).getBoolean(isException))
+        return jsUndefined();
+    impl()->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
+    return jsUndefined();
+}
+
 InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState)
 {
     JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bindings/js/ScriptArray.cpp b/WebCore/bindings/js/ScriptArray.cpp
index 2c4075a..caecc40 100644
--- a/WebCore/bindings/js/ScriptArray.cpp
+++ b/WebCore/bindings/js/ScriptArray.cpp
@@ -53,6 +53,10 @@ static bool handleException(ScriptState* scriptState)
 
 bool ScriptArray::set(unsigned index, const ScriptObject& value)
 {
+    if (value.scriptState() != m_scriptState) {
+        ASSERT_NOT_REACHED();
+        return false;
+    }
     JSLock lock(SilenceAssertionsOnly);
     jsArray()->put(m_scriptState, index, value.jsObject());
     return handleException(m_scriptState);
diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp
index a2284bc..5001d3c 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -42,8 +42,8 @@ using namespace JSC;
 
 namespace WebCore {
 
-ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name)
-    : m_exec(exec)
+ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
+    : m_exec(thisObject.scriptState())
     , m_thisObject(thisObject)
     , m_name(name)
 {
@@ -51,6 +51,10 @@ ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& th
 
 void ScriptFunctionCall::appendArgument(const ScriptObject& argument)
 {
+    if (argument.scriptState() != m_exec) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
     m_arguments.append(argument.jsObject());
 }
 
diff --git a/WebCore/bindings/js/ScriptFunctionCall.h b/WebCore/bindings/js/ScriptFunctionCall.h
index 7c5074f..9742e8f 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.h
+++ b/WebCore/bindings/js/ScriptFunctionCall.h
@@ -48,7 +48,7 @@ namespace WebCore {
 
     class ScriptFunctionCall {
     public:
-        ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name);
+        ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
         virtual ~ScriptFunctionCall() {};
 
         void appendArgument(const ScriptObject&);
diff --git a/WebCore/bindings/js/ScriptObject.cpp b/WebCore/bindings/js/ScriptObject.cpp
index 03ecfc6..7948219 100644
--- a/WebCore/bindings/js/ScriptObject.cpp
+++ b/WebCore/bindings/js/ScriptObject.cpp
@@ -70,6 +70,10 @@ bool ScriptObject::set(const String& name, const String& value)
 
 bool ScriptObject::set(const char* name, const ScriptObject& value)
 {
+    if (value.scriptState() != m_scriptState) {
+        ASSERT_NOT_REACHED();
+        return false;
+    }
     JSLock lock(SilenceAssertionsOnly);
     PutPropertySlot slot;
     jsObject()->put(m_scriptState, Identifier(m_scriptState, name), value.jsObject(), slot);
diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp
index ac92e14..005c329 100644
--- a/WebCore/bindings/js/ScriptValue.cpp
+++ b/WebCore/bindings/js/ScriptValue.cpp
@@ -29,6 +29,8 @@
 #include "config.h"
 #include "ScriptValue.h"
 
+#include "SerializedScriptValue.h"
+
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/JSValueRef.h>
 
@@ -81,4 +83,14 @@ bool ScriptValue::isObject() const
     return m_value.get().isObject();
 }
 
+PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
+{
+    return SerializedScriptValue::create(scriptState, jsValue());
+}
+
+ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
+{
+    return ScriptValue(value->deserialize(scriptState, scriptState->lexicalGlobalObject()));
+}
+
 } // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h
index b1eaa21..9ccb7ac 100644
--- a/WebCore/bindings/js/ScriptValue.h
+++ b/WebCore/bindings/js/ScriptValue.h
@@ -34,10 +34,12 @@
 #include "PlatformString.h"
 #include "ScriptState.h"
 #include <runtime/Protect.h>
+#include <wtf/PassRefPtr.h>
 
 namespace WebCore {
 
 class String;
+class SerializedScriptValue;
 
 class ScriptValue {
 public:
@@ -53,6 +55,9 @@ public:
     bool isObject() const;
     bool hasNoValue() const { return m_value == JSC::JSValue(); }
 
+    PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
+    static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
+
 private:
     JSC::ProtectedJSValue m_value;
 };
diff --git a/WebCore/bindings/v8/ScriptArray.cpp b/WebCore/bindings/v8/ScriptArray.cpp
index 748ee19..01b0898 100644
--- a/WebCore/bindings/v8/ScriptArray.cpp
+++ b/WebCore/bindings/v8/ScriptArray.cpp
@@ -50,6 +50,10 @@ ScriptArray::ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array> v8Array
 
 bool ScriptArray::set(unsigned index, const ScriptObject& value)
 {
+    if (value.scriptState() != m_scriptState) {
+        ASSERT_NOT_REACHED();
+        return false;
+    }
     ScriptScope scope(m_scriptState);
     v8Object()->Set(v8::Integer::New(index), value.v8Value());
     return scope.success();
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.cpp b/WebCore/bindings/v8/ScriptFunctionCall.cpp
index a232acd..e6b22ee 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/v8/ScriptFunctionCall.cpp
@@ -45,8 +45,8 @@
 
 namespace WebCore {
 
-ScriptFunctionCall::ScriptFunctionCall(ScriptState* scriptState, const ScriptObject& thisObject, const String& name)
-    : m_scriptState(scriptState)
+ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
+    : m_scriptState(thisObject.scriptState())
     , m_thisObject(thisObject)
     , m_name(name)
 {
@@ -54,6 +54,10 @@ ScriptFunctionCall::ScriptFunctionCall(ScriptState* scriptState, const ScriptObj
 
 void ScriptFunctionCall::appendArgument(const ScriptObject& argument)
 {
+    if (argument.scriptState() != m_scriptState) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
     m_arguments.append(argument);
 }
 
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.h b/WebCore/bindings/v8/ScriptFunctionCall.h
index 6203402..4cbbf7e 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.h
+++ b/WebCore/bindings/v8/ScriptFunctionCall.h
@@ -43,7 +43,7 @@ namespace WebCore {
 
     class ScriptFunctionCall {
     public:
-        ScriptFunctionCall(ScriptState* scriptState, const ScriptObject& thisObject, const String& name);
+        ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
         virtual ~ScriptFunctionCall() {};
 
         void appendArgument(const ScriptObject&);
diff --git a/WebCore/bindings/v8/ScriptObject.cpp b/WebCore/bindings/v8/ScriptObject.cpp
index 0fcd16f..520c57b 100644
--- a/WebCore/bindings/v8/ScriptObject.cpp
+++ b/WebCore/bindings/v8/ScriptObject.cpp
@@ -67,6 +67,10 @@ bool ScriptObject::set(const String& name, const String& value)
 
 bool ScriptObject::set(const char* name, const ScriptObject& value)
 {
+    if (value.scriptState() != m_scriptState) {
+        ASSERT_NOT_REACHED();
+        return false;
+    }
     ScriptScope scope(m_scriptState);
     v8Object()->Set(v8::String::New(name), value.v8Value());
     return scope.success();
diff --git a/WebCore/bindings/v8/ScriptState.h b/WebCore/bindings/v8/ScriptState.h
index e71becb..5c5ce6c 100644
--- a/WebCore/bindings/v8/ScriptState.h
+++ b/WebCore/bindings/v8/ScriptState.h
@@ -38,9 +38,9 @@
 
 namespace WebCore {
     class DOMWrapperWorld;
+    class Frame;
     class Node;
     class Page;
-    class Frame;
 
     class ScriptState : public Noncopyable {
     public:
diff --git a/WebCore/bindings/v8/ScriptValue.cpp b/WebCore/bindings/v8/ScriptValue.cpp
old mode 100644
new mode 100755
index af84e99..02d62db
--- a/WebCore/bindings/v8/ScriptValue.cpp
+++ b/WebCore/bindings/v8/ScriptValue.cpp
@@ -31,10 +31,24 @@
 #include "config.h"
 #include "ScriptValue.h"
 
+#include "ScriptScope.h"
+#include "SerializedScriptValue.h"
 #include "V8Binding.h"
 
 namespace WebCore {
 
+PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
+{
+    ScriptScope scope(scriptState);
+    return SerializedScriptValue::create(v8Value());
+}
+
+ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
+{
+    ScriptScope scope(scriptState);
+    return ScriptValue(value->deserialize());
+}
+
 bool ScriptValue::getString(String& result) const
 {
     if (m_value.IsEmpty())
diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h
index 6a70bd7..1713f80 100644
--- a/WebCore/bindings/v8/ScriptValue.h
+++ b/WebCore/bindings/v8/ScriptValue.h
@@ -35,6 +35,7 @@
 #include "ScriptState.h"
 
 #include <v8.h>
+#include <wtf/PassRefPtr.h>
 
 #ifndef NDEBUG
 #include "V8Proxy.h"  // for register and unregister global handles.
@@ -42,6 +43,8 @@
 
 namespace WebCore {
 
+class SerializedScriptValue;
+
 class ScriptValue {
 public:
     ScriptValue() {}
@@ -121,6 +124,9 @@ public:
         return m_value.IsEmpty();
     }
 
+    PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
+    static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
+
     void clear()
     {
         if (m_value.IsEmpty())
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index ad4ed01..942b017 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -39,12 +39,14 @@
 #include "InspectorController.h"
 #include "Node.h"
 #include "Page.h"
+#include "SerializedScriptValue.h"
 
 #include "V8Binding.h"
 #include "V8Database.h"
 #include "V8Node.h"
 #include "V8Proxy.h"
 #include "V8Storage.h"
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
@@ -194,6 +196,19 @@ v8::Handle<v8::Value> V8InjectedScriptHost::selectDOMStorageCallback(const v8::A
 }
 #endif
 
+v8::Handle<v8::Value> V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback(const v8::Arguments& args)
+{
+    INC_STATS("InjectedScriptHost.reportDidDispatchOnInjectedScript()");
+    if (args.Length() < 3)
+        return v8::Undefined();
+    InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+    int callId = args[0]->ToInt32()->Value();
+    RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(args[1]));
+    bool isException = args[2]->ToBoolean()->Value();
+    host->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
+    return v8::Undefined();
+}
+
 InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState)
 {
     v8::HandleScope handleScope;
diff --git a/WebCore/inspector/InjectedScript.cpp b/WebCore/inspector/InjectedScript.cpp
index 5525877..42a2856 100644
--- a/WebCore/inspector/InjectedScript.cpp
+++ b/WebCore/inspector/InjectedScript.cpp
@@ -34,6 +34,7 @@
 #if ENABLE(INSPECTOR)
 
 #include "PlatformString.h"
+#include "SerializedScriptValue.h"
 #include "ScriptFunctionCall.h"
 
 namespace WebCore {
@@ -43,11 +44,10 @@ InjectedScript::InjectedScript(ScriptObject injectedScriptObject)
 {
 }
 
-void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException) 
+void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<SerializedScriptValue>* result, bool* hadException) 
 {
     ASSERT(!hasNoValue());
-    ScriptState* scriptState = m_injectedScriptObject.scriptState();
-    ScriptFunctionCall function(scriptState, m_injectedScriptObject, "dispatch");
+    ScriptFunctionCall function(m_injectedScriptObject, "dispatch");
     function.appendArgument(methodName);
     function.appendArgument(arguments);
     if (async)
@@ -55,38 +55,33 @@ void InjectedScript::dispatch(long callId, const String& methodName, const Strin
     *hadException = false;
     ScriptValue resultValue = function.call(*hadException);
     if (!*hadException)
-        *result = resultValue.toString(scriptState);
+        *result = resultValue.serialize(m_injectedScriptObject.scriptState());
 }
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-String InjectedScript::callFrames()
+PassRefPtr<SerializedScriptValue> InjectedScript::callFrames()
 {
     ASSERT(!hasNoValue());
-    ScriptState* scriptState = m_injectedScriptObject.scriptState();
-    ScriptFunctionCall function(scriptState, m_injectedScriptObject, "callFrames");
+    ScriptFunctionCall function(m_injectedScriptObject, "callFrames");
     ScriptValue callFramesValue = function.call();
-    return callFramesValue.toString(scriptState);
+    return callFramesValue.serialize(m_injectedScriptObject.scriptState());
 }
 #endif
 
-String InjectedScript::wrapAndStringifyForConsole(ScriptValue value)
+PassRefPtr<SerializedScriptValue> InjectedScript::wrapForConsole(ScriptValue value)
 {
     ASSERT(!hasNoValue());
-    ScriptState* scriptState = m_injectedScriptObject.scriptState();
-    ScriptFunctionCall wrapFunction(scriptState, m_injectedScriptObject, "wrapAndStringifyObject");
+    ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject");
     wrapFunction.appendArgument(value);
     wrapFunction.appendArgument("console");
     ScriptValue r = wrapFunction.call();
-    if (r.hasNoValue())
-        return "";
-    return r.toString(scriptState);
+    return r.serialize(m_injectedScriptObject.scriptState());
 }
 
 void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup)
 {
     ASSERT(!hasNoValue());
-    ScriptState* scriptState = m_injectedScriptObject.scriptState();
-    ScriptFunctionCall releaseFunction(scriptState, m_injectedScriptObject, "releaseWrapperObjectGroup");
+    ScriptFunctionCall releaseFunction(m_injectedScriptObject, "releaseWrapperObjectGroup");
     releaseFunction.appendArgument(objectGroup);
     releaseFunction.call();
 }
diff --git a/WebCore/inspector/InjectedScript.h b/WebCore/inspector/InjectedScript.h
index b70ee39..db40f80 100644
--- a/WebCore/inspector/InjectedScript.h
+++ b/WebCore/inspector/InjectedScript.h
@@ -34,9 +34,11 @@
 #include "InjectedScriptHost.h"
 #include "ScriptObject.h"
 #include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
 
 namespace WebCore {
 
+class SerializedScriptValue;
 class String;
 
 class InjectedScript {
@@ -46,11 +48,11 @@ public:
 
     bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
 
-    void dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException);
+    void dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<SerializedScriptValue>* result, bool* hadException);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    String callFrames();
+    PassRefPtr<SerializedScriptValue> callFrames();
 #endif
-    String wrapAndStringifyForConsole(ScriptValue);
+    PassRefPtr<SerializedScriptValue> wrapForConsole(ScriptValue);
     void releaseWrapperObjectGroup(const String&);
 
 private:
diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp
index 13e156a..62db4b4 100644
--- a/WebCore/inspector/InjectedScriptHost.cpp
+++ b/WebCore/inspector/InjectedScriptHost.cpp
@@ -45,8 +45,6 @@
 #include "InspectorFrontend.h"
 #include "InspectorResource.h"
 #include "Pasteboard.h"
-#include "ScriptArray.h"
-#include "ScriptFunctionCall.h"
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
 #include "JavaScriptCallFrame.h"
@@ -162,7 +160,7 @@ void InjectedScriptHost::selectDOMStorage(Storage* storage)
 }
 #endif
 
-void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException)
+void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException)
 {
     if (InspectorFrontend* frontend = inspectorFrontend())
         frontend->didDispatchOnInjectedScript(callId, result, isException);
diff --git a/WebCore/inspector/InjectedScriptHost.h b/WebCore/inspector/InjectedScriptHost.h
index 901472c..fb56115 100644
--- a/WebCore/inspector/InjectedScriptHost.h
+++ b/WebCore/inspector/InjectedScriptHost.h
@@ -46,6 +46,7 @@ class InspectorDOMAgent;
 class InspectorFrontend;
 class JavaScriptCallFrame;
 class Node;
+class SerializedScriptValue;
 class Storage;
 
 class InjectedScriptHost : public RefCounted<InjectedScriptHost>
@@ -82,7 +83,7 @@ public:
 #if ENABLE(DOM_STORAGE)
     void selectDOMStorage(Storage* storage);
 #endif
-    void reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException);
+    void reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException);
 
     InjectedScript injectedScriptFor(ScriptState*);
     InjectedScript injectedScriptForId(long);
diff --git a/WebCore/inspector/InjectedScriptHost.idl b/WebCore/inspector/InjectedScriptHost.idl
index d224d1a..73a36fd 100644
--- a/WebCore/inspector/InjectedScriptHost.idl
+++ b/WebCore/inspector/InjectedScriptHost.idl
@@ -55,6 +55,6 @@ module core {
         [Custom] void selectDOMStorage(in DOMObject storage);
 #endif
 
-        void reportDidDispatchOnInjectedScript(in long callId, in DOMString result, in boolean isException);
+        [Custom] void reportDidDispatchOnInjectedScript(in long callId, in DOMObject result, in boolean isException);
     };
 }
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index 1ce0e69..5e3a910 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -49,7 +49,7 @@
 #include "InspectorResource.h"
 #include "Pasteboard.h"
 #include "ScriptArray.h"
-#include "ScriptFunctionCall.h"
+#include "SerializedScriptValue.h"
 
 #if ENABLE(DOM_STORAGE)
 #include "Storage.h"
@@ -295,12 +295,12 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript
     if (injectedScript.hasNoValue())
         return;
 
-    String result;
+    RefPtr<SerializedScriptValue> result;
     bool hadException = false;
     injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException);
     if (async)
         return;  // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript.
-    frontend->didDispatchOnInjectedScript(callId, result, hadException);
+    frontend->didDispatchOnInjectedScript(callId, result.get(), hadException);
 }
 
 void InspectorBackend::getChildNodes(long callId, long nodeId)
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index ae4e243..369450e 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -542,7 +542,7 @@ void InspectorController::scriptObjectReady()
 void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject)
 {
     m_frontendScriptState = scriptState;
-    m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj));
+    m_frontend.set(new InspectorFrontend(this, webInspectorObj));
     releaseDOMAgent();
     m_domAgent = InspectorDOMAgent::create(m_frontend.get());
     if (m_timelineAgent)
@@ -1569,8 +1569,8 @@ void InspectorController::didPause()
     ScriptState* scriptState = callFrame->scopeChain()->globalObject->globalExec();
     ASSERT(scriptState);
     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(scriptState);
-    String callFrames = injectedScript.callFrames();
-    m_frontend->pausedScript(callFrames);
+    RefPtr<SerializedScriptValue> callFrames = injectedScript.callFrames();
+    m_frontend->pausedScript(callFrames.get());
 }
 
 void InspectorController::didContinue()
@@ -1593,7 +1593,7 @@ void InspectorController::didEvaluateForTestInFrontend(long callId, const String
     ScriptState* scriptState = scriptStateFromPage(debuggerWorld(), m_inspectedPage);
     ScriptObject window;
     ScriptGlobalObject::get(scriptState, "window", window);
-    ScriptFunctionCall function(scriptState, window, "didEvaluateForTestInFrontend");
+    ScriptFunctionCall function(window, "didEvaluateForTestInFrontend");
     function.appendArgument(callId);
     function.appendArgument(jsonResult);
     function.call();
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
old mode 100644
new mode 100755
index c3bf1b4..1bce1f3
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -42,6 +42,8 @@
 #include "ScriptObject.h"
 #include "ScriptState.h"
 #include "ScriptString.h"
+#include "ScriptValue.h"
+#include "SerializedScriptValue.h"
 #include <wtf/OwnPtr.h>
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
@@ -52,9 +54,8 @@
 
 namespace WebCore {
 
-InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptState* scriptState, ScriptObject webInspector)
+InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptObject webInspector)
     : m_inspectorController(inspectorController)
-    , m_scriptState(scriptState)
     , m_webInspector(webInspector)
 {
 }
@@ -66,12 +67,12 @@ InspectorFrontend::~InspectorFrontend()
 
 ScriptArray InspectorFrontend::newScriptArray()
 {
-    return ScriptArray::createNew(m_scriptState);
+    return ScriptArray::createNew(scriptState());
 }
 
 ScriptObject InspectorFrontend::newScriptObject()
 {
-    return ScriptObject::createNew(m_scriptState);
+    return ScriptObject::createNew(scriptState());
 }
 
 void InspectorFrontend::didCommitLoad()
@@ -81,7 +82,7 @@ void InspectorFrontend::didCommitLoad()
 
 void InspectorFrontend::populateFrontendSettings(const String& settings)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+    ScriptFunctionCall function(m_webInspector, "dispatch");
     function.appendArgument("populateFrontendSettings");
     function.appendArgument(settings);
     function.call();
@@ -89,7 +90,7 @@ void InspectorFrontend::populateFrontendSettings(const String& settings)
 
 void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("updateConsoleMessageExpiredCount");
     function.appendArgument(count);
     function.call();
@@ -97,22 +98,24 @@ void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count)
 
 void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, ScriptState* scriptState, const Vector<ScriptValue> arguments, const String& message)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("addConsoleMessage");
     function.appendArgument(messageObj);
     if (!frames.isEmpty()) {
-        function.appendArgument(false);
         for (unsigned i = 0; i < frames.size(); ++i)
             function.appendArgument(frames[i]);
     } else if (!arguments.isEmpty()) {
-        function.appendArgument(true);
         InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState);
         for (unsigned i = 0; i < arguments.size(); ++i) {
-            String s = injectedScript.wrapAndStringifyForConsole(arguments[i]);
-            function.appendArgument(s);
+            RefPtr<SerializedScriptValue> serializedValue = injectedScript.wrapForConsole(arguments[i]);
+            ScriptValue scriptValue = ScriptValue::deserialize(this->scriptState(), serializedValue.get());
+            if (scriptValue.hasNoValue()) {
+                ASSERT_NOT_REACHED();
+                return;
+            }
+            function.appendArgument(scriptValue);
         }
     } else {
-        function.appendArgument(false);
         function.appendArgument(message);
     }
     function.call();
@@ -120,7 +123,7 @@ void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const
 
 void InspectorFrontend::updateConsoleMessageRepeatCount(unsigned count)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("updateConsoleMessageRepeatCount");
     function.appendArgument(count);
     function.call();
@@ -133,7 +136,7 @@ void InspectorFrontend::clearConsoleMessages()
 
 bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObject& resourceObj)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("updateResource");
     function.appendArgument(identifier);
     function.appendArgument(resourceObj);
@@ -144,7 +147,7 @@ bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObj
 
 void InspectorFrontend::removeResource(unsigned long identifier)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("removeResource");
     function.appendArgument(identifier);
     function.call();
@@ -152,7 +155,7 @@ void InspectorFrontend::removeResource(unsigned long identifier)
 
 void InspectorFrontend::didGetResourceContent(int callId, const String& content)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+    ScriptFunctionCall function(m_webInspector, "dispatch");
     function.appendArgument("didGetResourceContent");
     function.appendArgument(callId);
     function.appendArgument(content);
@@ -161,7 +164,7 @@ void InspectorFrontend::didGetResourceContent(int callId, const String& content)
 
 void InspectorFrontend::updateFocusedNode(long nodeId)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("updateFocusedNode");
     function.appendArgument(nodeId);
     function.call();
@@ -169,7 +172,7 @@ void InspectorFrontend::updateFocusedNode(long nodeId)
 
 void InspectorFrontend::setAttachedWindow(bool attached)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("setAttachedWindow");
     function.appendArgument(attached);
     function.call();
@@ -241,7 +244,7 @@ void InspectorFrontend::timelineProfilerWasStopped()
 
 void InspectorFrontend::addRecordToTimeline(const ScriptObject& record)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("addRecordToTimeline");
     function.appendArgument(record);
     function.call();
@@ -275,7 +278,7 @@ void InspectorFrontend::profilerWasDisabled()
 
 void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("parsedScriptSource");
     function.appendArgument(JSC::UString(JSC::UString::from(source.provider()->asID())));
     function.appendArgument(source.provider()->url());
@@ -286,7 +289,7 @@ void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source)
 
 void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("failedToParseScriptSource");
     function.appendArgument(source.provider()->url());
     function.appendArgument(JSC::UString(source.data(), source.length()));
@@ -298,7 +301,7 @@ void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source,
 
 void InspectorFrontend::addProfileHeader(const ScriptValue& profile)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("addProfileHeader");
     function.appendArgument(profile);
     function.call();
@@ -306,7 +309,7 @@ void InspectorFrontend::addProfileHeader(const ScriptValue& profile)
 
 void InspectorFrontend::setRecordingProfile(bool isProfiling)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("setRecordingProfile");
     function.appendArgument(isProfiling);
     function.call();
@@ -314,7 +317,7 @@ void InspectorFrontend::setRecordingProfile(bool isProfiling)
 
 void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& headers)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetProfileHeaders");
     function.appendArgument(callId);
     function.appendArgument(headers);
@@ -323,18 +326,19 @@ void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& head
 
 void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetProfile");
     function.appendArgument(callId);
     function.appendArgument(profile);
     function.call();
 }
 
-void InspectorFrontend::pausedScript(const String& callFrames)
+void InspectorFrontend::pausedScript(SerializedScriptValue* callFrames)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptValue callFramesValue = ScriptValue::deserialize(scriptState(), callFrames);
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("pausedScript");
-    function.appendArgument(callFrames);
+    function.appendArgument(callFramesValue);
     function.call();
 }
 
@@ -346,7 +350,7 @@ void InspectorFrontend::resumedScript()
 
 void InspectorFrontend::setDocument(const ScriptObject& root)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("setDocument");
     function.appendArgument(root);
     function.call();
@@ -354,7 +358,7 @@ void InspectorFrontend::setDocument(const ScriptObject& root)
 
 void InspectorFrontend::setDetachedRoot(const ScriptObject& root)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("setDetachedRoot");
     function.appendArgument(root);
     function.call();
@@ -362,7 +366,7 @@ void InspectorFrontend::setDetachedRoot(const ScriptObject& root)
 
 void InspectorFrontend::setChildNodes(int parentId, const ScriptArray& nodes)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("setChildNodes");
     function.appendArgument(parentId);
     function.appendArgument(nodes);
@@ -371,7 +375,7 @@ void InspectorFrontend::setChildNodes(int parentId, const ScriptArray& nodes)
 
 void InspectorFrontend::childNodeCountUpdated(int id, int newValue)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("childNodeCountUpdated");
     function.appendArgument(id);
     function.appendArgument(newValue);
@@ -380,7 +384,7 @@ void InspectorFrontend::childNodeCountUpdated(int id, int newValue)
 
 void InspectorFrontend::childNodeInserted(int parentId, int prevId, const ScriptObject& node)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("childNodeInserted");
     function.appendArgument(parentId);
     function.appendArgument(prevId);
@@ -390,7 +394,7 @@ void InspectorFrontend::childNodeInserted(int parentId, int prevId, const Script
 
 void InspectorFrontend::childNodeRemoved(int parentId, int id)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("childNodeRemoved");
     function.appendArgument(parentId);
     function.appendArgument(id);
@@ -399,7 +403,7 @@ void InspectorFrontend::childNodeRemoved(int parentId, int id)
 
 void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("attributesUpdated");
     function.appendArgument(id);
     function.appendArgument(attributes);
@@ -408,7 +412,7 @@ void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes)
 
 void InspectorFrontend::didRemoveNode(int callId, int nodeId)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didRemoveNode");
     function.appendArgument(callId);
     function.appendArgument(nodeId);
@@ -417,7 +421,7 @@ void InspectorFrontend::didRemoveNode(int callId, int nodeId)
 
 void InspectorFrontend::didGetChildNodes(int callId)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetChildNodes");
     function.appendArgument(callId);
     function.call();
@@ -425,7 +429,7 @@ void InspectorFrontend::didGetChildNodes(int callId)
 
 void InspectorFrontend::didApplyDomChange(int callId, bool success)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didApplyDomChange");
     function.appendArgument(callId);
     function.appendArgument(success);
@@ -434,7 +438,7 @@ void InspectorFrontend::didApplyDomChange(int callId, bool success)
 
 void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetEventListenersForNode");
     function.appendArgument(callId);
     function.appendArgument(nodeId);
@@ -444,7 +448,7 @@ void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, Scri
 
 void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetCookies");
     function.appendArgument(callId);
     function.appendArgument(cookies);
@@ -452,12 +456,17 @@ void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, co
     function.call();
 }
 
-void InspectorFrontend::didDispatchOnInjectedScript(int callId, const String& result, bool isException)
+void InspectorFrontend::didDispatchOnInjectedScript(int callId, SerializedScriptValue* result, bool isException)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didDispatchOnInjectedScript");
     function.appendArgument(callId);
-    function.appendArgument(result);
+    if (isException)
+        function.appendArgument("");
+    else {
+        ScriptValue resultValue = ScriptValue::deserialize(scriptState(), result);
+        function.appendArgument(resultValue);
+    }
     function.appendArgument(isException);
     function.call();
 }
@@ -465,7 +474,7 @@ void InspectorFrontend::didDispatchOnInjectedScript(int callId, const String& re
 #if ENABLE(DATABASE)
 bool InspectorFrontend::addDatabase(const ScriptObject& dbObject)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("addDatabase");
     function.appendArgument(dbObject);
     bool hadException = false;
@@ -475,14 +484,14 @@ bool InspectorFrontend::addDatabase(const ScriptObject& dbObject)
 
 void InspectorFrontend::selectDatabase(int databaseId)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("selectDatabase");
     function.appendArgument(databaseId);
     function.call();
 }
 void InspectorFrontend::didGetDatabaseTableNames(int callId, const ScriptArray& tableNames)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetDatabaseTableNames");
     function.appendArgument(callId);
     function.appendArgument(tableNames);
@@ -493,7 +502,7 @@ void InspectorFrontend::didGetDatabaseTableNames(int callId, const ScriptArray&
 #if ENABLE(DOM_STORAGE)
 bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("addDOMStorage");
     function.appendArgument(domStorageObj);
     bool hadException = false;
@@ -503,7 +512,7 @@ bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj)
 
 void InspectorFrontend::selectDOMStorage(int storageId)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("selectDOMStorage");
     function.appendArgument(storageId);
     function.call();
@@ -511,7 +520,7 @@ void InspectorFrontend::selectDOMStorage(int storageId)
 
 void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& entries)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetDOMStorageEntries");
     function.appendArgument(callId);
     function.appendArgument(entries);
@@ -520,7 +529,7 @@ void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& e
 
 void InspectorFrontend::didSetDOMStorageItem(int callId, bool success)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didSetDOMStorageItem");
     function.appendArgument(callId);
     function.appendArgument(success);
@@ -529,7 +538,7 @@ void InspectorFrontend::didSetDOMStorageItem(int callId, bool success)
 
 void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didRemoveDOMStorageItem");
     function.appendArgument(callId);
     function.appendArgument(success);
@@ -538,7 +547,7 @@ void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success)
 
 void InspectorFrontend::updateDOMStorage(int storageId)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("updateDOMStorage");
     function.appendArgument(storageId);
     function.call();
@@ -547,7 +556,7 @@ void InspectorFrontend::updateDOMStorage(int storageId)
 
 void InspectorFrontend::addNodesToSearchResult(const String& nodeIds)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("addNodesToSearchResult");
     function.appendArgument(nodeIds);
     function.call();
@@ -555,7 +564,7 @@ void InspectorFrontend::addNodesToSearchResult(const String& nodeIds)
 
 void InspectorFrontend::contextMenuItemSelected(int itemId)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+    ScriptFunctionCall function(m_webInspector, "dispatch");
     function.appendArgument("contextMenuItemSelected");
     function.appendArgument(itemId);
     function.call();
@@ -568,7 +577,7 @@ void InspectorFrontend::contextMenuCleared()
 
 void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("evaluateForTestInFrontend");
     function.appendArgument(callId);
     function.appendArgument(script);
@@ -577,7 +586,7 @@ void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& scri
 
 void InspectorFrontend::callSimpleFunction(const String& functionName)
 {
-    ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+    ScriptFunctionCall function(m_webInspector, "dispatch");
     function.appendArgument(functionName);
     function.call();
 }
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index a36a323..c3d1212 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -50,13 +50,13 @@ namespace WebCore {
     class InspectorController;
     class InspectorResource;
     class Node;
-    class ScriptFunctionCall;
     class ScriptString;
+    class SerializedScriptValue;
     class Storage;
 
     class InspectorFrontend : public Noncopyable {
     public:
-        InspectorFrontend(InspectorController* inspectorController, ScriptState*, ScriptObject webInspector);
+        InspectorFrontend(InspectorController* inspectorController, ScriptObject webInspector);
         ~InspectorFrontend();
 
         ScriptArray newScriptArray();
@@ -96,7 +96,7 @@ namespace WebCore {
         void setRecordingProfile(bool isProfiling);
         void didGetProfileHeaders(int callId, const ScriptArray& headers);
         void didGetProfile(int callId, const ScriptValue& profile);
-        void pausedScript(const String& callFrames);
+        void pausedScript(SerializedScriptValue* callFrames);
         void resumedScript();
 #endif
 
@@ -132,20 +132,19 @@ namespace WebCore {
         void addRecordToTimeline(const ScriptObject&);
 
         void didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString);
-        void didDispatchOnInjectedScript(int callId, const String& result, bool isException);
+        void didDispatchOnInjectedScript(int callId, SerializedScriptValue* result, bool isException);
 
         void addNodesToSearchResult(const String& nodeIds);
 
         void contextMenuItemSelected(int itemId);
         void contextMenuCleared();
 
-        ScriptState* scriptState() const { return m_scriptState; }
+        ScriptState* scriptState() const { return m_webInspector.scriptState(); }
 
         void evaluateForTestInFrontend(int callId, const String& script);
     private:
         void callSimpleFunction(const String& functionName);
         InspectorController* m_inspectorController;
-        ScriptState* m_scriptState;
         ScriptObject m_webInspector;
     };
 
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 337628f..95867c4 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -52,11 +52,6 @@ InjectedScript.wrapObject = function(object, objectGroupName)
     return InjectedScript.createProxyObject(object, objectId);
 };
 
-InjectedScript.wrapAndStringifyObject = function(object, objectGroupName) {
-    var r = InjectedScript.wrapObject(object, objectGroupName);
-    return InjectedScript.JSON.stringify(r);
-};
-
 InjectedScript.unwrapObject = function(objectId) {
     return InjectedScript.idToWrappedObject[objectId];
 };
@@ -85,7 +80,7 @@ InjectedScript.reset();
 
 InjectedScript.dispatch = function(methodName, args, callId)
 {
-    var argsArray = InjectedScript.JSON.parse(args);
+    var argsArray = eval("(" + args + ")");
     if (callId)
         argsArray.splice(0, 0, callId);  // Methods that run asynchronously have a call back id parameter.
     var result = InjectedScript[methodName].apply(InjectedScript, argsArray);
@@ -93,7 +88,7 @@ InjectedScript.dispatch = function(methodName, args, callId)
         InjectedScript._window().console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
         result = null;
     }
-    return InjectedScript.JSON.stringify(result);
+    return result;
 }
 
 InjectedScript.getStyles = function(nodeId, authorOnly)
@@ -935,7 +930,7 @@ InjectedScript.callFrames = function()
         result.push(new InjectedScript.CallFrameProxy(depth++, callFrame));
         callFrame = callFrame.caller;
     } while (callFrame);
-    return InjectedScript.JSON.stringify(result);
+    return result;
 }
 
 InjectedScript.evaluateInCallFrame = function(callFrameId, code, objectGroup)
@@ -1220,12 +1215,12 @@ InjectedScript.executeSql = function(callId, databaseId, query)
                 data[columnIdentifier] = String(text);
             }
         }
-        InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, InjectedScript.JSON.stringify(result), false);
+        InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, result, false);
     }
 
     function errorCallback(tx, error)
     {
-        InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, InjectedScript.JSON.stringify(error), false);
+        InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, error, false);
     }
 
     function queryTransaction(tx)
@@ -1339,296 +1334,5 @@ InjectedScript._escapeCharacters = function(str, chars)
     return result;
 }
 
-InjectedScript.JSON = {};
-
-// The following code is a slightly modified version of http://www.json.org/json2.js last modified on 2009-09-29.
-// Compared to the original version it ignores toJSON method on objects it serializes.
-// It's done to avoid weird behaviour when inspected application provides it's own implementation
-// of toJSON methods to the Object and other intrinsic types. We use InjectedScript.JSON implementation
-// instead of global JSON object since it can have been modified by the inspected code.
-(function() {
-
-    function f(n) {
-        // Format integers to have at least two digits.
-        return n < 10 ? '0' + n : n;
-    }
-
-    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
-        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
-        gap,
-        indent,
-        meta = {    // table of character substitutions
-            '\b': '\\b',
-            '\t': '\\t',
-            '\n': '\\n',
-            '\f': '\\f',
-            '\r': '\\r',
-            '"' : '\\"',
-            '\\': '\\\\'
-        },
-        rep;
-
-
-    function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
-        escapable.lastIndex = 0;
-        return escapable.test(string) ?
-            '"' + string.replace(escapable, function (a) {
-                var c = meta[a];
-                return typeof c === 'string' ? c :
-                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
-            }) + '"' :
-            '"' + string + '"';
-    }
-
-
-    function str(key, holder) {
-
-// Produce a string from holder[key].
-
-        var i,          // The loop counter.
-            k,          // The member key.
-            v,          // The member value.
-            length,
-            mind = gap,
-            partial,
-            value = holder[key];
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
-        if (typeof rep === 'function') {
-            value = rep.call(holder, key, value);
-        }
-
-// What happens next depends on the value's type.
-
-        switch (typeof value) {
-        case 'string':
-            return quote(value);
-
-        case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
-            return isFinite(value) ? String(value) : 'null';
-
-        case 'boolean':
-        case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
-            return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
-        case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
-            if (!value) {
-                return 'null';
-            }
-
-// Make an array to hold the partial results of stringifying this object value.
-
-            gap += indent;
-            partial = [];
-
-// Is the value an array?
-
-            if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
-                length = value.length;
-                for (i = 0; i < length; i += 1) {
-                    partial[i] = str(i, value) || 'null';
-                }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
-                v = partial.length === 0 ? '[]' :
-                    gap ? '[\n' + gap +
-                            partial.join(',\n' + gap) + '\n' +
-                                mind + ']' :
-                          '[' + partial.join(',') + ']';
-                gap = mind;
-                return v;
-            }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
-            if (rep && typeof rep === 'object') {
-                length = rep.length;
-                for (i = 0; i < length; i += 1) {
-                    k = rep[i];
-                    if (typeof k === 'string') {
-                        v = str(k, value);
-                        if (v) {
-                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
-                        }
-                    }
-                }
-            } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
-                for (k in value) {
-                    if (Object.hasOwnProperty.call(value, k)) {
-                        v = str(k, value);
-                        if (v) {
-                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
-                        }
-                    }
-                }
-            }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
-            v = partial.length === 0 ? '{}' :
-                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
-                        mind + '}' : '{' + partial.join(',') + '}';
-            gap = mind;
-            return v;
-        }
-    }
-
-        InjectedScript.JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
-            var i;
-            gap = '';
-            indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
-            if (typeof space === 'number') {
-                for (i = 0; i < space; i += 1) {
-                    indent += ' ';
-                }
-
-// If the space parameter is a string, it will be used as the indent string.
-
-            } else if (typeof space === 'string') {
-                indent = space;
-            }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
-            rep = replacer;
-            if (replacer && typeof replacer !== 'function' &&
-                    (typeof replacer !== 'object' ||
-                     typeof replacer.length !== 'number')) {
-                throw new Error('JSON.stringify');
-            }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
-            return str('', {'': value});
-        };
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
-    InjectedScript.JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
-            var j;
-
-            function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
-                var k, v, value = holder[key];
-                if (value && typeof value === 'object') {
-                    for (k in value) {
-                        if (Object.hasOwnProperty.call(value, k)) {
-                            v = walk(value, k);
-                            if (v !== undefined) {
-                                value[k] = v;
-                            } else {
-                                delete value[k];
-                            }
-                        }
-                    }
-                }
-                return reviver.call(holder, key, value);
-            }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
-            cx.lastIndex = 0;
-            if (cx.test(text)) {
-                text = text.replace(cx, function (a) {
-                    return '\\u' +
-                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
-                });
-            }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
-            if (/^[\],:{}\s]*$/.
-test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
-replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
-replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
-                j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
-                return typeof reviver === 'function' ?
-                    walk({'': j}, '') : j;
-            }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
-            throw new SyntaxError('JSON.parse');
-        };
-}());
-
 return InjectedScript;
 });
diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js
index 2dd2908..2558267 100644
--- a/WebCore/inspector/front-end/InjectedScriptAccess.js
+++ b/WebCore/inspector/front-end/InjectedScriptAccess.js
@@ -56,7 +56,7 @@ InjectedScriptAccess._installHandler = function(methodName, async)
         function myCallback(result, isException)
         {
             if (!isException)
-                callback(JSON.parse(result));
+                callback(result);
             else
                 WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage("Error dispatching: " + methodName));
         }
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index ccd3d00..7604b87 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1203,7 +1203,6 @@ WebInspector.failedToParseScriptSource = function(sourceURL, source, startingLin
 
 WebInspector.pausedScript = function(callFrames)
 {
-    callFrames = JSON.parse(callFrames);
     this.panels.scripts.debuggerPaused(callFrames);
 }
 
@@ -1260,7 +1259,7 @@ WebInspector.updateConsoleMessageExpiredCount = function(count)
     WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
 }
 
-WebInspector.addConsoleMessage = function(payload, argumentsStringified, opt_args)
+WebInspector.addConsoleMessage = function(payload, opt_args)
 {
     var consoleMessage = new WebInspector.ConsoleMessage(
         payload.source,
@@ -1270,14 +1269,7 @@ WebInspector.addConsoleMessage = function(payload, argumentsStringified, opt_arg
         payload.url,
         payload.groupLevel,
         payload.repeatCount);
-    var parsedArguments = [];
-    for (var i = 2; i < arguments.length; i++) {
-        if (argumentsStringified)
-            parsedArguments.push(JSON.parse(arguments[i]));
-        else
-            parsedArguments.push(arguments[i]);
-    }
-    consoleMessage.setMessageBody(parsedArguments);
+    consoleMessage.setMessageBody(Array.prototype.slice.call(arguments, 1));
     this.console.addMessage(consoleMessage);
 }
 
diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp
index 441bec7..9d4d0d0 100644
--- a/WebKit/qt/Api/qwebelement.cpp
+++ b/WebKit/qt/Api/qwebelement.cpp
@@ -38,7 +38,6 @@
 #include "NodeList.h"
 #include "PropertyNameArray.h"
 #include "RenderImage.h"
-#include "ScriptFunctionCall.h"
 #include "StaticNodeList.h"
 #include "qt_runtime.h"
 #include "qwebframe.h"
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 5f6293e..66d620b 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,13 @@
+2010-02-05  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Remove unused inmport of ScriptFunctionCall.h
+
+        https://bugs.webkit.org/show_bug.cgi?id=33592
+
+        * Api/qwebelement.cpp:
+
 2010-02-05  Tor Arne Vestbø  <tor.arne.vestbo at nokia.com>
 
         Reviewed by Simon Hausmann.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list