summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bindings/ScriptValue.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
commit41386e9cb918eed93b3f13648cbef387e371e451 (patch)
treea97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/bindings/ScriptValue.cpp
parente15dd966d523731101f70ccf768bba12435a0208 (diff)
downloadWebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/bindings/ScriptValue.cpp')
-rw-r--r--Source/JavaScriptCore/bindings/ScriptValue.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/Source/JavaScriptCore/bindings/ScriptValue.cpp b/Source/JavaScriptCore/bindings/ScriptValue.cpp
index 02ef36e2d..c72ab4634 100644
--- a/Source/JavaScriptCore/bindings/ScriptValue.cpp
+++ b/Source/JavaScriptCore/bindings/ScriptValue.cpp
@@ -11,7 +11,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -33,7 +33,6 @@
#include "APICast.h"
#include "InspectorValues.h"
#include "JSLock.h"
-#include "StructureInlines.h"
using namespace JSC;
using namespace Inspector;
@@ -97,7 +96,8 @@ bool ScriptValue::isFunction() const
return getCallData(m_value.get(), callData) != CallTypeNone;
}
-static RefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSValue value, int maxDepth)
+#if ENABLE(INSPECTOR)
+static PassRefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSValue value, int maxDepth)
{
if (!value) {
ASSERT_NOT_REACHED();
@@ -113,16 +113,16 @@ static RefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSValue
return InspectorValue::null();
if (value.isBoolean())
return InspectorBasicValue::create(value.asBoolean());
- if (value.isNumber() && value.isDouble())
+ if (value.isNumber())
return InspectorBasicValue::create(value.asNumber());
- if (value.isNumber() && value.isMachineInt())
- return InspectorBasicValue::create(static_cast<int>(value.asMachineInt()));
- if (value.isString())
- return InspectorString::create(value.getString(scriptState));
+ if (value.isString()) {
+ String s = value.getString(scriptState);
+ return InspectorString::create(String(s.deprecatedCharacters(), s.length()));
+ }
if (value.isObject()) {
if (isJSArray(value)) {
- Ref<InspectorArray> inspectorArray = InspectorArray::create();
+ RefPtr<InspectorArray> inspectorArray = InspectorArray::create();
JSArray* array = asArray(value);
unsigned length = array->length();
for (unsigned i = 0; i < length; i++) {
@@ -130,33 +130,34 @@ static RefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSValue
RefPtr<InspectorValue> elementValue = jsToInspectorValue(scriptState, element, maxDepth);
if (!elementValue)
return nullptr;
- inspectorArray->pushValue(WTF::move(elementValue));
+ inspectorArray->pushValue(elementValue);
}
- return WTF::move(inspectorArray);
+ return inspectorArray;
}
- Ref<InspectorObject> inspectorObject = InspectorObject::create();
+ RefPtr<InspectorObject> inspectorObject = InspectorObject::create();
JSObject* object = value.getObject();
- PropertyNameArray propertyNames(scriptState, PropertyNameMode::Strings);
- object->methodTable()->getOwnPropertyNames(object, scriptState, propertyNames, EnumerationMode());
+ PropertyNameArray propertyNames(scriptState);
+ object->methodTable()->getOwnPropertyNames(object, scriptState, propertyNames, ExcludeDontEnumProperties);
for (size_t i = 0; i < propertyNames.size(); i++) {
- const Identifier& name = propertyNames[i];
+ const Identifier& name = propertyNames[i];
JSValue propertyValue = object->get(scriptState, name);
RefPtr<InspectorValue> inspectorValue = jsToInspectorValue(scriptState, propertyValue, maxDepth);
if (!inspectorValue)
return nullptr;
- inspectorObject->setValue(name.string(), WTF::move(inspectorValue));
+ inspectorObject->setValue(String(name.deprecatedCharacters(), name.length()), inspectorValue);
}
- return WTF::move(inspectorObject);
+ return inspectorObject;
}
ASSERT_NOT_REACHED();
return nullptr;
}
-RefPtr<InspectorValue> ScriptValue::toInspectorValue(ExecState* scriptState) const
+PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ExecState* scriptState) const
{
JSLockHolder holder(scriptState);
return jsToInspectorValue(scriptState, m_value.get(), InspectorValue::maxDepth);
}
+#endif // ENABLE(INSPECTOR)
} // namespace Deprecated