Diff
Modified: trunk/Source/WebCore/ChangeLog (94122 => 94123)
--- trunk/Source/WebCore/ChangeLog 2011-08-30 23:31:31 UTC (rev 94122)
+++ trunk/Source/WebCore/ChangeLog 2011-08-30 23:34:42 UTC (rev 94123)
@@ -1,3 +1,22 @@
+2011-08-30 Sam Weinig <[email protected]>
+
+ Add additional convertValue overloads to JSDictionary
+ https://bugs.webkit.org/show_bug.cgi?id=67244
+
+ Reviewed by Darin Adler.
+
+ Add overloads for convertValue that will be needed for Event
+ constructors.
+
+ * bindings/js/JSDictionary.cpp:
+ (WebCore::JSDictionary::convertValue):
+ * bindings/js/JSDictionary.h:
+ Add overloads. Remove #include of <runtime/Error.h> and just include
+ <interpreter/CallFrame.h>
+
+ * bindings/js/JSEventConstructors.cpp:
+ Add now necessary #include of <runtime/Error.h>.
+
2011-08-30 Aaron Colwell <[email protected]>
Add MediaSource API to HTMLMediaElement
Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (94122 => 94123)
--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2011-08-30 23:31:31 UTC (rev 94122)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2011-08-30 23:34:42 UTC (rev 94123)
@@ -27,6 +27,12 @@
#include "config.h"
#include "JSDictionary.h"
+#include "JSDOMWindow.h"
+#include "JSEventTarget.h"
+#include "JSNode.h"
+#include "SerializedScriptValue.h"
+#include "ScriptValue.h"
+
using namespace JSC;
namespace WebCore {
@@ -54,9 +60,59 @@
result = value.toBoolean(exec);
}
+void JSDictionary::convertValue(ExecState* exec, JSValue value, int& result)
+{
+ result = value.toInt32(exec);
+}
+
+void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned& result)
+{
+ result = value.toUInt32(exec);
+}
+
+void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned short& result)
+{
+ result = static_cast<unsigned short>(value.toUInt32(exec));
+}
+
+void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result)
+{
+ result = static_cast<unsigned long long>(value.toInteger(exec));
+}
+
void JSDictionary::convertValue(ExecState* exec, JSValue value, double& result)
{
result = value.toNumber(exec);
}
+void JSDictionary::convertValue(ExecState* exec, JSValue value, String& result)
+{
+ result = ustringToString(value.toString(exec));
+}
+
+void JSDictionary::convertValue(ExecState* exec, JSValue value, ScriptValue& result)
+{
+ result = ScriptValue(exec->globalData(), value);
+}
+
+void JSDictionary::convertValue(ExecState* exec, JSValue value, RefPtr<SerializedScriptValue>& result)
+{
+ result = SerializedScriptValue::create(exec, value);
+}
+
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<DOMWindow>& result)
+{
+ result = toDOMWindow(value);
+}
+
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<EventTarget>& result)
+{
+ result = toEventTarget(value);
+}
+
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Node>& result)
+{
+ result = toNode(value);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/JSDictionary.h (94122 => 94123)
--- trunk/Source/WebCore/bindings/js/JSDictionary.h 2011-08-30 23:31:31 UTC (rev 94122)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.h 2011-08-30 23:34:42 UTC (rev 94123)
@@ -26,10 +26,17 @@
#ifndef JSDictionary_h
#define JSDictionary_h
-#include <runtime/Error.h>
+#include <interpreter/CallFrame.h>
+#include <wtf/Forward.h>
namespace WebCore {
+class DOMWindow;
+class EventTarget;
+class Node;
+class ScriptValue;
+class SerializedScriptValue;
+
class JSDictionary {
public:
JSDictionary(JSC::ExecState* exec, JSC::JSObject* initializerObject)
@@ -53,7 +60,17 @@
GetPropertyResult tryGetProperty(const char* propertyName, JSC::JSValue&);
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 long& result);
static void convertValue(JSC::ExecState*, JSC::JSValue, double& 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, 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);
JSC::ExecState* m_exec;
JSC::JSObject* m_initializerObject;
Modified: trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp (94122 => 94123)
--- trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp 2011-08-30 23:31:31 UTC (rev 94122)
+++ trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp 2011-08-30 23:34:42 UTC (rev 94123)
@@ -29,6 +29,7 @@
#include "Event.h"
#include "JSDictionary.h"
#include "JSEvent.h"
+#include <runtime/Error.h>
using namespace JSC;