From 41386e9cb918eed93b3f13648cbef387e371e451 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Wed, 20 May 2015 09:56:07 +0000 Subject: webkitgtk-2.4.9 --- Source/JavaScriptCore/bindings/ScriptValue.cpp | 37 +++++++++++++------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'Source/JavaScriptCore/bindings/ScriptValue.cpp') 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 jsToInspectorValue(ExecState* scriptState, JSValue value, int maxDepth) +#if ENABLE(INSPECTOR) +static PassRefPtr jsToInspectorValue(ExecState* scriptState, JSValue value, int maxDepth) { if (!value) { ASSERT_NOT_REACHED(); @@ -113,16 +113,16 @@ static RefPtr 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(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::create(); + RefPtr inspectorArray = InspectorArray::create(); JSArray* array = asArray(value); unsigned length = array->length(); for (unsigned i = 0; i < length; i++) { @@ -130,33 +130,34 @@ static RefPtr jsToInspectorValue(ExecState* scriptState, JSValue RefPtr 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::create(); + RefPtr 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 = 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 ScriptValue::toInspectorValue(ExecState* scriptState) const +PassRefPtr ScriptValue::toInspectorValue(ExecState* scriptState) const { JSLockHolder holder(scriptState); return jsToInspectorValue(scriptState, m_value.get(), InspectorValue::maxDepth); } +#endif // ENABLE(INSPECTOR) } // namespace Deprecated -- cgit v1.2.1