summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/bindings/js/ScriptValue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bindings/js/ScriptValue.cpp')
-rw-r--r--Source/WebCore/bindings/js/ScriptValue.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/Source/WebCore/bindings/js/ScriptValue.cpp b/Source/WebCore/bindings/js/ScriptValue.cpp
index 6fe6ea3..4f51ddb 100644
--- a/Source/WebCore/bindings/js/ScriptValue.cpp
+++ b/Source/WebCore/bindings/js/ScriptValue.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,7 +36,7 @@
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSValueRef.h>
-#include <collector/handles/Global.h>
+#include <heap/Strong.h>
#include <runtime/JSLock.h>
#include <runtime/UString.h>
@@ -55,6 +56,15 @@ bool ScriptValue::getString(ScriptState* scriptState, String& result) const
return true;
}
+String ScriptValue::toString(ScriptState* scriptState) const
+{
+ String result = ustringToString(m_value.get().toString(scriptState));
+ // Handle the case where an exception is thrown as part of invoking toString on the object.
+ if (scriptState->hadException())
+ scriptState->clearException();
+ return result;
+}
+
bool ScriptValue::isEqual(ScriptState* scriptState, const ScriptValue& anotherValue) const
{
if (hasNoValue())
@@ -90,14 +100,14 @@ bool ScriptValue::isFunction() const
return getCallData(m_value.get(), callData) != CallTypeNone;
}
-PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
+PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, SerializationErrorMode throwExceptions)
{
- return SerializedScriptValue::create(scriptState, jsValue());
+ return SerializedScriptValue::create(scriptState, jsValue(), throwExceptions);
}
-ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
+ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value, SerializationErrorMode throwExceptions)
{
- return ScriptValue(scriptState->globalData(), value->deserialize(scriptState, scriptState->lexicalGlobalObject()));
+ return ScriptValue(scriptState->globalData(), value->deserialize(scriptState, scriptState->lexicalGlobalObject(), throwExceptions));
}
#if ENABLE(INSPECTOR)