diff options
| author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
|---|---|---|
| committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
| commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
| tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/bindings | |
| parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
| download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz | |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/bindings')
| -rw-r--r-- | Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp | 13 | ||||
| -rw-r--r-- | Source/JavaScriptCore/bindings/ScriptFunctionCall.h | 2 | ||||
| -rw-r--r-- | Source/JavaScriptCore/bindings/ScriptObject.cpp | 2 | ||||
| -rw-r--r-- | Source/JavaScriptCore/bindings/ScriptValue.cpp | 37 | ||||
| -rw-r--r-- | Source/JavaScriptCore/bindings/ScriptValue.h | 6 |
5 files changed, 28 insertions, 32 deletions
diff --git a/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp b/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp index d6745bebc..f2647da29 100644 --- a/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp +++ b/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp @@ -32,7 +32,6 @@ #include "config.h" #include "ScriptFunctionCall.h" -#include "JSCInlines.h" #include "JSLock.h" #include "ScriptValue.h" #include <wtf/text/WTFString.h> @@ -121,7 +120,7 @@ Deprecated::ScriptValue ScriptFunctionCall::call(bool& hadException) JSLockHolder lock(m_exec); - JSValue function = thisObject->get(m_exec, Identifier::fromString(m_exec, m_name)); + JSValue function = thisObject->get(m_exec, Identifier(m_exec, m_name)); if (m_exec->hadException()) { hadException = true; return Deprecated::ScriptValue(); @@ -133,15 +132,13 @@ Deprecated::ScriptValue ScriptFunctionCall::call(bool& hadException) return Deprecated::ScriptValue(); JSValue result; - NakedPtr<Exception> exception; if (m_callHandler) - result = m_callHandler(m_exec, function, callType, callData, thisObject, m_arguments, exception); + result = m_callHandler(m_exec, function, callType, callData, thisObject, m_arguments); else - result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments, exception); + result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments); - if (exception) { - // Do not treat a terminated execution exception as having an exception. Just treat it as an empty result. - hadException = !isTerminatedExecutionException(exception); + if (m_exec->hadException()) { + hadException = true; return Deprecated::ScriptValue(); } diff --git a/Source/JavaScriptCore/bindings/ScriptFunctionCall.h b/Source/JavaScriptCore/bindings/ScriptFunctionCall.h index 25cdfb214..04b2afe07 100644 --- a/Source/JavaScriptCore/bindings/ScriptFunctionCall.h +++ b/Source/JavaScriptCore/bindings/ScriptFunctionCall.h @@ -71,7 +71,7 @@ private: class JS_EXPORT_PRIVATE ScriptFunctionCall : public ScriptCallArgumentHandler { public: - typedef JSC::JSValue (*ScriptFunctionCallHandler)(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args, NakedPtr<JSC::Exception>&); + typedef JSC::JSValue (*ScriptFunctionCallHandler)(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args); ScriptFunctionCall(const ScriptObject& thisObject, const String& name, ScriptFunctionCallHandler handler = nullptr); ScriptValue call(bool& hadException); ScriptValue call(); diff --git a/Source/JavaScriptCore/bindings/ScriptObject.cpp b/Source/JavaScriptCore/bindings/ScriptObject.cpp index 70422e282..ccf7af28f 100644 --- a/Source/JavaScriptCore/bindings/ScriptObject.cpp +++ b/Source/JavaScriptCore/bindings/ScriptObject.cpp @@ -32,8 +32,6 @@ #include "config.h" #include "ScriptObject.h" -#include "JSCInlines.h" - using namespace JSC; namespace Deprecated { diff --git a/Source/JavaScriptCore/bindings/ScriptValue.cpp b/Source/JavaScriptCore/bindings/ScriptValue.cpp index 3e560dcc3..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(WTFMove(elementValue)); + inspectorArray->pushValue(elementValue); } - return WTFMove(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(), WTFMove(inspectorValue)); + inspectorObject->setValue(String(name.deprecatedCharacters(), name.length()), inspectorValue); } - return WTFMove(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 diff --git a/Source/JavaScriptCore/bindings/ScriptValue.h b/Source/JavaScriptCore/bindings/ScriptValue.h index 78a2ee9a3..d5fade90b 100644 --- a/Source/JavaScriptCore/bindings/ScriptValue.h +++ b/Source/JavaScriptCore/bindings/ScriptValue.h @@ -33,7 +33,6 @@ #define ScriptValue_h #include "JSCJSValue.h" -#include "JSCJSValueInlines.h" #include "Operations.h" #include "Strong.h" #include "StrongInlines.h" @@ -52,7 +51,6 @@ public: ScriptValue(JSC::VM& vm, JSC::JSValue value) : m_value(vm, value) { } virtual ~ScriptValue(); - operator JSC::JSValue() const { return jsValue(); } JSC::JSValue jsValue() const { return m_value.get(); } bool getString(JSC::ExecState*, String& result) const; String toString(JSC::ExecState*) const; @@ -67,7 +65,9 @@ public: bool operator==(const ScriptValue& other) const { return m_value == other.m_value; } - RefPtr<Inspector::InspectorValue> toInspectorValue(JSC::ExecState*) const; +#if ENABLE(INSPECTOR) + PassRefPtr<Inspector::InspectorValue> toInspectorValue(JSC::ExecState*) const; +#endif private: JSC::Strong<JSC::Unknown> m_value; |
