Diff
Modified: trunk/Source/WebCore/ChangeLog (128247 => 128248)
--- trunk/Source/WebCore/ChangeLog 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/ChangeLog 2012-09-12 00:35:07 UTC (rev 128248)
@@ -1,3 +1,53 @@
+2012-09-11 Alec Flett <[email protected]>
+
+ Add 'any' type to V8 bindings as a synonym for DOMObject
+ https://bugs.webkit.org/show_bug.cgi?id=96429
+
+ Reviewed by Kentaro Hara.
+
+ Adds support for 'any' as a synonym to DOMObject.
+
+ Test: TestObj.idl has an attribute 'anyAttribute'.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (AddIncludesForType):
+ (JSValueToNative):
+ (NativeToJSValue):
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GetNativeType):
+ (JSValueToNative):
+ (GetV8HeaderName):
+ * bindings/scripts/test/CPP/WebDOMTestObj.cpp:
+ (WebDOMTestObj::anyAttribute):
+ (WebDOMTestObj::setAnyAttribute):
+ * bindings/scripts/test/CPP/WebDOMTestObj.h:
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ (webkit_dom_test_obj_get_property):
+ (webkit_dom_test_obj_class_init):
+ (webkit_dom_test_obj_get_any_attribute):
+ (webkit_dom_test_obj_set_any_attribute):
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore):
+ (WebCore::jsTestObjCachedAttribute1):
+ (WebCore::jsTestObjCachedAttribute2):
+ (WebCore::jsTestObjAnyAttribute):
+ (WebCore::setJSTestObjAnyAttribute):
+ * bindings/scripts/test/JS/JSTestObj.h:
+ (WebCore):
+ * bindings/scripts/test/ObjC/DOMTestObj.h:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj anyAttribute]):
+ (-[DOMTestObj setAnyAttribute:]):
+ * bindings/scripts/test/TestObj.idl:
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjV8Internal::cachedAttribute1AttrGetter):
+ (WebCore::TestObjV8Internal::cachedAttribute2AttrGetter):
+ (TestObjV8Internal):
+ (WebCore::TestObjV8Internal::anyAttributeAttrGetter):
+ (WebCore::TestObjV8Internal::anyAttributeAttrSetter):
+ (WebCore):
+
2012-09-11 Michael Saboff <[email protected]>
Unreviewed build fix for http://trac.webkit.org/changeset/128244
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-09-12 00:35:07 UTC (rev 128248)
@@ -248,7 +248,7 @@
# When we're finished with the one-file-per-class
# reorganization, we won't need these special cases.
if ($codeGenerator->IsPrimitiveType($type) or $codeGenerator->SkipIncludeHeader($type)
- or $type eq "DOMString" or $type eq "DOMObject" or $type eq "Array" or $type eq "DOMTimeStamp") {
+ or $type eq "DOMString" or $type eq "DOMObject" or $type eq "any" or $type eq "Array" or $type eq "DOMTimeStamp") {
} elsif ($type =~ /SVGPathSeg/) {
my $joinedName = $type;
$joinedName =~ s/Abs|Rel//;
@@ -2939,6 +2939,7 @@
"SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
"IDBKey" => "PassRefPtr<IDBKey>",
"Dictionary" => "Dictionary",
+ "any" => "ScriptValue",
"boolean" => "bool",
"double" => "double",
"float" => "float",
@@ -3054,7 +3055,7 @@
return "$value.isEmpty() ? String() : $value.toString(exec)->value(exec)";
}
- if ($type eq "DOMObject") {
+ if ($type eq "DOMObject" or $type eq "any") {
return "exec->globalData(), $value";
}
@@ -3068,7 +3069,7 @@
return "MediaQueryListListener::create(ScriptValue(exec->globalData(), " . $value ."))";
}
- if ($type eq "SerializedScriptValue" or $type eq "any") {
+ if ($type eq "SerializedScriptValue") {
AddToImplIncludes("SerializedScriptValue.h", $conditional);
return "SerializedScriptValue::create(exec, $value, 0, 0)";
}
@@ -3183,7 +3184,7 @@
return "jsArray(exec, $thisValue->globalObject(), $value)";
}
- if ($type eq "DOMObject") {
+ if ($type eq "DOMObject" or $type eq "any") {
if ($implClassName eq "Document") {
AddToImplIncludes("JSCanvasRenderingContext2D.h", $conditional);
} else {
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-09-12 00:35:07 UTC (rev 128248)
@@ -3659,7 +3659,7 @@
# EventTarget can be passed as a parameter.
return "Node*" if $type eq "EventTarget" and $isParameter;
return "double" if $type eq "Date";
- return "ScriptValue" if $type eq "DOMObject";
+ return "ScriptValue" if $type eq "DOMObject" or $type eq "any";
return "Dictionary" if $type eq "Dictionary";
return "String" if $type eq "DOMUserData"; # FIXME: Temporary hack?
@@ -3758,7 +3758,7 @@
return "Dictionary($value, $getIsolate)";
}
- if ($type eq "DOMObject") {
+ if ($type eq "DOMObject" or $type eq "any") {
AddToImplIncludes("ScriptValue.h");
return "ScriptValue($value)";
}
@@ -3819,7 +3819,7 @@
return "V8Event.h" if $type eq "DOMTimeStamp";
return "EventListener.h" if $type eq "EventListener";
return "SerializedScriptValue.h" if $type eq "SerializedScriptValue";
- return "ScriptValue.h" if $type eq "DOMObject";
+ return "ScriptValue.h" if $type eq "DOMObject" or $type eq "any";
return "V8DOMStringList.h" if $type eq "DOMString[]";
return "V8${type}.h";
}
@@ -3917,6 +3917,7 @@
'MediaQueryListListener' => 1,
'NodeFilter' => 1,
'SerializedScriptValue' => 1,
+ 'any' => 1,
'boolean' => 1,
'double' => 1,
'float' => 1,
Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp 2012-09-12 00:35:07 UTC (rev 128248)
@@ -35,6 +35,7 @@
#include "WebDOMSVGPoint.h"
#include "WebDOMString.h"
#include "WebDOMa.h"
+#include "WebDOMany.h"
#include "WebDOMb.h"
#include "WebDOMbool.h"
#include "WebDOMd.h"
@@ -42,6 +43,7 @@
#include "WebExceptionHandler.h"
#include "WebNativeEventListener.h"
#include "a.h"
+#include "any.h"
#include "b.h"
#include "bool.h"
#include "d.h"
@@ -539,6 +541,22 @@
}
#endif
+WebDOMany WebDOMTestObj::anyAttribute() const
+{
+ if (!impl())
+ return WebDOMany();
+
+ return toWebKit(WTF::getPtr(impl()->anyAttribute()));
+}
+
+void WebDOMTestObj::setAnyAttribute(const WebDOMany& newAnyAttribute)
+{
+ if (!impl())
+ return;
+
+ impl()->setAnyAttribute(toWebCore(newAnyAttribute));
+}
+
WebDOMDocument WebDOMTestObj::contentDocument() const
{
if (!impl())
Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h 2012-09-12 00:35:07 UTC (rev 128248)
@@ -38,6 +38,7 @@
class WebDOMString;
class WebDOMTestObj;
class WebDOMa;
+class WebDOMany;
class WebDOMb;
class WebDOMbool;
class WebDOMd;
@@ -128,6 +129,8 @@
int conditionalAttr3() const;
void setConditionalAttr3(int);
#endif
+ WebDOMany anyAttribute() const;
+ void setAnyAttribute(const WebDOMany&);
WebDOMDocument contentDocument() const;
WebDOMSVGPoint mutablePoint() const;
void setMutablePoint(const WebDOMSVGPoint&);
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2012-09-12 00:35:07 UTC (rev 128248)
@@ -29,6 +29,7 @@
#include "SVGPoint.h"
#include "TestObj.h"
#include "WebKitDOMBinding.h"
+#include "any.h"
#include "bool.h"
#include "gobject/ConvertToUTF8String.h"
#include "webkit/WebKitDOMDictionary.h"
@@ -44,6 +45,8 @@
#include "webkit/WebKitDOMTestObjPrivate.h"
#include "webkit/WebKitDOMa.h"
#include "webkit/WebKitDOMaPrivate.h"
+#include "webkit/WebKitDOMany.h"
+#include "webkit/WebKitDOManyPrivate.h"
#include "webkit/WebKitDOMb.h"
#include "webkit/WebKitDOMbPrivate.h"
#include "webkit/WebKitDOMbool.h"
@@ -134,6 +137,7 @@
PROP_CONDITIONAL_ATTR1,
PROP_CONDITIONAL_ATTR2,
PROP_CONDITIONAL_ATTR3,
+ PROP_ANY_ATTRIBUTE,
PROP_CONTENT_DOCUMENT,
PROP_MUTABLE_POINT,
PROP_IMMUTABLE_POINT,
@@ -481,6 +485,11 @@
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
break;
}
+ case PROP_ANY_ATTRIBUTE: {
+ RefPtr<WebCore::any> ptr = coreSelf->anyAttribute();
+ g_value_set_object(value, WebKit::kit(ptr.get()));
+ break;
+ }
case PROP_CONTENT_DOCUMENT: {
RefPtr<WebCore::Document> ptr = coreSelf->contentDocument();
g_value_set_object(value, WebKit::kit(ptr.get()));
@@ -825,6 +834,13 @@
0, /* default */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
+ PROP_ANY_ATTRIBUTE,
+ g_param_spec_object("any-attribute", /* name */
+ "test_obj_any-attribute", /* short description */
+ "read-write WebKitDOMany* TestObj.any-attribute", /* longer - could do with some extra doc stuff here */
+ WEBKIT_TYPE_DOM_ANY, /* gobject type */
+ WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gobjectClass,
PROP_CONTENT_DOCUMENT,
g_param_spec_object("content-document", /* name */
"test_obj_content-document", /* short description */
@@ -2240,6 +2256,32 @@
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}
+WebKitDOMany*
+webkit_dom_test_obj_get_any_attribute(WebKitDOMTestObj* self)
+{
+ g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj* item = WebKit::core(self);
+ RefPtr<WebCore::any> gobjectResult = WTF::getPtr(item->anyAttribute());
+ WebKitDOMany* result = WebKit::kit(gobjectResult.get());
+ return result;
+}
+
+void
+webkit_dom_test_obj_set_any_attribute(WebKitDOMTestObj* self, WebKitDOMany* value)
+{
+ g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj* item = WebKit::core(self);
+ g_return_if_fail(value);
+ WebCore::any* convertedValue = 0;
+ if (value) {
+ convertedValue = WebKit::core(value);
+ g_return_if_fail(convertedValue);
+ }
+ item->setAnyAttribute(convertedValue);
+}
+
WebKitDOMDocument*
webkit_dom_test_obj_get_content_document(WebKitDOMTestObj* self)
{
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h 2012-09-12 00:35:07 UTC (rev 128248)
@@ -1200,6 +1200,27 @@
webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value);
/**
+ * webkit_dom_test_obj_get_any_attribute:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns: (transfer none):
+ *
+**/
+WEBKIT_API WebKitDOMany*
+webkit_dom_test_obj_get_any_attribute(WebKitDOMTestObj* self);
+
+/**
+ * webkit_dom_test_obj_set_any_attribute:
+ * @self: A #WebKitDOMTestObj
+ * @value: A #WebKitDOMany
+ *
+ * Returns: (transfer none):
+ *
+**/
+WEBKIT_API void
+webkit_dom_test_obj_set_any_attribute(WebKitDOMTestObj* self, WebKitDOMany* value);
+
+/**
* webkit_dom_test_obj_get_content_document:
* @self: A #WebKitDOMTestObj
*
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-09-12 00:35:07 UTC (rev 128248)
@@ -135,6 +135,7 @@
#endif
{ "cachedAttribute1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute1), (intptr_t)0, NoIntrinsic },
{ "cachedAttribute2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute2), (intptr_t)0, NoIntrinsic },
+ { "anyAttribute", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAnyAttribute), (intptr_t)setJSTestObjAnyAttribute, NoIntrinsic },
{ "contentDocument", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjContentDocument), (intptr_t)0, NoIntrinsic },
{ "mutablePoint", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjMutablePoint), (intptr_t)setJSTestObjMutablePoint, NoIntrinsic },
{ "immutablePoint", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjImmutablePoint), (intptr_t)setJSTestObjImmutablePoint, NoIntrinsic },
@@ -844,7 +845,7 @@
if (JSValue cachedValue = castedThis->m_cachedAttribute1.get())
return cachedValue;
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
- JSValue result = impl->cachedAttribute1() ? impl->cachedAttribute1()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
+ JSValue result = (impl->cachedAttribute1().hasNoValue() ? jsNull() : impl->cachedAttribute1().jsValue());
castedThis->m_cachedAttribute1.set(exec->globalData(), castedThis, result);
return result;
}
@@ -857,12 +858,22 @@
if (JSValue cachedValue = castedThis->m_cachedAttribute2.get())
return cachedValue;
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
- JSValue result = impl->cachedAttribute2() ? impl->cachedAttribute2()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
+ JSValue result = (impl->cachedAttribute2().hasNoValue() ? jsNull() : impl->cachedAttribute2().jsValue());
castedThis->m_cachedAttribute2.set(exec->globalData(), castedThis, result);
return result;
}
+JSValue jsTestObjAnyAttribute(ExecState* exec, JSValue slotBase, PropertyName)
+{
+ JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+ JSValue result = (impl->anyAttribute().hasNoValue() ? jsNull() : impl->anyAttribute().jsValue());
+ return result;
+}
+
+
JSValue jsTestObjContentDocument(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
@@ -1350,6 +1361,15 @@
#endif
+void setJSTestObjAnyAttribute(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ UNUSED_PARAM(exec);
+ JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
+ TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+ impl->setAnyAttribute(exec->globalData(), value);
+}
+
+
void setJSTestObjMutablePoint(ExecState* exec, JSObject* thisObject, JSValue value)
{
UNUSED_PARAM(exec);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2012-09-12 00:35:07 UTC (rev 128248)
@@ -314,6 +314,8 @@
#endif
JSC::JSValue jsTestObjCachedAttribute1(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
JSC::JSValue jsTestObjCachedAttribute2(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
+JSC::JSValue jsTestObjAnyAttribute(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
+void setJSTestObjAnyAttribute(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjContentDocument(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
JSC::JSValue jsTestObjMutablePoint(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
void setJSTestObjMutablePoint(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2012-09-12 00:35:07 UTC (rev 128248)
@@ -38,6 +38,7 @@
@class DOMTestObjectBConstructor;
@class DOMTestObjectCConstructor;
@class DOMa;
+@class DOMany;
@class DOMb;
@class DOMbool;
@class DOMd;
@@ -104,6 +105,7 @@
@property(retain) DOMTestObjectAConstructor *conditionalAttr4;
@property(retain) DOMTestObjectBConstructor *conditionalAttr5;
@property(retain) DOMTestObjectCConstructor *conditionalAttr6;
+@property(retain) DOMany *anyAttribute;
@property(readonly, retain) DOMDocument *contentDocument;
@property(retain) DOMSVGPoint *mutablePoint;
@property(retain) DOMSVGPoint *immutablePoint;
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2012-09-12 00:35:07 UTC (rev 128248)
@@ -45,6 +45,7 @@
#import "DOMTestObjectBConstructorInternal.h"
#import "DOMTestObjectCConstructorInternal.h"
#import "DOMaInternal.h"
+#import "DOManyInternal.h"
#import "DOMbInternal.h"
#import "DOMboolInternal.h"
#import "DOMdInternal.h"
@@ -69,6 +70,7 @@
#import "WebCoreObjCExtras.h"
#import "WebScriptObjectPrivate.h"
#import "a.h"
+#import "any.h"
#import "b.h"
#import "bool.h"
#import "d.h"
@@ -623,6 +625,20 @@
}
#endif
+- (DOMany *)anyAttribute
+{
+ WebCore::JSMainThreadNullState state;
+ return kit(WTF::getPtr(IMPL->anyAttribute()));
+}
+
+- (void)setAnyAttribute:(DOMany *)newAnyAttribute
+{
+ WebCore::JSMainThreadNullState state;
+ ASSERT(newAnyAttribute);
+
+ IMPL->setAnyAttribute(core(newAnyAttribute));
+}
+
- (DOMDocument *)contentDocument
{
WebCore::JSMainThreadNullState state;
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-09-12 00:35:07 UTC (rev 128248)
@@ -168,6 +168,8 @@
readonly attribute [CachedAttribute] any cachedAttribute1;
readonly attribute [CachedAttribute] any cachedAttribute2;
#endif
+
+ attribute any anyAttribute;
#if defined(TESTING_V8) || defined(TESTING_JS)
// Overloads
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (128247 => 128248)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-09-12 00:25:34 UTC (rev 128247)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-09-12 00:35:07 UTC (rev 128248)
@@ -37,6 +37,7 @@
#include "ScriptCallStack.h"
#include "ScriptCallStackFactory.h"
#include "ScriptProfile.h"
+#include "ScriptValue.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
#include "V8DOMStringList.h"
@@ -49,7 +50,6 @@
#include "V8TestCallback.h"
#include "V8TestSubObj.h"
#include "V8a.h"
-#include "V8any.h"
#include "V8b.h"
#include "V8bool.h"
#include "V8d.h"
@@ -801,30 +801,32 @@
{
INC_STATS("DOM.TestObj.cachedAttribute1._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
- RefPtr<any> result = imp->cachedAttribute1();
- v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap(info.GetIsolate()).get(result.get()) : v8Undefined();
- if (wrapper.IsEmpty()) {
- wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
- if (!wrapper.IsEmpty())
- V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute1", wrapper);
- }
- return wrapper;
+ return imp->cachedAttribute1().v8Value();
}
static v8::Handle<v8::Value> cachedAttribute2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.cachedAttribute2._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
- RefPtr<any> result = imp->cachedAttribute2();
- v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap(info.GetIsolate()).get(result.get()) : v8Undefined();
- if (wrapper.IsEmpty()) {
- wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
- if (!wrapper.IsEmpty())
- V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute2", wrapper);
- }
- return wrapper;
+ return imp->cachedAttribute2().v8Value();
}
+static v8::Handle<v8::Value> anyAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.anyAttribute._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return imp->anyAttribute().v8Value();
+}
+
+static void anyAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.anyAttribute._set");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ ScriptValue v = ScriptValue(value);
+ imp->setAnyAttribute(WTF::getPtr(v));
+ return;
+}
+
static v8::Handle<v8::Value> enabledAtRuntimeAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._get");
@@ -2003,6 +2005,8 @@
{"cachedAttribute1", TestObjV8Internal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'cachedAttribute2' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
{"cachedAttribute2", TestObjV8Internal::cachedAttribute2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'anyAttribute' (Type: 'attribute' ExtAttr: '')
+ {"anyAttribute", TestObjV8Internal::anyAttributeAttrGetter, TestObjV8Internal::anyAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'floatArray' (Type: 'attribute' ExtAttr: '')
{"floatArray", TestObjV8Internal::floatArrayAttrGetter, TestObjV8Internal::floatArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'doubleArray' (Type: 'attribute' ExtAttr: '')