Diff
Modified: trunk/Source/WebCore/ChangeLog (137206 => 137207)
--- trunk/Source/WebCore/ChangeLog 2012-12-10 22:15:01 UTC (rev 137206)
+++ trunk/Source/WebCore/ChangeLog 2012-12-10 22:31:43 UTC (rev 137207)
@@ -1,3 +1,17 @@
+2012-12-10 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r136817.
+ http://trac.webkit.org/changeset/136817
+ https://bugs.webkit.org/show_bug.cgi?id=104596
+
+ This patch was an unnecessarily complex solution to handling
+ conversion of union types. (Requested by mpruett on #webkit).
+
+ * bindings/js/JSDictionary.cpp:
+ (WebCore::JSDictionary::convertValue):
+ * bindings/js/JSDictionary.h:
+ (WebCore::JSDictionary::tryGetPropertyAndResult):
+
2012-12-10 Tab Atkins <[email protected]>
Deprecate prefixed linear-gradient and radial-gradient functions
Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (137206 => 137207)
--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2012-12-10 22:15:01 UTC (rev 137206)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2012-12-10 22:31:43 UTC (rev 137207)
@@ -68,182 +68,152 @@
return PropertyFound;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, bool& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, bool& result)
{
result = value.toBoolean(exec);
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, int& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, int& result)
{
result = value.toInt32(exec);
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned& result)
{
result = value.toUInt32(exec);
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned short& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned short& result)
{
result = static_cast<unsigned short>(value.toUInt32(exec));
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long& result)
{
result = static_cast<unsigned long>(value.toUInt32(exec));
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result)
{
double d = value.toNumber(exec);
doubleToInteger(d, result);
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, double& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, double& result)
{
result = value.toNumber(exec);
- return true;
}
-bool JSDictionary::convertValue(JSC::ExecState* exec, JSC::JSValue value, Dictionary& result)
+void JSDictionary::convertValue(JSC::ExecState* exec, JSC::JSValue value, Dictionary& result)
{
result = Dictionary(exec, value);
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, String& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, String& result)
{
result = value.toString(exec)->value(exec);
- return !exec->hadException();
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, Vector<String>& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, Vector<String>& result)
{
if (value.isUndefinedOrNull())
- return false;
+ return;
- if (!value.isObject())
- return false;
- JSObject* object = asObject(value);
- if (!isJSArray(object) && !object->inherits(&JSArray::s_info))
- return false;
-
unsigned length = 0;
- object = toJSSequence(exec, value, length);
+ JSObject* object = toJSSequence(exec, value, length);
if (exec->hadException())
- return false;
+ return;
for (unsigned i = 0 ; i < length; ++i) {
JSValue itemValue = object->get(exec, i);
if (exec->hadException())
- return false;
+ return;
result.append(itemValue.toString(exec)->value(exec));
}
-
- return !exec->hadException();
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, ScriptValue& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, ScriptValue& result)
{
result = ScriptValue(exec->globalData(), value);
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, RefPtr<SerializedScriptValue>& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, RefPtr<SerializedScriptValue>& result)
{
result = SerializedScriptValue::create(exec, value, 0, 0);
- return !exec->hadException();
}
-bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<DOMWindow>& result)
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<DOMWindow>& result)
{
result = toDOMWindow(value);
- return true;
}
-bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<EventTarget>& result)
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<EventTarget>& result)
{
result = toEventTarget(value);
- return true;
}
-bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Node>& result)
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Node>& result)
{
result = toNode(value);
- return true;
}
-bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Storage>& result)
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Storage>& result)
{
result = toStorage(value);
- return true;
}
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, MessagePortArray& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, MessagePortArray& result)
{
ArrayBufferArray arrayBuffers;
fillMessagePortArray(exec, value, result, arrayBuffers);
- return true;
}
#if ENABLE(VIDEO_TRACK)
-bool JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<TrackBase>& result)
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<TrackBase>& result)
{
result = toTrack(value);
- return true;
}
#endif
#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS)
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicString>& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicString>& result)
{
result.clear();
if (value.isUndefinedOrNull())
- return false;
+ return;
unsigned length = 0;
JSObject* object = toJSSequence(exec, value, length);
if (exec->hadException())
- return false;
+ return;
for (unsigned i = 0 ; i < length; ++i) {
JSValue itemValue = object->get(exec, i);
if (exec->hadException())
- return false;
+ return;
result.add(itemValue.toString(exec)->value(exec));
}
-
- return !exec->hadException();
}
#endif
-bool JSDictionary::convertValue(ExecState* exec, JSValue value, ArrayValue& result)
+void JSDictionary::convertValue(ExecState* exec, JSValue value, ArrayValue& result)
{
if (value.isUndefinedOrNull())
- return false;
+ return;
result = ArrayValue(exec, value);
- return true;
}
-bool JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<Uint8Array>& result)
+void JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<Uint8Array>& result)
{
result = toUint8Array(value);
- return true;
}
#if ENABLE(ENCRYPTED_MEDIA)
-bool JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<MediaKeyError>& result)
+void JSDictionary::convertValue(JSC::ExecState*, JSC::JSValue value, RefPtr<MediaKeyError>& result)
{
result = toMediaKeyError(value);
- return true;
}
#endif
Modified: trunk/Source/WebCore/bindings/js/JSDictionary.h (137206 => 137207)
--- trunk/Source/WebCore/bindings/js/JSDictionary.h 2012-12-10 22:15:01 UTC (rev 137206)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.h 2012-12-10 22:31:43 UTC (rev 137207)
@@ -81,41 +81,40 @@
enum GetPropertyResult {
ExceptionThrown,
NoPropertyFound,
- PropertyFound,
- ConversionFailed
+ PropertyFound
};
template <typename T, typename Result>
GetPropertyResult tryGetPropertyAndResult(const char* propertyName, T* context, void (*setter)(T* context, const Result&)) const;
GetPropertyResult tryGetProperty(const char* propertyName, JSC::JSValue&) const;
- static bool convertValue(JSC::ExecState*, JSC::JSValue, bool& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, int& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, unsigned& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, unsigned short& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, unsigned long& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, unsigned long long& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, double& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, Dictionary& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, String& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, ScriptValue& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, Vector<String>& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<SerializedScriptValue>& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<DOMWindow>& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<EventTarget>& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Node>& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Storage>& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, MessagePortArray& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, bool& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, int& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned short& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned long& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned long long& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, double& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, Dictionary& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, String& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, ScriptValue& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, Vector<String>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<SerializedScriptValue>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<DOMWindow>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<EventTarget>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Node>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Storage>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, MessagePortArray& result);
#if ENABLE(VIDEO_TRACK)
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<TrackBase>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<TrackBase>& result);
#endif
#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS)
- static bool convertValue(JSC::ExecState*, JSC::JSValue, HashSet<AtomicString>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, HashSet<AtomicString>& result);
#endif
- static bool convertValue(JSC::ExecState*, JSC::JSValue, ArrayValue& result);
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Uint8Array>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, ArrayValue& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Uint8Array>& result);
#if ENABLE(ENCRYPTED_MEDIA)
- static bool convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<MediaKeyError>& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<MediaKeyError>& result);
#endif
JSC::ExecState* m_exec;
@@ -150,20 +149,16 @@
return getPropertyResult;
case PropertyFound: {
Result result;
- if (!convertValue(m_exec, value, result)) {
- if (m_exec->hadException())
- return ExceptionThrown;
- return ConversionFailed;
- }
+ convertValue(m_exec, value, result);
+ if (m_exec->hadException())
+ return ExceptionThrown;
+
setter(context, result);
break;
}
case NoPropertyFound:
break;
- case ConversionFailed:
- ASSERT_NOT_REACHED();
- break;
}
return getPropertyResult;