summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8/custom
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/v8/custom')
-rw-r--r--WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp14
-rw-r--r--WebCore/bindings/v8/custom/V8AttrCustom.cpp11
-rw-r--r--WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp14
-rw-r--r--WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp105
-rw-r--r--WebCore/bindings/v8/custom/V8ClipboardCustom.cpp25
-rw-r--r--WebCore/bindings/v8/custom/V8ConsoleCustom.cpp5
-rw-r--r--WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp19
-rw-r--r--WebCore/bindings/v8/custom/V8CustomBinding.cpp182
-rw-r--r--WebCore/bindings/v8/custom/V8CustomBinding.h314
-rw-r--r--WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp15
-rw-r--r--WebCore/bindings/v8/custom/V8DOMParserConstructor.cpp45
-rw-r--r--WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp297
-rw-r--r--WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp12
-rw-r--r--WebCore/bindings/v8/custom/V8DatabaseCustom.cpp11
-rw-r--r--WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp10
-rw-r--r--WebCore/bindings/v8/custom/V8DocumentCustom.cpp46
-rw-r--r--WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp15
-rw-r--r--WebCore/bindings/v8/custom/V8ElementCustom.cpp32
-rw-r--r--WebCore/bindings/v8/custom/V8EventCustom.cpp28
-rw-r--r--WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp (renamed from WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp)64
-rw-r--r--WebCore/bindings/v8/custom/V8EventSourceCustom.cpp74
-rw-r--r--WebCore/bindings/v8/custom/V8GeolocationCustom.cpp10
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp18
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp38
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp19
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp53
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp23
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp16
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp10
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp22
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp29
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp117
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp56
-rw-r--r--WebCore/bindings/v8/custom/V8HistoryCustom.cpp33
-rw-r--r--WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp (renamed from WebCore/bindings/v8/custom/V8XPathEvaluatorConstructor.cpp)18
-rw-r--r--WebCore/bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp (renamed from WebCore/bindings/v8/custom/V8ClientRectListCustom.cpp)32
-rw-r--r--WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp154
-rw-r--r--WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp50
-rw-r--r--WebCore/bindings/v8/custom/V8LocationCustom.cpp125
-rw-r--r--WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp14
-rw-r--r--WebCore/bindings/v8/custom/V8MessageEventCustom.cpp21
-rw-r--r--WebCore/bindings/v8/custom/V8MessagePortCustom.cpp20
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp11
-rw-r--r--WebCore/bindings/v8/custom/V8NavigatorCustom.cpp23
-rw-r--r--WebCore/bindings/v8/custom/V8NodeCustom.cpp40
-rw-r--r--WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp5
-rw-r--r--WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp15
-rw-r--r--WebCore/bindings/v8/custom/V8NodeListCustom.cpp24
-rw-r--r--WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp26
-rw-r--r--WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp (renamed from WebCore/bindings/v8/custom/V8FileListCustom.cpp)41
-rw-r--r--WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp5
-rw-r--r--WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp16
-rw-r--r--WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp10
-rw-r--r--WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp14
-rw-r--r--WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp4
-rwxr-xr-xWebCore/bindings/v8/custom/V8StorageCustom.cpp23
-rw-r--r--WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp45
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLArrayCustom.h20
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp34
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp31
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp34
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp294
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp34
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp34
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp34
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp34
-rw-r--r--WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp4
-rwxr-xr-xWebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8WebSocketCustom.cpp41
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerContextCustom.cpp34
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerCustom.cpp9
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp54
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp17
-rw-r--r--WebCore/bindings/v8/custom/V8XMLSerializerConstructor.cpp45
-rw-r--r--WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp37
83 files changed, 1512 insertions, 1844 deletions
diff --git a/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
index 0240895..6b8f195 100644
--- a/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
@@ -31,9 +31,9 @@
#include "config.h"
#if ENABLE(WORKERS)
+#include "V8AbstractWorker.h"
#include "AbstractWorker.h"
-
#include "ExceptionCode.h"
#include "ScriptExecutionContext.h"
#include "V8Binding.h"
@@ -44,10 +44,10 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(AbstractWorkerAddEventListener)
+v8::Handle<v8::Value> V8AbstractWorker::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.AbstractWorker.addEventListener()");
- AbstractWorker* worker = V8DOMWrapper::convertToNativeObject<AbstractWorker>(V8ClassIndex::ABSTRACTWORKER, args.Holder());
+ AbstractWorker* worker = V8AbstractWorker::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(worker, args[1], false, ListenerFindOrCreate);
if (listener) {
@@ -55,15 +55,15 @@ CALLBACK_FUNC_DECL(AbstractWorkerAddEventListener)
bool useCapture = args[2]->BooleanValue();
worker->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kAbstractWorkerRequestCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(AbstractWorkerRemoveEventListener)
+v8::Handle<v8::Value> V8AbstractWorker::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.AbstractWorker.removeEventListener()");
- AbstractWorker* worker = V8DOMWrapper::convertToNativeObject<AbstractWorker>(V8ClassIndex::ABSTRACTWORKER, args.Holder());
+ AbstractWorker* worker = V8AbstractWorker::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(worker, args[1], false, ListenerFindOnly);
if (listener) {
@@ -71,7 +71,7 @@ CALLBACK_FUNC_DECL(AbstractWorkerRemoveEventListener)
bool useCapture = args[2]->BooleanValue();
worker->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kAbstractWorkerRequestCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
diff --git a/WebCore/bindings/v8/custom/V8AttrCustom.cpp b/WebCore/bindings/v8/custom/V8AttrCustom.cpp
index 81f1586..7bec619 100644
--- a/WebCore/bindings/v8/custom/V8AttrCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8AttrCustom.cpp
@@ -29,24 +29,25 @@
*/
#include "config.h"
-#include "Attr.h"
+#include "V8Attr.h"
+#include "Attr.h"
#include "Element.h"
#include "ExceptionCode.h"
-
#include "V8Binding.h"
+#include "V8BindingState.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
-ACCESSOR_SETTER(AttrValue)
+void V8Attr::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- Attr* imp = V8DOMWrapper::convertDOMWrapperToNode<Attr>(info.Holder());
+ Attr* imp = V8Attr::toNative(info.Holder());
String attrValue = toWebCoreStringWithNullCheck(value);
Element* ownerElement = imp->ownerElement();
- if (ownerElement && !allowSettingSrcToJavascriptURL(ownerElement, imp->name(), attrValue))
+ if (ownerElement && !V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), ownerElement, imp->name(), attrValue))
return;
ExceptionCode ec = 0;
diff --git a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
index 6bd0035..25d141a 100644
--- a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -29,9 +29,10 @@
*/
#include "config.h"
-#include "CSSStyleDeclaration.h"
+#include "V8CSSStyleDeclaration.h"
#include "CSSParser.h"
+#include "CSSStyleDeclaration.h"
#include "CSSValue.h"
#include "CSSPrimitiveValue.h"
#include "EventTarget.h"
@@ -152,7 +153,7 @@ static CSSPropertyInfo* cssPropertyInfo(v8::Handle<v8::String>v8PropertyName)
return propInfo;
}
-NAMED_PROPERTY_GETTER(CSSStyleDeclaration)
+v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.CSSStyleDeclaration.NamedPropertyGetter");
// First look for API defined attributes on the style declaration object.
@@ -160,8 +161,7 @@ NAMED_PROPERTY_GETTER(CSSStyleDeclaration)
return notHandledByInterceptor();
// Search the style declaration.
- CSSStyleDeclaration* imp =
- V8DOMWrapper::convertToNativeObject<CSSStyleDeclaration>(V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
+ CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder());
CSSPropertyInfo* propInfo = cssPropertyInfo(name);
// Do not handle non-property names.
@@ -191,12 +191,10 @@ NAMED_PROPERTY_GETTER(CSSStyleDeclaration)
return v8String(result);
}
-NAMED_PROPERTY_SETTER(CSSStyleDeclaration)
+v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.CSSStyleDeclaration.NamedPropertySetter");
- CSSStyleDeclaration* imp =
- V8DOMWrapper::convertToNativeObject<CSSStyleDeclaration>(
- V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
+ CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder());
CSSPropertyInfo* propInfo = cssPropertyInfo(name);
if (!propInfo)
return notHandledByInterceptor();
diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
index 676610c..b45ef35 100644
--- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
@@ -29,9 +29,10 @@
*/
#include "config.h"
-#include "CanvasRenderingContext2D.h"
+#include "V8CanvasRenderingContext2D.h"
#include "CanvasGradient.h"
+#include "CanvasRenderingContext2D.h"
#include "CanvasPattern.h"
#include "CanvasStyle.h"
#include "ExceptionCode.h"
@@ -44,6 +45,7 @@
#include "V8HTMLCanvasElement.h"
#include "V8HTMLImageElement.h"
#include "V8HTMLVideoElement.h"
+#include "V8ImageData.h"
#include "V8Proxy.h"
namespace WebCore {
@@ -65,44 +67,44 @@ static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value)
return CanvasStyle::create(toWebCoreString(value));
if (V8CanvasGradient::HasInstance(value))
- return CanvasStyle::create(V8DOMWrapper::convertDOMWrapperToNative<CanvasGradient>(v8::Handle<v8::Object>::Cast(value)));
+ return CanvasStyle::create(V8CanvasGradient::toNative(v8::Handle<v8::Object>::Cast(value)));
if (V8CanvasPattern::HasInstance(value))
- return CanvasStyle::create(V8DOMWrapper::convertDOMWrapperToNative<CanvasPattern>(v8::Handle<v8::Object>::Cast(value)));
+ return CanvasStyle::create(V8CanvasPattern::toNative(v8::Handle<v8::Object>::Cast(value)));
return 0;
}
-ACCESSOR_GETTER(CanvasRenderingContext2DStrokeStyle)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeStyleAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- CanvasRenderingContext2D* impl = V8DOMWrapper::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+ CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
return toV8(impl->strokeStyle());
}
-ACCESSOR_SETTER(CanvasRenderingContext2DStrokeStyle)
+void V8CanvasRenderingContext2D::strokeStyleAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- CanvasRenderingContext2D* impl = V8DOMWrapper::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+ CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
impl->setStrokeStyle(toCanvasStyle(value));
}
-ACCESSOR_GETTER(CanvasRenderingContext2DFillStyle)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::fillStyleAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- CanvasRenderingContext2D* impl = V8DOMWrapper::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+ CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
return toV8(impl->fillStyle());
}
-ACCESSOR_SETTER(CanvasRenderingContext2DFillStyle)
+void V8CanvasRenderingContext2D::fillStyleAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- CanvasRenderingContext2D* impl = V8DOMWrapper::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+ CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
impl->setFillStyle(toCanvasStyle(value));
}
// TODO: SetStrokeColor and SetFillColor are similar except function names,
// consolidate them into one.
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::setStrokeColorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.setStrokeColor()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
switch (args.Length()) {
case 1:
if (args[0]->IsString())
@@ -129,10 +131,10 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::setFillColorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.setFillColor()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
switch (args.Length()) {
case 1:
if (args[0]->IsString())
@@ -159,10 +161,10 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeRect)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeRectCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.strokeRect()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
if (args.Length() == 5)
context->strokeRect(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]));
else if (args.Length() == 4)
@@ -174,10 +176,10 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeRect)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::setShadowCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.setShadow()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
switch (args.Length()) {
case 3:
@@ -209,29 +211,29 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::drawImageCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.drawImage()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
v8::Handle<v8::Value> arg = args[0];
if (V8HTMLImageElement::HasInstance(arg)) {
ExceptionCode ec = 0;
- HTMLImageElement* image_element = V8DOMWrapper::convertDOMWrapperToNode<HTMLImageElement>(v8::Handle<v8::Object>::Cast(arg));
+ HTMLImageElement* imageElement = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg));
switch (args.Length()) {
case 3:
- context->drawImage(image_element, toFloat(args[1]), toFloat(args[2]));
+ context->drawImage(imageElement, toFloat(args[1]), toFloat(args[2]));
break;
case 5:
- context->drawImage(image_element, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
+ context->drawImage(imageElement, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
if (ec != 0) {
V8Proxy::setDOMException(ec);
return notHandledByInterceptor();
}
break;
case 9:
- context->drawImage(image_element,
+ context->drawImage(imageElement,
FloatRect(toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4])),
FloatRect(toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8])),
ec);
@@ -249,20 +251,20 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
// HTMLCanvasElement
if (V8HTMLCanvasElement::HasInstance(arg)) {
ExceptionCode ec = 0;
- HTMLCanvasElement* canvas_element = V8DOMWrapper::convertDOMWrapperToNode<HTMLCanvasElement>(v8::Handle<v8::Object>::Cast(arg));
+ HTMLCanvasElement* canvasElement = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg));
switch (args.Length()) {
case 3:
- context->drawImage(canvas_element, toFloat(args[1]), toFloat(args[2]));
+ context->drawImage(canvasElement, toFloat(args[1]), toFloat(args[2]));
break;
case 5:
- context->drawImage(canvas_element, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
+ context->drawImage(canvasElement, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
if (ec != 0) {
V8Proxy::setDOMException(ec);
return notHandledByInterceptor();
}
break;
case 9:
- context->drawImage(canvas_element,
+ context->drawImage(canvasElement,
FloatRect(toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4])),
FloatRect(toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8])),
ec);
@@ -281,20 +283,20 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
// HTMLVideoElement
if (V8HTMLVideoElement::HasInstance(arg)) {
ExceptionCode ec = 0;
- HTMLVideoElement* video_element = V8DOMWrapper::convertDOMWrapperToNode<HTMLVideoElement>(v8::Handle<v8::Object>::Cast(arg));
+ HTMLVideoElement* videoElement = V8HTMLVideoElement::toNative(v8::Handle<v8::Object>::Cast(arg));
switch (args.Length()) {
case 3:
- context->drawImage(video_element, toFloat(args[1]), toFloat(args[2]));
+ context->drawImage(videoElement, toFloat(args[1]), toFloat(args[2]));
break;
case 5:
- context->drawImage(video_element, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
+ context->drawImage(videoElement, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
if (ec != 0) {
V8Proxy::setDOMException(ec);
return notHandledByInterceptor();
}
break;
case 9:
- context->drawImage(video_element,
+ context->drawImage(videoElement,
FloatRect(toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4])),
FloatRect(toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8])),
ec);
@@ -314,33 +316,34 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
return notHandledByInterceptor();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImageFromRect)
+
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::drawImageFromRectCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.drawImageFromRect()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
v8::Handle<v8::Value> arg = args[0];
if (V8HTMLImageElement::HasInstance(arg)) {
- HTMLImageElement* image_element = V8DOMWrapper::convertDOMWrapperToNode<HTMLImageElement>(v8::Handle<v8::Object>::Cast(arg));
- context->drawImageFromRect(image_element, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8]), toWebCoreString(args[9]));
+ HTMLImageElement* imageElement = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg));
+ context->drawImageFromRect(imageElement, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8]), toWebCoreString(args[9]));
} else
V8Proxy::throwError(V8Proxy::TypeError, "drawImageFromRect: Invalid type of arguments");
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::createPatternCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.createPattern()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
v8::Handle<v8::Value> arg = args[0];
if (V8HTMLImageElement::HasInstance(arg)) {
- HTMLImageElement* image_element = V8DOMWrapper::convertDOMWrapperToNode<HTMLImageElement>(v8::Handle<v8::Object>::Cast(arg));
+ HTMLImageElement* imageElement = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg));
ExceptionCode ec = 0;
- RefPtr<CanvasPattern> pattern = context->createPattern(image_element, toWebCoreStringWithNullCheck(args[1]), ec);
+ RefPtr<CanvasPattern> pattern = context->createPattern(imageElement, toWebCoreStringWithNullCheck(args[1]), ec);
if (ec != 0) {
V8Proxy::setDOMException(ec);
return notHandledByInterceptor();
@@ -349,9 +352,9 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern)
}
if (V8HTMLCanvasElement::HasInstance(arg)) {
- HTMLCanvasElement* canvas_element = V8DOMWrapper::convertDOMWrapperToNode<HTMLCanvasElement>(v8::Handle<v8::Object>::Cast(arg));
+ HTMLCanvasElement* canvasElement = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg));
ExceptionCode ec = 0;
- RefPtr<CanvasPattern> pattern = context->createPattern(canvas_element, toWebCoreStringWithNullCheck(args[1]), ec);
+ RefPtr<CanvasPattern> pattern = context->createPattern(canvasElement, toWebCoreStringWithNullCheck(args[1]), ec);
if (ec != 0) {
V8Proxy::setDOMException(ec);
return notHandledByInterceptor();
@@ -363,11 +366,11 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern)
return notHandledByInterceptor();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DFillText)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::fillTextCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.fillText()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
// Two forms:
// * fillText(text, x, y)
@@ -390,10 +393,10 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DFillText)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeText)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeTextCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.strokeText()");
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
// Two forms:
// * strokeText(text, x, y)
@@ -416,7 +419,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeText)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData)
+v8::Handle<v8::Value> V8CanvasRenderingContext2D::putImageDataCallback(const v8::Arguments& args)
{
INC_STATS("DOM.CanvasRenderingContext2D.putImageData()");
@@ -428,16 +431,16 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData)
return notHandledByInterceptor();
}
- CanvasRenderingContext2D* context = V8DOMWrapper::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+ CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder());
ImageData* imageData = 0;
// Need to check that the argument is of the correct type, since
- // convertToNativeObject() expects it to be correct. If the argument was incorrect
+ // toNative() expects it to be correct. If the argument was incorrect
// we leave it null, and putImageData() will throw the correct exception
// (TYPE_MISMATCH_ERR).
if (V8DOMWrapper::isWrapperOfType(args[0], V8ClassIndex::IMAGEDATA))
- imageData = V8DOMWrapper::convertToNativeObject<ImageData>(V8ClassIndex::IMAGEDATA, v8::Handle<v8::Object>::Cast(args[0]));
+ imageData = V8ImageData::toNative(v8::Handle<v8::Object>::Cast(args[0]));
ExceptionCode ec = 0;
diff --git a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
index 4526304..5f0b4e3 100644
--- a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
@@ -29,8 +29,9 @@
*/
#include "config.h"
-#include "Clipboard.h"
+#include "V8Clipboard.h"
+#include "Clipboard.h"
#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "IntPoint.h"
@@ -44,10 +45,10 @@
namespace WebCore {
-ACCESSOR_GETTER(ClipboardTypes)
+v8::Handle<v8::Value> V8Clipboard::typesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Clipboard.types()");
- Clipboard* clipboard = V8DOMWrapper::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, info.Holder());
+ Clipboard* clipboard = V8Clipboard::toNative(info.Holder());
HashSet<String> types = clipboard->types();
if (types.isEmpty())
@@ -62,10 +63,10 @@ ACCESSOR_GETTER(ClipboardTypes)
return result;
}
-CALLBACK_FUNC_DECL(ClipboardClearData)
+v8::Handle<v8::Value> V8Clipboard::clearDataCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Clipboard.clearData()");
- Clipboard* clipboard = V8DOMWrapper::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+ Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
if (!args.Length()) {
clipboard->clearAllData();
@@ -80,10 +81,10 @@ CALLBACK_FUNC_DECL(ClipboardClearData)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(ClipboardGetData)
+v8::Handle<v8::Value> V8Clipboard::getDataCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Clipboard.getData()");
- Clipboard* clipboard = V8DOMWrapper::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+ Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
if (args.Length() != 1)
return throwError("getData: Invalid number of arguments", V8Proxy::SyntaxError);
@@ -96,10 +97,10 @@ CALLBACK_FUNC_DECL(ClipboardGetData)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(ClipboardSetData)
+v8::Handle<v8::Value> V8Clipboard::setDataCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Clipboard.setData()");
- Clipboard* clipboard = V8DOMWrapper::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+ Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
if (args.Length() != 2)
return throwError("setData: Invalid number of arguments", V8Proxy::SyntaxError);
@@ -109,10 +110,10 @@ CALLBACK_FUNC_DECL(ClipboardSetData)
return v8Boolean(clipboard->setData(type, data));
}
-CALLBACK_FUNC_DECL(ClipboardSetDragImage)
+v8::Handle<v8::Value> V8Clipboard::setDragImageCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Clipboard.setDragImage()");
- Clipboard* clipboard = V8DOMWrapper::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+ Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
if (!clipboard->isForDragging())
return v8::Undefined();
@@ -125,7 +126,7 @@ CALLBACK_FUNC_DECL(ClipboardSetDragImage)
Node* node = 0;
if (V8Node::HasInstance(args[0]))
- node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0]));
+ node = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
if (!node || !node->isElementNode())
return throwError("setDragImageFromElement: Invalid first argument");
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
index b44e074..0dbdcd7 100644
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
@@ -29,6 +29,7 @@
*/
#include "config.h"
+#include "V8Console.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
@@ -37,7 +38,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(ConsoleProfile)
+v8::Handle<v8::Value> V8Console::profileCallback(const v8::Arguments& args)
{
INC_STATS("console.profile()");
v8::HandleScope scope;
@@ -46,7 +47,7 @@ CALLBACK_FUNC_DECL(ConsoleProfile)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(ConsoleProfileEnd)
+v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args)
{
INC_STATS("console.profileEnd()");
v8::V8::PauseProfiler();
diff --git a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp b/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
index 1c07f29..a5197f5 100644
--- a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
@@ -24,49 +24,50 @@
*/
#include "config.h"
-#include "Coordinates.h"
+#include "V8Coordinates.h"
+#include "Coordinates.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
-ACCESSOR_GETTER(CoordinatesAltitude)
+v8::Handle<v8::Value> V8Coordinates::altitudeAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Coordinates.altitude._get");
v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8DOMWrapper::convertToNativeObject<Coordinates>(V8ClassIndex::COORDINATES, holder);
+ Coordinates* imp = V8Coordinates::toNative(holder);
if (!imp->canProvideAltitude())
return v8::Null();
return v8::Number::New(imp->altitude());
}
-ACCESSOR_GETTER(CoordinatesAltitudeAccuracy)
+v8::Handle<v8::Value> V8Coordinates::altitudeAccuracyAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Coordinates.altitudeAccuracy._get");
v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8DOMWrapper::convertToNativeObject<Coordinates>(V8ClassIndex::COORDINATES, holder);
+ Coordinates* imp = V8Coordinates::toNative(holder);
if (!imp->canProvideAltitudeAccuracy())
return v8::Null();
return v8::Number::New(imp->altitudeAccuracy());
}
-ACCESSOR_GETTER(CoordinatesHeading)
+v8::Handle<v8::Value> V8Coordinates::headingAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Coordinates.heading._get");
v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8DOMWrapper::convertToNativeObject<Coordinates>(V8ClassIndex::COORDINATES, holder);
+ Coordinates* imp = V8Coordinates::toNative(holder);
if (!imp->canProvideHeading())
return v8::Null();
return v8::Number::New(imp->heading());
}
-ACCESSOR_GETTER(CoordinatesSpeed)
+v8::Handle<v8::Value> V8Coordinates::speedAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Coordinates.speed._get");
v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8DOMWrapper::convertToNativeObject<Coordinates>(V8ClassIndex::COORDINATES, holder);
+ Coordinates* imp = V8Coordinates::toNative(holder);
if (!imp->canProvideSpeed())
return v8::Null();
return v8::Number::New(imp->speed());
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.cpp b/WebCore/bindings/v8/custom/V8CustomBinding.cpp
deleted file mode 100644
index 510aded..0000000
--- a/WebCore/bindings/v8/custom/V8CustomBinding.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8CustomBinding.h"
-
-#include "CSSHelper.h"
-#include "Element.h"
-#include "Document.h"
-#include "DOMWindow.h"
-#include "History.h"
-#include "HTMLNames.h"
-#include "HTMLFrameElementBase.h"
-#include "Location.h"
-#include "V8Proxy.h"
-
-#if ENABLE(SVG)
-#include "SVGPathSeg.h"
-#endif
-
-namespace WebCore {
-
-bool allowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase* frame, String value)
-{
- if (protocolIs(deprecatedParseURL(value), "javascript")) {
- Node* contentDoc = frame->contentDocument();
- if (contentDoc && !V8Proxy::checkNodeSecurity(contentDoc))
- return false;
- }
- return true;
-}
-
-bool allowSettingSrcToJavascriptURL(Element* element, String name, String value)
-{
- if ((element->hasTagName(HTMLNames::iframeTag) || element->hasTagName(HTMLNames::frameTag)) && equalIgnoringCase(name, "src"))
- return allowSettingFrameSrcToJavascriptUrl(static_cast<HTMLFrameElementBase*>(element), value);
- return true;
-}
-
-// DOMImplementation is a singleton in WebCore. If we use our normal
-// mapping from DOM objects to V8 wrappers, the same wrapper will be
-// shared for all frames in the same process. This is a major
-// security problem. Therefore, we generate a DOMImplementation
-// wrapper per document and store it in an internal field of the
-// document. Since the DOMImplementation object is a singleton, we do
-// not have to do anything to keep the DOMImplementation object alive
-// for the lifetime of the wrapper.
-ACCESSOR_GETTER(DocumentImplementation)
-{
- ASSERT(info.Holder()->InternalFieldCount() >= kDocumentMinimumInternalFieldCount);
-
- // Check if the internal field already contains a wrapper.
- v8::Local<v8::Value> implementation = info.Holder()->GetInternalField(kDocumentImplementationIndex);
- if (!implementation->IsUndefined())
- return implementation;
-
- // Generate a wrapper.
- Document* document = V8DOMWrapper::convertDOMWrapperToNative<Document>(info.Holder());
- v8::Handle<v8::Value> wrapper = V8DOMWrapper::convertDOMImplementationToV8Object(document->implementation());
-
- // Store the wrapper in the internal field.
- info.Holder()->SetInternalField(kDocumentImplementationIndex, wrapper);
-
- return wrapper;
-}
-
-// --------------- Security Checks -------------------------
-INDEXED_ACCESS_CHECK(History)
-{
- ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
- // Only allow same origin access.
- History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, host);
- return V8Proxy::canAccessFrame(history->frame(), false);
-}
-
-NAMED_ACCESS_CHECK(History)
-{
- ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
- // Only allow same origin access.
- History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, host);
- return V8Proxy::canAccessFrame(history->frame(), false);
-}
-
-#undef INDEXED_ACCESS_CHECK
-#undef NAMED_ACCESS_CHECK
-#undef NAMED_PROPERTY_GETTER
-#undef NAMED_PROPERTY_SETTER
-
-Frame* V8Custom::GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data)
-{
- Frame* target = 0;
- switch (V8ClassIndex::FromInt(data->Int32Value())) {
- case V8ClassIndex::DOMWINDOW: {
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
- if (window.IsEmpty())
- return target;
-
- DOMWindow* targetWindow = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
- target = targetWindow->frame();
- break;
- }
- case V8ClassIndex::LOCATION: {
- History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, host);
- target = history->frame();
- break;
- }
- case V8ClassIndex::HISTORY: {
- Location* location = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, host);
- target = location->frame();
- break;
- }
- default:
- break;
- }
- return target;
-}
-
-#if ENABLE(SVG)
-V8ClassIndex::V8WrapperType V8Custom::DowncastSVGPathSeg(void* pathSeg)
-{
- WebCore::SVGPathSeg* realPathSeg = reinterpret_cast<WebCore::SVGPathSeg*>(pathSeg);
-
- switch (realPathSeg->pathSegType()) {
-#define MAKE_CASE(svgValue, v8Value) case WebCore::SVGPathSeg::svgValue: return V8ClassIndex::v8Value
-
- MAKE_CASE(PATHSEG_CLOSEPATH, SVGPATHSEGCLOSEPATH);
- MAKE_CASE(PATHSEG_MOVETO_ABS, SVGPATHSEGMOVETOABS);
- MAKE_CASE(PATHSEG_MOVETO_REL, SVGPATHSEGMOVETOREL);
- MAKE_CASE(PATHSEG_LINETO_ABS, SVGPATHSEGLINETOABS);
- MAKE_CASE(PATHSEG_LINETO_REL, SVGPATHSEGLINETOREL);
- MAKE_CASE(PATHSEG_CURVETO_CUBIC_ABS, SVGPATHSEGCURVETOCUBICABS);
- MAKE_CASE(PATHSEG_CURVETO_CUBIC_REL, SVGPATHSEGCURVETOCUBICREL);
- MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_ABS, SVGPATHSEGCURVETOQUADRATICABS);
- MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_REL, SVGPATHSEGCURVETOQUADRATICREL);
- MAKE_CASE(PATHSEG_ARC_ABS, SVGPATHSEGARCABS);
- MAKE_CASE(PATHSEG_ARC_REL, SVGPATHSEGARCREL);
- MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_ABS, SVGPATHSEGLINETOHORIZONTALABS);
- MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_REL, SVGPATHSEGLINETOHORIZONTALREL);
- MAKE_CASE(PATHSEG_LINETO_VERTICAL_ABS, SVGPATHSEGLINETOVERTICALABS);
- MAKE_CASE(PATHSEG_LINETO_VERTICAL_REL, SVGPATHSEGLINETOVERTICALREL);
- MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, SVGPATHSEGCURVETOCUBICSMOOTHABS);
- MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_REL, SVGPATHSEGCURVETOCUBICSMOOTHREL);
- MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, SVGPATHSEGCURVETOQUADRATICSMOOTHABS);
- MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, SVGPATHSEGCURVETOQUADRATICSMOOTHREL);
-
-#undef MAKE_CASE
-
- default:
- return V8ClassIndex::INVALID_CLASS_INDEX;
- }
-}
-
-#endif // ENABLE(SVG)
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index e7670b7..25f4507 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -34,308 +34,16 @@
#include "V8Index.h"
#include <v8.h>
-struct NPObject;
-
-#define CALLBACK_FUNC_DECL(NAME) v8::Handle<v8::Value> V8Custom::v8##NAME##Callback(const v8::Arguments& args)
-
-#define ACCESSOR_GETTER(NAME) \
- v8::Handle<v8::Value> V8Custom::v8##NAME##AccessorGetter( \
- v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define ACCESSOR_SETTER(NAME) \
- void V8Custom::v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
- v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-
-#define INDEXED_PROPERTY_GETTER(NAME) \
- v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertyGetter( \
- uint32_t index, const v8::AccessorInfo& info)
-
-#define INDEXED_PROPERTY_SETTER(NAME) \
- v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertySetter( \
- uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-
-#define INDEXED_PROPERTY_DELETER(NAME) \
- v8::Handle<v8::Boolean> V8Custom::v8##NAME##IndexedPropertyDeleter( \
- uint32_t index, const v8::AccessorInfo& info)
-
-#define NAMED_PROPERTY_GETTER(NAME) \
- v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertyGetter( \
- v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define NAMED_PROPERTY_SETTER(NAME) \
- v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertySetter( \
- v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-
-#define NAMED_PROPERTY_DELETER(NAME) \
- v8::Handle<v8::Boolean> V8Custom::v8##NAME##NamedPropertyDeleter( \
- v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define NAMED_ACCESS_CHECK(NAME) \
- bool V8Custom::v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
- v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
-
-#define INDEXED_ACCESS_CHECK(NAME) \
- bool V8Custom::v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
- uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
-
-#define ACCESSOR_RUNTIME_ENABLER(NAME) bool V8Custom::v8##NAME##Enabled()
-
namespace WebCore {
-
- class DOMWindow;
- class Element;
- class Frame;
- class HTMLCollection;
- class HTMLFrameElementBase;
- class String;
- class V8Proxy;
-
- bool allowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase*, String value);
- bool allowSettingSrcToJavascriptURL(Element*, String name, String value);
-
class V8Custom {
public:
- // Constants.
- static const int kDOMWrapperTypeIndex = 0;
- static const int kDOMWrapperObjectIndex = 1;
- static const int kDefaultWrapperInternalFieldCount = 2;
-
- static const int kNPObjectInternalFieldCount = kDefaultWrapperInternalFieldCount + 0;
-
- static const int kNodeEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kNodeMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-
- static const int kDocumentImplementationIndex = kNodeMinimumInternalFieldCount + 0;
- static const int kDocumentMinimumInternalFieldCount = kNodeMinimumInternalFieldCount + 1;
-
- static const int kHTMLDocumentMarkerIndex = kDocumentMinimumInternalFieldCount + 0;
- static const int kHTMLDocumentShadowIndex = kDocumentMinimumInternalFieldCount + 1;
- static const int kHTMLDocumentInternalFieldCount = kDocumentMinimumInternalFieldCount + 2;
-
- static const int kXMLHttpRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kXMLHttpRequestInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-
- static const int kMessageChannelPort1Index = kDefaultWrapperInternalFieldCount + 0;
- static const int kMessageChannelPort2Index = kDefaultWrapperInternalFieldCount + 1;
- static const int kMessageChannelInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
-
- static const int kMessagePortRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kMessagePortInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-
-#if ENABLE(WORKERS)
- static const int kAbstractWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kAbstractWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-
- static const int kWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
- static const int kWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
-
- static const int kWorkerContextRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kWorkerContextMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-
- static const int kDedicatedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
- static const int kDedicatedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
-#endif
-
-#if ENABLE(SHARED_WORKERS)
- static const int kSharedWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
- static const int kSharedWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
-
- static const int kSharedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
- static const int kSharedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
-#endif
-
-#if ENABLE(NOTIFICATIONS)
- static const int kNotificationRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kNotificationInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-#endif
-
-#if ENABLE(SVG)
- static const int kSVGElementInstanceEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kSVGElementInstanceInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-#endif
-
- static const int kDOMWindowConsoleIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kDOMWindowHistoryIndex = kDefaultWrapperInternalFieldCount + 1;
- static const int kDOMWindowLocationbarIndex = kDefaultWrapperInternalFieldCount + 2;
- static const int kDOMWindowMenubarIndex = kDefaultWrapperInternalFieldCount + 3;
- static const int kDOMWindowNavigatorIndex = kDefaultWrapperInternalFieldCount + 4;
- static const int kDOMWindowPersonalbarIndex = kDefaultWrapperInternalFieldCount + 5;
- static const int kDOMWindowScreenIndex = kDefaultWrapperInternalFieldCount + 6;
- static const int kDOMWindowScrollbarsIndex = kDefaultWrapperInternalFieldCount + 7;
- static const int kDOMWindowSelectionIndex = kDefaultWrapperInternalFieldCount + 8;
- static const int kDOMWindowStatusbarIndex = kDefaultWrapperInternalFieldCount + 9;
- static const int kDOMWindowToolbarIndex = kDefaultWrapperInternalFieldCount + 10;
- static const int kDOMWindowLocationIndex = kDefaultWrapperInternalFieldCount + 11;
- static const int kDOMWindowDOMSelectionIndex = kDefaultWrapperInternalFieldCount + 12;
- static const int kDOMWindowEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 13;
- static const int kDOMWindowEnteredIsolatedWorldIndex = kDefaultWrapperInternalFieldCount + 14;
- static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 15;
-
- static const int kStyleSheetOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kStyleSheetInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
- static const int kNamedNodeMapOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kNamedNodeMapInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- static const int kDOMApplicationCacheCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kDOMApplicationCacheFieldCount = kDefaultWrapperInternalFieldCount + 1;
-#endif
-
-#if ENABLE(WEB_SOCKETS)
- static const int kWebSocketCacheIndex = kDefaultWrapperInternalFieldCount + 0;
- static const int kWebSocketInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
-#endif
-
-#define DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \
- static v8::Handle<v8::Value> v8##NAME##AccessorGetter( \
- v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define DECLARE_PROPERTY_ACCESSOR_SETTER(NAME) \
- static void v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
- v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-
-#define DECLARE_PROPERTY_ACCESSOR(NAME) DECLARE_PROPERTY_ACCESSOR_GETTER(NAME); DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)
-
-#define DECLARE_NAMED_PROPERTY_GETTER(NAME) \
- static v8::Handle<v8::Value> v8##NAME##NamedPropertyGetter( \
- v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define DECLARE_NAMED_PROPERTY_SETTER(NAME) \
- static v8::Handle<v8::Value> v8##NAME##NamedPropertySetter( \
- v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-
-#define DECLARE_NAMED_PROPERTY_DELETER(NAME) \
- static v8::Handle<v8::Boolean> v8##NAME##NamedPropertyDeleter( \
- v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define USE_NAMED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##NamedPropertyGetter
-
-#define USE_NAMED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##NamedPropertySetter
-
-#define USE_NAMED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##NamedPropertyDeleter
-
-#define DECLARE_INDEXED_PROPERTY_GETTER(NAME) \
- static v8::Handle<v8::Value> v8##NAME##IndexedPropertyGetter( \
- uint32_t index, const v8::AccessorInfo& info)
-
-#define DECLARE_INDEXED_PROPERTY_SETTER(NAME) \
- static v8::Handle<v8::Value> v8##NAME##IndexedPropertySetter( \
- uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-
-#define DECLARE_INDEXED_PROPERTY_DELETER(NAME) \
- static v8::Handle<v8::Boolean> v8##NAME##IndexedPropertyDeleter( \
- uint32_t index, const v8::AccessorInfo& info)
-
-#define USE_INDEXED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##IndexedPropertyGetter
-
-#define USE_INDEXED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##IndexedPropertySetter
-
-#define USE_INDEXED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##IndexedPropertyDeleter
-
#define DECLARE_CALLBACK(NAME) static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args)
-
#define USE_CALLBACK(NAME) V8Custom::v8##NAME##Callback
-#define DECLARE_NAMED_ACCESS_CHECK(NAME) \
- static bool v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
- v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
-
-#define DECLARE_INDEXED_ACCESS_CHECK(NAME) \
- static bool v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
- uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
-
-#define DECLARE_ACCESSOR_RUNTIME_ENABLER(NAME) static bool v8##NAME##Enabled()
-
- DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle);
- DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle);
- DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent);
- DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto);
- DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation);
- DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener);
-
-#if ENABLE(VIDEO)
- DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowAudio);
- DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowAudio);
- DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLMediaElement);
- DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLAudioElement);
- DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLVideoElement);
- DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowMediaError);
-#endif
-
- DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowImage);
- DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowOption);
-
- DECLARE_PROPERTY_ACCESSOR(DocumentLocation);
- DECLARE_PROPERTY_ACCESSOR(DocumentImplementation);
- DECLARE_PROPERTY_ACCESSOR_GETTER(EventSrcElement);
- DECLARE_PROPERTY_ACCESSOR(EventReturnValue);
- DECLARE_PROPERTY_ACCESSOR_GETTER(EventDataTransfer);
- DECLARE_PROPERTY_ACCESSOR_GETTER(EventClipboardData);
-
- DECLARE_PROPERTY_ACCESSOR(DOMWindowEventHandler);
-
- DECLARE_CALLBACK(HTMLCanvasElementGetContext);
-
- DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementSrc);
- DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementLocation);
- DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLIFrameElementSrc);
-
- DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue);
-
- DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength);
-
- DECLARE_CALLBACK(HTMLInputElementSetSelectionRange);
-
- DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionStart);
- DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionEnd);
-
- DECLARE_NAMED_ACCESS_CHECK(Location);
- DECLARE_INDEXED_ACCESS_CHECK(History);
-
- DECLARE_NAMED_ACCESS_CHECK(History);
- DECLARE_INDEXED_ACCESS_CHECK(Location);
-
- DECLARE_CALLBACK(HTMLCollectionItem);
- DECLARE_CALLBACK(HTMLCollectionNamedItem);
- DECLARE_CALLBACK(HTMLCollectionCallAsFunction);
-
- DECLARE_CALLBACK(HTMLAllCollectionItem);
- DECLARE_CALLBACK(HTMLAllCollectionNamedItem);
- DECLARE_CALLBACK(HTMLAllCollectionCallAsFunction);
-
- DECLARE_CALLBACK(HTMLSelectElementRemove);
-
- DECLARE_CALLBACK(HTMLOptionsCollectionRemove);
- DECLARE_CALLBACK(HTMLOptionsCollectionAdd);
-
- DECLARE_CALLBACK(HTMLDocumentWrite);
- DECLARE_CALLBACK(HTMLDocumentWriteln);
- DECLARE_CALLBACK(HTMLDocumentOpen);
- DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll);
- DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument);
- DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument);
-
- DECLARE_CALLBACK(DocumentEvaluate);
- DECLARE_CALLBACK(DocumentGetCSSCanvasContext);
-
- DECLARE_CALLBACK(DOMWindowAddEventListener);
- DECLARE_CALLBACK(DOMWindowRemoveEventListener);
- DECLARE_CALLBACK(DOMWindowPostMessage);
- DECLARE_CALLBACK(DOMWindowSetTimeout);
- DECLARE_CALLBACK(DOMWindowSetInterval);
- DECLARE_CALLBACK(DOMWindowAtob);
- DECLARE_CALLBACK(DOMWindowBtoa);
- DECLARE_CALLBACK(DOMWindowNOP);
- DECLARE_CALLBACK(DOMWindowToString);
- DECLARE_CALLBACK(DOMWindowShowModalDialog);
- DECLARE_CALLBACK(DOMWindowOpen);
- DECLARE_CALLBACK(DOMWindowClearTimeout);
- DECLARE_CALLBACK(DOMWindowClearInterval);
-
- DECLARE_CALLBACK(DOMParserConstructor);
DECLARE_CALLBACK(HTMLAudioElementConstructor);
DECLARE_CALLBACK(HTMLImageElementConstructor);
DECLARE_CALLBACK(HTMLOptionElementConstructor);
+<<<<<<< HEAD
DECLARE_CALLBACK(MessageChannelConstructor);
DECLARE_CALLBACK(WebKitCSSMatrixConstructor);
DECLARE_CALLBACK(WebKitPointConstructor);
@@ -714,27 +422,11 @@ namespace WebCore {
#undef DECLARE_INDEXED_PROPERTY_GETTER
#undef DECLARE_INDEXED_PROPERTY_SETTER
#undef DECLARE_INDEXED_PROPERTY_DELETER
+=======
+>>>>>>> webkit.org at r54127
#undef DECLARE_CALLBACK
-
- // Returns the NPObject corresponding to an HTMLElement object.
- static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object>);
-
- // Returns the owner frame pointer of a DOM wrapper object. It only works for
- // these DOM objects requiring cross-domain access check.
- static Frame* GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data);
-
- // Special case for downcasting SVG path segments.
-#if ENABLE(SVG)
- static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* pathSeg);
-#endif
-
- private:
- static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments&, bool singleShot);
- static void ClearTimeoutImpl(const v8::Arguments&);
- static void WindowSetLocation(DOMWindow*, const String&);
};
-
} // namespace WebCore
#endif // V8CustomBinding_h
diff --git a/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp b/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
index 134de95..a439432 100644
--- a/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
@@ -29,11 +29,12 @@
*/
#include "config.h"
-#include "DOMApplicationCache.h"
+#include "V8DOMApplicationCache.h"
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
#include "ApplicationCacheHost.h"
+#include "DOMApplicationCache.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8Document.h"
@@ -44,14 +45,14 @@
namespace WebCore {
// Handles appcache.addEventListner(name, func, capture) method calls
-CALLBACK_FUNC_DECL(DOMApplicationCacheAddEventListener)
+v8::Handle<v8::Value> V8DOMApplicationCache::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOMApplicationCache.addEventListener()");
- DOMApplicationCache* appcache = V8DOMWrapper::convertToNativeObject<DOMApplicationCache>(V8ClassIndex::DOMAPPLICATIONCACHE, args.Holder());
+ DOMApplicationCache* appcache = V8DOMApplicationCache::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(appcache, args[1], false, ListenerFindOrCreate);
if (listener) {
- createHiddenDependency(args.Holder(), args[1], V8Custom::kDOMApplicationCacheCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
String eventType = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
appcache->addEventListener(eventType, listener, useCapture);
@@ -60,14 +61,14 @@ CALLBACK_FUNC_DECL(DOMApplicationCacheAddEventListener)
}
// Handles appcache.removeEventListner(name, func, capture) method calls
-CALLBACK_FUNC_DECL(DOMApplicationCacheRemoveEventListener)
+v8::Handle<v8::Value> V8DOMApplicationCache::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOMApplicationCache.removeEventListener()");
- DOMApplicationCache* appcache = V8DOMWrapper::convertToNativeObject<DOMApplicationCache>(V8ClassIndex::DOMAPPLICATIONCACHE, args.Holder());
+ DOMApplicationCache* appcache = V8DOMApplicationCache::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(appcache, args[1], false, ListenerFindOnly);
if (listener) {
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kDOMApplicationCacheCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
String eventType = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
appcache->removeEventListener(eventType, listener.get(), useCapture);
diff --git a/WebCore/bindings/v8/custom/V8DOMParserConstructor.cpp b/WebCore/bindings/v8/custom/V8DOMParserConstructor.cpp
deleted file mode 100644
index 4af5c6e..0000000
--- a/WebCore/bindings/v8/custom/V8DOMParserConstructor.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DOMParser.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-CALLBACK_FUNC_DECL(DOMParserConstructor)
-{
- INC_STATS("DOM.DOMParser.Contructor");
- return V8Proxy::constructDOMObject<V8ClassIndex::DOMPARSER, DOMParser>(args);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index 46c33b9..2933b4d 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -29,22 +29,19 @@
*/
#include "config.h"
-#include "DOMWindow.h"
-
-#include "V8Binding.h"
-#include "V8CustomBinding.h"
-#include "V8CustomEventListener.h"
-#include "V8MessagePortCustom.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
+#include "V8DOMWindow.h"
#include "Base64.h"
-#include "ExceptionCode.h"
+#include "Chrome.h"
+#include "Database.h"
#include "DOMTimer.h"
+#include "DOMWindow.h"
+#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameLoadRequest.h"
#include "FrameView.h"
#include "HTMLCollection.h"
+#include "HTMLDocument.h"
#include "MediaPlayer.h"
#include "Page.h"
#include "PlatformScreen.h"
@@ -55,6 +52,14 @@
#include "Settings.h"
#include "SharedWorkerRepository.h"
#include "Storage.h"
+#include "V8Binding.h"
+#include "V8BindingDOMWindow.h"
+#include "V8BindingState.h"
+#include "V8CustomBinding.h"
+#include "V8CustomEventListener.h"
+#include "V8MessagePortCustom.h"
+#include "V8Proxy.h"
+#include "V8Utilities.h"
#if ENABLE(WEB_SOCKETS)
#include "WebSocket.h"
#endif
@@ -66,7 +71,7 @@ static const int popupTilePixels = 10;
namespace WebCore {
-v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args, bool singleShot)
+v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singleShot)
{
int argumentCount = args.Length();
@@ -99,9 +104,9 @@ v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args,
if (argumentCount >= 2)
timeout = args[1]->Int32Value();
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return v8::Undefined();
ScriptExecutionContext* scriptContext = static_cast<ScriptExecutionContext*>(imp->document());
@@ -164,14 +169,14 @@ static v8::Handle<v8::Value> convertBase64(const String& str, bool encode)
return v8String(String(outputCharacters.data(), outputCharacters.size()));
}
-ACCESSOR_GETTER(DOMWindowEvent)
+v8::Handle<v8::Value> V8DOMWindow::eventAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
if (holder.IsEmpty())
return v8::Undefined();
- Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame();
- if (!V8Proxy::canAccessFrame(frame, true))
+ Frame* frame = V8DOMWindow::toNative(holder)->frame();
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true))
return v8::Undefined();
v8::Local<v8::Context> context = V8Proxy::context(frame);
@@ -185,14 +190,14 @@ ACCESSOR_GETTER(DOMWindowEvent)
return jsEvent;
}
-ACCESSOR_SETTER(DOMWindowEvent)
+void V8DOMWindow::eventAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
if (holder.IsEmpty())
return;
- Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame();
- if (!V8Proxy::canAccessFrame(frame, true))
+ Frame* frame = V8DOMWindow::toNative(holder)->frame();
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true))
return;
v8::Local<v8::Context> context = V8Proxy::context(frame);
@@ -203,24 +208,24 @@ ACCESSOR_SETTER(DOMWindowEvent)
context->Global()->SetHiddenValue(eventSymbol, value);
}
-ACCESSOR_GETTER(DOMWindowCrypto)
+v8::Handle<v8::Value> V8DOMWindow::cryptoAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
// FIXME: Implement me.
return v8::Undefined();
}
-ACCESSOR_SETTER(DOMWindowLocation)
+void V8DOMWindow::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
- WindowSetLocation(imp, toWebCoreString(value));
+ DOMWindow* imp = V8DOMWindow::toNative(info.Holder());
+ V8DOMWindowShell::setLocation(imp, toWebCoreString(value));
}
-ACCESSOR_SETTER(DOMWindowOpener)
+void V8DOMWindow::openerAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+ DOMWindow* imp = V8DOMWindow::toNative(info.Holder());
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return;
// Opener can be shadowed if it is in the same domain.
@@ -242,33 +247,33 @@ ACCESSOR_SETTER(DOMWindowOpener)
#if ENABLE(VIDEO)
-ACCESSOR_GETTER(DOMWindowAudio)
+v8::Handle<v8::Value> V8DOMWindow::AudioAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+ DOMWindow* window = V8DOMWindow::toNative(info.Holder());
return V8DOMWrapper::getConstructor(V8ClassIndex::AUDIO, window);
}
-ACCESSOR_RUNTIME_ENABLER(DOMWindowAudio)
+bool V8DOMWindow::AudioEnabled()
{
return MediaPlayer::isAvailable();
}
-ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLMediaElement)
+bool V8DOMWindow::HTMLMediaElementEnabled()
{
return MediaPlayer::isAvailable();
}
-ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLAudioElement)
+bool V8DOMWindow::HTMLAudioElementEnabled()
{
return MediaPlayer::isAvailable();
}
-ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLVideoElement)
+bool V8DOMWindow::HTMLVideoElementEnabled()
{
return MediaPlayer::isAvailable();
}
-ACCESSOR_RUNTIME_ENABLER(DOMWindowMediaError)
+bool V8DOMWindow::MediaErrorEnabled()
{
return MediaPlayer::isAvailable();
}
@@ -276,74 +281,81 @@ ACCESSOR_RUNTIME_ENABLER(DOMWindowMediaError)
#endif
#if ENABLE(SHARED_WORKERS)
-ACCESSOR_RUNTIME_ENABLER(DOMWindowSharedWorker)
+bool V8DOMWindow::SharedWorkerEnabled()
{
return SharedWorkerRepository::isAvailable();
}
#endif
#if ENABLE(WEB_SOCKETS)
-ACCESSOR_RUNTIME_ENABLER(DOMWindowWebSocket)
+bool V8DOMWindow::WebSocketEnabled()
{
return WebSocket::isAvailable();
}
#endif
#if ENABLE(DATABASE)
-ACCESSOR_RUNTIME_ENABLER(DOMWindowOpenDatabase)
+bool V8DOMWindow::OpenDatabaseEnabled()
+{
+ return Database::isAvailable();
+}
+#endif
+
+#if ENABLE(INDEXED_DATABASE)
+bool V8DOMWindow::IndexedDBEnabled()
{
- return WebCore::RuntimeEnabledFeatures::databaseEnabled();
+ return RuntimeEnabledFeatures::indexedDatabaseEnabled();
}
#endif
#if ENABLE(DOM_STORAGE)
-ACCESSOR_RUNTIME_ENABLER(DOMWindowLocalStorage)
+bool V8DOMWindow::LocalStorageEnabled()
{
return RuntimeEnabledFeatures::localStorageEnabled();
}
-ACCESSOR_RUNTIME_ENABLER(DOMWindowSessionStorage)
+bool V8DOMWindow::SessionStorageEnabled()
{
return RuntimeEnabledFeatures::sessionStorageEnabled();
}
#endif
#if ENABLE(NOTIFICATIONS)
-ACCESSOR_RUNTIME_ENABLER(DOMWindowWebkitNotifications)
+bool V8DOMWindow::WebkitNotificationsEnabled()
{
return RuntimeEnabledFeatures::notificationsEnabled();
}
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-ACCESSOR_RUNTIME_ENABLER(DOMWindowApplicationCache)
+bool V8DOMWindow::ApplicationCacheEnabled()
{
return RuntimeEnabledFeatures::applicationCacheEnabled();
}
#endif
-ACCESSOR_GETTER(DOMWindowImage)
+v8::Handle<v8::Value> V8DOMWindow::ImageAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+ DOMWindow* window = V8DOMWindow::toNative(info.Holder());
return V8DOMWrapper::getConstructor(V8ClassIndex::IMAGE, window);
}
-ACCESSOR_GETTER(DOMWindowOption)
+v8::Handle<v8::Value> V8DOMWindow::OptionAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+ DOMWindow* window = V8DOMWindow::toNative(info.Holder());
return V8DOMWrapper::getConstructor(V8ClassIndex::OPTION, window);
}
-CALLBACK_FUNC_DECL(DOMWindowAddEventListener)
+v8::Handle<v8::Value> V8DOMWindow::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.addEventListener()");
String eventType = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return v8::Undefined();
Document* doc = imp->document();
@@ -360,23 +372,23 @@ CALLBACK_FUNC_DECL(DOMWindowAddEventListener)
if (listener) {
imp->addEventListener(eventType, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kDOMWindowEventListenerCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(DOMWindowRemoveEventListener)
+v8::Handle<v8::Value> V8DOMWindow::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.removeEventListener()");
String eventType = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return v8::Undefined();
Document* doc = imp->document();
@@ -392,22 +404,22 @@ CALLBACK_FUNC_DECL(DOMWindowRemoveEventListener)
if (listener) {
imp->removeEventListener(eventType, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kDOMWindowEventListenerCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(DOMWindowPostMessage)
+v8::Handle<v8::Value> V8DOMWindow::postMessageCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.postMessage()");
- DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* window = V8DOMWindow::toNative(args.Holder());
DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow();
ASSERT(source->frame());
v8::TryCatch tryCatch;
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(toWebCoreString(args[0]));
+ RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0]);
MessagePortArray portArray;
String targetOrigin;
@@ -431,7 +443,7 @@ CALLBACK_FUNC_DECL(DOMWindowPostMessage)
return throwError(ec);
}
-CALLBACK_FUNC_DECL(DOMWindowAtob)
+v8::Handle<v8::Value> V8DOMWindow::atobCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.atob()");
@@ -439,9 +451,9 @@ CALLBACK_FUNC_DECL(DOMWindowAtob)
return v8String("");
String str = toWebCoreString(args[0]);
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return v8::Undefined();
if (args.Length() < 1)
@@ -450,7 +462,7 @@ CALLBACK_FUNC_DECL(DOMWindowAtob)
return convertBase64(str, false);
}
-CALLBACK_FUNC_DECL(DOMWindowBtoa)
+v8::Handle<v8::Value> V8DOMWindow::btoaCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.btoa()");
@@ -458,9 +470,9 @@ CALLBACK_FUNC_DECL(DOMWindowBtoa)
return v8String("");
String str = toWebCoreString(args[0]);
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return v8::Undefined();
if (args.Length() < 1)
@@ -473,7 +485,7 @@ CALLBACK_FUNC_DECL(DOMWindowBtoa)
// fix this by calling toString function on the receiver.
// However, V8 implements toString in JavaScript, which requires
// switching context of receiver. I consider it is dangerous.
-CALLBACK_FUNC_DECL(DOMWindowToString)
+v8::Handle<v8::Value> V8DOMWindow::toStringCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.toString()");
v8::Handle<v8::Object> domWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, args.This());
@@ -482,7 +494,13 @@ CALLBACK_FUNC_DECL(DOMWindowToString)
return domWrapper->ObjectProtoToString();
}
-CALLBACK_FUNC_DECL(DOMWindowNOP)
+v8::Handle<v8::Value> V8DOMWindow::releaseEventsCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DOMWindow.nop()");
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8DOMWindow::captureEventsCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.nop()");
return v8::Undefined();
@@ -538,78 +556,7 @@ static HashMap<String, String> parseModalDialogFeatures(const String& featuresAr
return map;
}
-
-static Frame* createWindow(Frame* callingFrame,
- Frame* enteredFrame,
- Frame* openerFrame,
- const String& url,
- const String& frameName,
- const WindowFeatures& windowFeatures,
- v8::Local<v8::Value> dialogArgs)
-{
- ASSERT(callingFrame);
- ASSERT(enteredFrame);
-
- // Sandboxed iframes cannot open new auxiliary browsing contexts.
- if (callingFrame && callingFrame->loader()->isSandboxed(SandboxNavigation))
- return 0;
-
- ResourceRequest request;
-
- // For whatever reason, Firefox uses the entered frame to determine
- // the outgoingReferrer. We replicate that behavior here.
- String referrer = enteredFrame->loader()->outgoingReferrer();
- request.setHTTPReferrer(referrer);
- FrameLoader::addHTTPOriginIfNeeded(request, enteredFrame->loader()->outgoingOrigin());
- FrameLoadRequest frameRequest(request, frameName);
-
- // FIXME: It's much better for client API if a new window starts with a URL,
- // here where we know what URL we are going to open. Unfortunately, this
- // code passes the empty string for the URL, but there's a reason for that.
- // Before loading we have to set up the opener, openedByDOM,
- // and dialogArguments values. Also, to decide whether to use the URL
- // we currently do an allowsAccessFrom call using the window we create,
- // which can't be done before creating it. We'd have to resolve all those
- // issues to pass the URL instead of "".
-
- bool created;
- // We pass in the opener frame here so it can be used for looking up the
- // frame name, in case the active frame is different from the opener frame,
- // and the name references a frame relative to the opener frame, for example
- // "_self" or "_parent".
- Frame* newFrame = callingFrame->loader()->createWindow(openerFrame->loader(), frameRequest, windowFeatures, created);
- if (!newFrame)
- return 0;
-
- newFrame->loader()->setOpener(openerFrame);
- newFrame->page()->setOpenedByDOM();
-
- // Set dialog arguments on the global object of the new frame.
- if (!dialogArgs.IsEmpty()) {
- v8::Local<v8::Context> context = V8Proxy::context(newFrame);
- if (!context.IsEmpty()) {
- v8::Context::Scope scope(context);
- context->Global()->Set(v8::String::New("dialogArguments"), dialogArgs);
- }
- }
-
- if (protocolIsJavaScript(url) || ScriptController::isSafeScript(newFrame)) {
- KURL completedUrl =
- url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(url);
- bool userGesture = processingUserGesture();
-
- if (created)
- newFrame->loader()->changeLocation(completedUrl, referrer, false, false, userGesture);
- else if (!url.isEmpty())
- newFrame->redirectScheduler()->scheduleLocationChange(completedUrl.string(), referrer, false, userGesture);
- }
-
- return newFrame;
-}
-
-
-
-CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
+v8::Handle<v8::Value> V8DOMWindow::showModalDialogCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.showModalDialog()");
@@ -617,11 +564,10 @@ CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
v8::Local<v8::Value> dialogArgs = args[1];
String featureArgs = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
- DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(
- V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* window = V8DOMWindow::toNative(args.Holder());
Frame* frame = window->frame();
- if (!V8Proxy::canAccessFrame(frame, true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true))
return v8::Undefined();
Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
@@ -674,7 +620,7 @@ CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
windowFeatures.locationBarVisible = false;
windowFeatures.fullscreen = false;
- Frame* dialogFrame = createWindow(callingFrame, enteredFrame, frame, url, "", windowFeatures, dialogArgs);
+ Frame* dialogFrame = V8BindingDOMWindow::createWindow(V8BindingState::Only(), callingFrame, enteredFrame, frame, url, "", windowFeatures, dialogArgs);
if (!dialogFrame)
return v8::Undefined();
@@ -699,17 +645,17 @@ CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
}
-CALLBACK_FUNC_DECL(DOMWindowOpen)
+v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.open()");
String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]);
AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_blank" : AtomicString(toWebCoreString(args[1]));
- DOMWindow* parent = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+ DOMWindow* parent = V8DOMWindow::toNative(args.Holder());
Frame* frame = parent->frame();
- if (!V8Proxy::canAccessFrame(frame, true))
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true))
return v8::Undefined();
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
@@ -817,7 +763,7 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
windowFeatures.ySet = false;
}
- frame = createWindow(callingFrame, enteredFrame, frame, urlString, frameName, windowFeatures, v8::Local<v8::Value>());
+ frame = V8BindingDOMWindow::createWindow(V8BindingState::Only(), callingFrame, enteredFrame, frame, urlString, frameName, windowFeatures, v8::Local<v8::Value>());
if (!frame)
return v8::Undefined();
@@ -826,11 +772,11 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
}
-INDEXED_PROPERTY_GETTER(DOMWindow)
+v8::Handle<v8::Value> V8DOMWindow::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
{
INC_STATS("DOM.DOMWindow.IndexedPropertyGetter");
- DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+ DOMWindow* window = V8DOMWindow::toNative(info.Holder());
if (!window)
return notHandledByInterceptor();
@@ -846,12 +792,11 @@ INDEXED_PROPERTY_GETTER(DOMWindow)
}
-NAMED_PROPERTY_GETTER(DOMWindow)
+v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.DOMWindow.NamedPropertyGetter");
- // TODO(antonm): investigate what convertToNativeObject does for the case of DOMWINDOW.
- DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+ DOMWindow* window = V8DOMWindow::toNative(info.Holder());
if (!window)
return notHandledByInterceptor();
@@ -874,13 +819,14 @@ NAMED_PROPERTY_GETTER(DOMWindow)
// Search named items in the document.
Document* doc = frame->document();
- if (doc) {
- RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
- if (items->length() >= 1) {
- if (items->length() == 1)
- return V8DOMWrapper::convertNodeToV8Object(items->firstItem());
- else
+ if (doc && doc->isHTMLDocument()) {
+ if (static_cast<HTMLDocument*>(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) {
+ RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
+ if (items->length() >= 1) {
+ if (items->length() == 1)
+ return V8DOMWrapper::convertNodeToV8Object(items->firstItem());
return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.release());
+ }
}
}
@@ -888,44 +834,27 @@ NAMED_PROPERTY_GETTER(DOMWindow)
}
-void V8Custom::WindowSetLocation(DOMWindow* window, const String& relativeURL)
-{
- Frame* frame = window->frame();
- if (!frame)
- return;
-
- KURL url = completeURL(relativeURL);
- if (url.isNull())
- return;
-
- if (!shouldAllowNavigation(frame))
- return;
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-
-CALLBACK_FUNC_DECL(DOMWindowSetTimeout)
+v8::Handle<v8::Value> V8DOMWindow::setTimeoutCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.setTimeout()");
return WindowSetTimeoutImpl(args, true);
}
-CALLBACK_FUNC_DECL(DOMWindowSetInterval)
+v8::Handle<v8::Value> V8DOMWindow::setIntervalCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.setInterval()");
return WindowSetTimeoutImpl(args, false);
}
-void V8Custom::ClearTimeoutImpl(const v8::Arguments& args)
+void ClearTimeoutImpl(const v8::Arguments& args)
{
int handle = toInt32(args[0]);
v8::Handle<v8::Object> holder = args.Holder();
- DOMWindow* imp = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ DOMWindow* imp = V8DOMWindow::toNative(holder);
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return;
ScriptExecutionContext* context = static_cast<ScriptExecutionContext*>(imp->document());
if (!context)
@@ -934,28 +863,28 @@ void V8Custom::ClearTimeoutImpl(const v8::Arguments& args)
}
-CALLBACK_FUNC_DECL(DOMWindowClearTimeout)
+v8::Handle<v8::Value> V8DOMWindow::clearTimeoutCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.clearTimeout");
ClearTimeoutImpl(args);
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(DOMWindowClearInterval)
+v8::Handle<v8::Value> V8DOMWindow::clearIntervalCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.clearInterval");
ClearTimeoutImpl(args);
return v8::Undefined();
}
-NAMED_ACCESS_CHECK(DOMWindow)
+bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
if (window.IsEmpty())
return false; // the frame is gone.
- DOMWindow* targetWindow = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
+ DOMWindow* targetWindow = V8DOMWindow::toNative(window);
ASSERT(targetWindow);
@@ -971,17 +900,17 @@ NAMED_ACCESS_CHECK(DOMWindow)
return true;
}
- return V8Proxy::canAccessFrame(target, false);
+ return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, false);
}
-INDEXED_ACCESS_CHECK(DOMWindow)
+bool V8DOMWindow::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
if (window.IsEmpty())
return false;
- DOMWindow* targetWindow = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
+ DOMWindow* targetWindow = V8DOMWindow::toNative(window);
ASSERT(targetWindow);
@@ -993,7 +922,7 @@ INDEXED_ACCESS_CHECK(DOMWindow)
if ((type == v8::ACCESS_GET || type == v8::ACCESS_HAS) && target->tree()->child(index))
return true;
- return V8Proxy::canAccessFrame(target, false);
+ return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, false);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
index 1dde996..8980cfe 100644
--- a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
@@ -40,16 +40,6 @@
namespace WebCore {
-INDEXED_PROPERTY_GETTER(DataGridColumnList)
-{
- INC_STATS("DataGridColumnList.IndexedPropertyGetter");
- DataGridColumnList* imp = V8DOMWrapper::convertToNativeObject<DataGridColumnList>(V8ClassIndex::DATAGRIDCOLUMNLIST, info.Holder());
- DataGridColumn* result = imp->item(index);
- if (!result)
- return notHandledByInterceptor();
- return V8DOMWrapper::convertToV8Object(V8ClassIndex::DATAGRIDCOLUMN, result);
-}
-
NAMED_PROPERTY_GETTER(DataGridColumnList)
{
INC_STATS("DataGridColumnList.NamedPropertyGetter");
@@ -63,7 +53,7 @@ NAMED_PROPERTY_GETTER(DataGridColumnList)
return notHandledByInterceptor();
// Finally, look up a column by name.
- DataGridColumnList* imp = V8DOMWrapper::convertToNativeObject<DataGridColumnList>(V8ClassIndex::DATAGRIDCOLUMNLIST, info.Holder());
+ DataGridColumnList* imp = V8DataGridColumnList::toNative(info.Holder());
DataGridColumn* result = imp->itemWithName(toWebCoreString(name));
if (!result)
return notHandledByInterceptor();
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
index 9ddd620..c83e1cc 100644
--- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#if ENABLE(DATABASE)
+#include "V8Database.h"
#include "Database.h"
#include "V8Binding.h"
@@ -42,7 +43,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(DatabaseChangeVersion)
+v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Database.changeVersion()");
@@ -52,7 +53,7 @@ CALLBACK_FUNC_DECL(DatabaseChangeVersion)
if (!(args[0]->IsString() && args[1]->IsString()))
return throwError("The old and new versions must be strings.");
- Database* database = V8DOMWrapper::convertToNativeObject<Database>(V8ClassIndex::DATABASE, args.Holder());
+ Database* database = V8Database::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
@@ -95,7 +96,7 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
if (!args[0]->IsObject())
return throwError("Transaction callback must be of valid type.");
- Database* database = V8DOMWrapper::convertToNativeObject<Database>(V8ClassIndex::DATABASE, args.Holder());
+ Database* database = V8Database::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
@@ -123,13 +124,13 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(DatabaseTransaction)
+v8::Handle<v8::Value> V8Database::transactionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Database.transaction()");
return createTransaction(args, false);
}
-CALLBACK_FUNC_DECL(DatabaseReadTransaction)
+v8::Handle<v8::Value> V8Database::readTransactionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Database.readTransaction()");
return createTransaction(args, true);
diff --git a/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp
index 263c005..4486dbe 100644
--- a/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp
@@ -31,10 +31,10 @@
#include "config.h"
#if ENABLE(WORKERS)
-
-#include "WorkerContextExecutionProxy.h"
+#include "V8DedicatedWorkerContext.h"
#include "DedicatedWorkerContext.h"
+#include "WorkerContextExecutionProxy.h"
#include "V8Binding.h"
#include "V8MessagePortCustom.h"
#include "V8Proxy.h"
@@ -42,11 +42,11 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(DedicatedWorkerContextPostMessage)
+v8::Handle<v8::Value> V8DedicatedWorkerContext::postMessageCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.DedicatedWorkerContext.postMessage");
- DedicatedWorkerContext* workerContext = V8DOMWrapper::convertToNativeObject<DedicatedWorkerContext>(V8ClassIndex::DEDICATEDWORKERCONTEXT, args.Holder());
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(v8ValueToWebCoreString(args[0]));
+ DedicatedWorkerContext* workerContext = V8DedicatedWorkerContext::toNative(args.Holder());
+ RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0]);
MessagePortArray portArray;
if (args.Length() > 1) {
if (!getMessagePortArray(args[1], portArray))
diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
index ee68293..4aedde5 100644
--- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
@@ -29,9 +29,10 @@
*/
#include "config.h"
-#include "Document.h"
+#include "V8Document.h"
#include "CanvasRenderingContext.h"
+#include "Document.h"
#include "ExceptionCode.h"
#include "Node.h"
#include "XPathNSResolver.h"
@@ -53,16 +54,21 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(DocumentEvaluate)
+v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Document.evaluate()");
+<<<<<<< HEAD
#if ENABLE(XPATH)
RefPtr<Document> document = V8DOMWrapper::convertDOMWrapperToNode<Document>(args.Holder());
+=======
+
+ RefPtr<Document> document = V8Document::toNative(args.Holder());
+>>>>>>> webkit.org at r54127
ExceptionCode ec = 0;
String expression = toWebCoreString(args[0]);
RefPtr<Node> contextNode;
if (V8Node::HasInstance(args[1]))
- contextNode = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[1]));
+ contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1]));
RefPtr<XPathNSResolver> resolver = V8DOMWrapper::getXPathNSResolver(args[2], V8Proxy::retrieve(V8Proxy::retrieveFrameForCallingContext()));
if (!resolver && !args[2]->IsNull() && !args[2]->IsUndefined())
@@ -71,7 +77,7 @@ CALLBACK_FUNC_DECL(DocumentEvaluate)
int type = toInt32(args[3]);
RefPtr<XPathResult> inResult;
if (V8XPathResult::HasInstance(args[4]))
- inResult = V8DOMWrapper::convertToNativeObject<XPathResult>(V8ClassIndex::XPATHRESULT, v8::Handle<v8::Object>::Cast(args[4]));
+ inResult = V8XPathResult::toNative(v8::Handle<v8::Object>::Cast(args[4]));
v8::TryCatch exceptionCatcher;
RefPtr<XPathResult> result = document->evaluate(expression, contextNode.get(), resolver.get(), type, inResult.get(), ec);
@@ -88,11 +94,11 @@ CALLBACK_FUNC_DECL(DocumentEvaluate)
}
-CALLBACK_FUNC_DECL(DocumentGetCSSCanvasContext)
+v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Document.getCSSCanvasContext");
v8::Handle<v8::Object> holder = args.Holder();
- Document* imp = V8DOMWrapper::convertDOMWrapperToNode<Document>(holder);
+ Document* imp = V8Document::toNative(holder);
String contextId = toWebCoreString(args[0]);
String name = toWebCoreString(args[1]);
int width = toInt32(args[2]);
@@ -110,4 +116,32 @@ CALLBACK_FUNC_DECL(DocumentGetCSSCanvasContext)
return v8::Undefined();
}
+
+// DOMImplementation is a singleton in WebCore. If we use our normal
+// mapping from DOM objects to V8 wrappers, the same wrapper will be
+// shared for all frames in the same process. This is a major
+// security problem. Therefore, we generate a DOMImplementation
+// wrapper per document and store it in an internal field of the
+// document. Since the DOMImplementation object is a singleton, we do
+// not have to do anything to keep the DOMImplementation object alive
+// for the lifetime of the wrapper.
+v8::Handle<v8::Value> V8Document::implementationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ ASSERT(info.Holder()->InternalFieldCount() >= internalFieldCount);
+
+ // Check if the internal field already contains a wrapper.
+ v8::Local<v8::Value> implementation = info.Holder()->GetInternalField(V8Document::implementationIndex);
+ if (!implementation->IsUndefined())
+ return implementation;
+
+ // Generate a wrapper.
+ Document* document = V8Document::toNative(info.Holder());
+ v8::Handle<v8::Value> wrapper = V8DOMWrapper::convertDOMImplementationToV8Object(document->implementation());
+
+ // Store the wrapper in the internal field.
+ info.Holder()->SetInternalField(implementationIndex, wrapper);
+
+ return wrapper;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
index 440bbdc..8dc4672 100644
--- a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
@@ -22,19 +22,20 @@
*/
#include "config.h"
-#include "V8CustomBinding.h"
+#include "V8Document.h"
#include "DOMWindow.h"
#include "Frame.h"
#include "V8Binding.h"
+#include "V8CustomBinding.h"
#include "V8Document.h"
#include "V8Proxy.h"
namespace WebCore {
-ACCESSOR_GETTER(DocumentLocation)
+v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- Document* document = V8DOMWrapper::convertDOMWrapperToNative<Document>(info.Holder());
+ Document* document = V8Document::toNative(info.Holder());
if (!document->frame())
return v8::Null();
@@ -42,15 +43,15 @@ ACCESSOR_GETTER(DocumentLocation)
return V8DOMWrapper::convertToV8Object(V8ClassIndex::LOCATION, window->location());
}
-ACCESSOR_SETTER(DocumentLocation)
+void V8Document::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- Document* document = V8DOMWrapper::convertDOMWrapperToNative<Document>(info.Holder());
+ Document* document = V8Document::toNative(info.Holder());
if (!document->frame())
return;
DOMWindow* window = document->frame()->domWindow();
- // WindowSetLocation does security checks. // XXXMB- verify!
- WindowSetLocation(window, toWebCoreString(value));
+ // setLocation does security checks. // XXXMB- verify!
+ V8DOMWindowShell::setLocation(window, toWebCoreString(value));
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
index e17e0a9..0f13f9d 100644
--- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
@@ -29,11 +29,12 @@
*/
#include "config.h"
-#include "Element.h"
+#include "V8Element.h"
#include "Attr.h"
#include "CSSHelper.h"
#include "Document.h"
+#include "Element.h"
#include "ExceptionCode.h"
#include "HTMLFrameElementBase.h"
#include "HTMLNames.h"
@@ -41,6 +42,7 @@
#include "V8Attr.h"
#include "V8Binding.h"
+#include "V8BindingState.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
@@ -48,14 +50,14 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(ElementSetAttribute)
+v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Element.setAttribute()");
- Element* element = V8DOMWrapper::convertDOMWrapperToNode<Element>(args.Holder());
+ Element* element = V8Element::toNative(args.Holder());
String name = toWebCoreString(args[0]);
String value = toWebCoreString(args[1]);
- if (!allowSettingSrcToJavascriptURL(element, name, value))
+ if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, name, value))
return v8::Undefined();
ExceptionCode ec = 0;
@@ -66,16 +68,16 @@ CALLBACK_FUNC_DECL(ElementSetAttribute)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(ElementSetAttributeNode)
+v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Element.setAttributeNode()");
if (!V8Attr::HasInstance(args[0]))
return throwError(TYPE_MISMATCH_ERR);
- Attr* newAttr = V8DOMWrapper::convertDOMWrapperToNode<Attr>(v8::Handle<v8::Object>::Cast(args[0]));
- Element* element = V8DOMWrapper::convertDOMWrapperToNode<Element>(args.Holder());
+ Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ Element* element = V8Element::toNative(args.Holder());
- if (!allowSettingSrcToJavascriptURL(element, newAttr->name(), newAttr->value()))
+ if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))
return v8::Undefined();
ExceptionCode ec = 0;
@@ -86,15 +88,15 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNode)
return V8DOMWrapper::convertNodeToV8Object(result.release());
}
-CALLBACK_FUNC_DECL(ElementSetAttributeNS)
+v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Element.setAttributeNS()");
- Element* element = V8DOMWrapper::convertDOMWrapperToNode<Element>(args.Holder());
+ Element* element = V8Element::toNative(args.Holder());
String namespaceURI = toWebCoreStringWithNullCheck(args[0]);
String qualifiedName = toWebCoreString(args[1]);
String value = toWebCoreString(args[2]);
- if (!allowSettingSrcToJavascriptURL(element, qualifiedName, value))
+ if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, qualifiedName, value))
return v8::Undefined();
ExceptionCode ec = 0;
@@ -105,16 +107,16 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNS)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(ElementSetAttributeNodeNS)
+v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Element.setAttributeNodeNS()");
if (!V8Attr::HasInstance(args[0]))
return throwError(TYPE_MISMATCH_ERR);
- Attr* newAttr = V8DOMWrapper::convertDOMWrapperToNode<Attr>(v8::Handle<v8::Object>::Cast(args[0]));
- Element* element = V8DOMWrapper::convertDOMWrapperToNode<Element>(args.Holder());
+ Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ Element* element = V8Element::toNative(args.Holder());
- if (!allowSettingSrcToJavascriptURL(element, newAttr->name(), newAttr->value()))
+ if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))
return v8::Undefined();
ExceptionCode ec = 0;
diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp
index 8bac40f..65cd41e 100644
--- a/WebCore/bindings/v8/custom/V8EventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventCustom.cpp
@@ -29,27 +29,27 @@
*/
#include "config.h"
-#include "Event.h"
+#include "V8Event.h"
#include "Clipboard.h"
#include "ClipboardEvent.h"
+#include "Event.h"
#include "MouseEvent.h"
-
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
-ACCESSOR_SETTER(EventReturnValue)
+void V8Event::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- Event* event = V8DOMWrapper::convertDOMWrapperToNative<Event>(info.Holder());
+ Event* event = V8Event::toNative(info.Holder());
event->setDefaultPrevented(!value->BooleanValue());
}
-ACCESSOR_GETTER(EventDataTransfer)
+v8::Handle<v8::Value> V8Event::dataTransferAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- Event* event = V8DOMWrapper::convertDOMWrapperToNative<Event>(info.Holder());
+ Event* event = V8Event::toNative(info.Holder());
if (event->isDragEvent())
return V8DOMWrapper::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<MouseEvent*>(event)->clipboard());
@@ -57,9 +57,9 @@ ACCESSOR_GETTER(EventDataTransfer)
return v8::Undefined();
}
-ACCESSOR_GETTER(EventClipboardData)
+v8::Handle<v8::Value> V8Event::clipboardDataAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- Event* event = V8DOMWrapper::convertDOMWrapperToNative<Event>(info.Holder());
+ Event* event = V8Event::toNative(info.Holder());
if (event->isClipboardEvent())
return V8DOMWrapper::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<ClipboardEvent*>(event)->clipboard());
@@ -67,16 +67,4 @@ ACCESSOR_GETTER(EventClipboardData)
return v8::Undefined();
}
-ACCESSOR_GETTER(EventSrcElement)
-{
- Event* event = V8DOMWrapper::convertDOMWrapperToNative<Event>(info.Holder());
- return V8DOMWrapper::convertEventTargetToV8Object(event->target());
-}
-
-ACCESSOR_GETTER(EventReturnValue)
-{
- Event* event = V8DOMWrapper::convertDOMWrapperToNative<Event>(info.Holder());
- return event->defaultPrevented() ? v8::False() : v8::True();
-}
-
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
index 0dfa515..458c35d 100644
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,50 +29,52 @@
*/
#include "config.h"
-#include "HTMLSelectElement.h"
-#include "HTMLOptionsCollection.h"
+#if ENABLE(EVENTSOURCE)
+#include "V8EventSource.h"
+
+#include "EventSource.h"
+#include "Frame.h"
#include "V8Binding.h"
-#include "V8Collection.h"
#include "V8CustomBinding.h"
-#include "V8NamedNodesCollection.h"
#include "V8Proxy.h"
+#include "V8Utilities.h"
+#include "WorkerContext.h"
+#include "WorkerContextExecutionProxy.h"
namespace WebCore {
-NAMED_PROPERTY_GETTER(HTMLSelectElementCollection)
+v8::Handle<v8::Value> V8EventSource::constructorCallback(const v8::Arguments& args)
{
- INC_STATS("DOM.HTMLSelectElementCollection.NamedPropertySetter");
- HTMLSelectElement* select = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
- v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
-
- if (!value.IsEmpty())
- return value;
-
- // Search local callback properties next to find IDL defined properties.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return notHandledByInterceptor();
+ INC_STATS("DOM.EventSource.Constructor");
- PassRefPtr<HTMLOptionsCollection> collection = select->options();
+ if (!args.IsConstructCall())
+ return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
- Vector<RefPtr<Node> > items;
- collection->namedItems(v8StringToAtomicWebCoreString(name), items);
+ // Expect one parameter.
+ // Allocate an EventSource object as its internal field.
+ ScriptExecutionContext* context = getScriptExecutionContext();
+ if (!context)
+ return throwError("EventSource constructor's associated context is not available", V8Proxy::ReferenceError);
+ if (args.Length() != 1)
+ return throwError("EventSource constructor wrong number of parameters", V8Proxy::TypeError);
- if (!items.size())
- return notHandledByInterceptor();
+ ExceptionCode ec = 0;
+ String url = toWebCoreString(args[0]);
- if (items.size() == 1)
- return V8DOMWrapper::convertNodeToV8Object(items.at(0).release());
+ RefPtr<EventSource> eventSource = EventSource::create(url, context, ec);
+
+ if (ec)
+ return throwError(ec);
- NodeList* list = new V8NamedNodesCollection(items);
- return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
-}
+ V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::EVENTSOURCE), eventSource.get());
-INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection)
-{
- INC_STATS("DOM.HTMLSelectElementCollection.IndexedPropertySetter");
- HTMLSelectElement* select = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
- return toOptionsCollectionSetter(index, value, select);
+ // Add object to the wrapper map.
+ eventSource->ref();
+ V8DOMWrapper::setJSWrapperForActiveDOMObject(eventSource.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+ return args.Holder();
}
} // namespace WebCore
+
+#endif // ENABLE(EVENTSOURCE)
diff --git a/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp b/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
new file mode 100644
index 0000000..e603549
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(EVENTSOURCE)
+#include "V8EventSource.h"
+
+#include "EventSource.h"
+
+#include "V8Binding.h"
+#include "V8CustomBinding.h"
+#include "V8Proxy.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8EventSource::addEventListenerCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.EventSource.addEventListener()");
+ EventSource* eventSource = V8EventSource::toNative(args.Holder());
+
+ RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(eventSource, args[1], false, ListenerFindOrCreate);
+ if (listener) {
+ String type = toWebCoreString(args[0]);
+ bool useCapture = args[2]->BooleanValue();
+ eventSource->addEventListener(type, listener, useCapture);
+
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
+ }
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8EventSource::removeEventListenerCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.EventSource.removeEventListener()");
+ EventSource* eventSource = V8EventSource::toNative(args.Holder());
+
+ RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(eventSource, args[1], false, ListenerFindOnly);
+ if (listener) {
+ String type = toWebCoreString(args[0]);
+ bool useCapture = args[2]->BooleanValue();
+ eventSource->removeEventListener(type, listener.get(), useCapture);
+
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
+ }
+
+ return v8::Undefined();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(EVENTSOURCE)
diff --git a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
index 011beff..6bd9ff2 100644
--- a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
@@ -24,6 +24,8 @@
*/
#include "config.h"
+#include "V8Geolocation.h"
+
#include "Geolocation.h"
#include "V8Binding.h"
@@ -165,7 +167,7 @@ static PassRefPtr<PositionOptions> createPositionOptions(v8::Local<v8::Value> va
return options.release();
}
-CALLBACK_FUNC_DECL(GeolocationGetCurrentPosition)
+v8::Handle<v8::Value> V8Geolocation::getCurrentPositionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Geolocation.getCurrentPosition()");
@@ -185,12 +187,12 @@ CALLBACK_FUNC_DECL(GeolocationGetCurrentPosition)
return v8::Undefined();
ASSERT(positionOptions);
- Geolocation* geolocation = V8DOMWrapper::convertToNativeObject<Geolocation>(V8ClassIndex::GEOLOCATION, args.Holder());
+ Geolocation* geolocation = V8Geolocation::toNative(args.Holder());
geolocation->getCurrentPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(GeolocationWatchPosition)
+v8::Handle<v8::Value> V8Geolocation::watchPositionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Geolocation.watchPosition()");
@@ -210,7 +212,7 @@ CALLBACK_FUNC_DECL(GeolocationWatchPosition)
return v8::Undefined();
ASSERT(positionOptions);
- Geolocation* geolocation = V8DOMWrapper::convertToNativeObject<Geolocation>(V8ClassIndex::GEOLOCATION, args.Holder());
+ Geolocation* geolocation = V8Geolocation::toNative(args.Holder());
int watchId = geolocation->watchPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
return v8::Number::New(watchId);
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index 419f374..c34d9e7 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+#include "V8HTMLAllCollection.h"
+
#include "HTMLAllCollection.h"
#include "V8Binding.h"
@@ -69,7 +71,7 @@ static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v
return V8DOMWrapper::convertNodeToV8Object(result.release());
}
-NAMED_PROPERTY_GETTER(HTMLAllCollection)
+v8::Handle<v8::Value> V8HTMLAllCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLAllCollection.NamedPropertyGetter");
// Search the prototype chain first.
@@ -84,21 +86,21 @@ NAMED_PROPERTY_GETTER(HTMLAllCollection)
return v8::Handle<v8::Value>();
// Finally, search the DOM structure.
- HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, info.Holder());
+ HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder());
return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
}
-CALLBACK_FUNC_DECL(HTMLAllCollectionItem)
+v8::Handle<v8::Value> V8HTMLAllCollection::itemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAllCollection.item()");
- HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
+ HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
return getItem(imp, args[0]);
}
-CALLBACK_FUNC_DECL(HTMLAllCollectionNamedItem)
+v8::Handle<v8::Value> V8HTMLAllCollection::namedItemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAllCollection.namedItem()");
- HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
+ HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
if (result.IsEmpty())
@@ -107,13 +109,13 @@ CALLBACK_FUNC_DECL(HTMLAllCollectionNamedItem)
return result;
}
-CALLBACK_FUNC_DECL(HTMLAllCollectionCallAsFunction)
+v8::Handle<v8::Value> V8HTMLAllCollection::callAsFunctionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAllCollection.callAsFunction()");
if (args.Length() < 1)
return v8::Undefined();
- HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
+ HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
if (args.Length() == 1)
return getItem(imp, args[0]);
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
index c82d88a..e634003 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
@@ -35,8 +35,8 @@
#include "Document.h"
#include "Frame.h"
#include "HTMLNames.h"
-
#include "V8Binding.h"
+#include "V8HTMLAudioElement.h"
#include "V8Proxy.h"
#include <wtf/RefPtr.h>
@@ -53,7 +53,7 @@ v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate(
v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLAudioElementConstructor));
v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8Custom::kNodeMinimumInternalFieldCount);
+ instance->SetInternalFieldCount(V8HTMLAudioElement::internalFieldCount);
result->SetClassName(v8::String::New("HTMLAudioElement"));
result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLAUDIOELEMENT));
@@ -61,7 +61,7 @@ v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate(
return cachedTemplate;
}
-CALLBACK_FUNC_DECL(HTMLAudioElementConstructor)
+v8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAudioElement.Contructor");
diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
index e51437e..0d1ff44 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
@@ -29,10 +29,12 @@
*/
#include "config.h"
-#include "HTMLCanvasElement.h"
-#include "CanvasRenderingContext.h"
+#include "V8HTMLCanvasElement.h"
+#include "CanvasContextAttributes.h"
#include "CanvasRenderingContext.h"
+#include "HTMLCanvasElement.h"
+#include "WebGLContextAttributes.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8Node.h"
@@ -40,13 +42,38 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(HTMLCanvasElementGetContext)
+v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLCanvasElement.context");
v8::Handle<v8::Object> holder = args.Holder();
- HTMLCanvasElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLCanvasElement>(holder);
+ HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder);
String contextId = toWebCoreString(args[0]);
- CanvasRenderingContext* result = imp->getContext(contextId);
+ RefPtr<CanvasContextAttributes> attrs;
+#if ENABLE(3D_CANVAS)
+ if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
+ attrs = WebGLContextAttributes::create();
+ WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
+ if (args.Length() > 1 && args[0]->IsObject()) {
+ v8::Handle<v8::Object> jsAttrs = args[1]->ToObject();
+ v8::Handle<v8::String> alpha = v8::String::New("alpha");
+ if (jsAttrs->Has(alpha))
+ webGLAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue());
+ v8::Handle<v8::String> depth = v8::String::New("depth");
+ if (jsAttrs->Has(depth))
+ webGLAttrs->setDepth(jsAttrs->Get(depth)->BooleanValue());
+ v8::Handle<v8::String> stencil = v8::String::New("stencil");
+ if (jsAttrs->Has(stencil))
+ webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue());
+ v8::Handle<v8::String> antialias = v8::String::New("antialias");
+ if (jsAttrs->Has(antialias))
+ webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue());
+ v8::Handle<v8::String> premultipliedAlpha = v8::String::New("premultipliedAlpha");
+ if (jsAttrs->Has(premultipliedAlpha))
+ webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlpha)->BooleanValue());
+ }
+ }
+#endif
+ CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
if (!result)
return v8::Undefined();
if (result->is2d())
@@ -60,4 +87,3 @@ CALLBACK_FUNC_DECL(HTMLCanvasElementGetContext)
}
} // namespace WebCore
-
diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
index 7c9b40f..8bb3c3a 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
@@ -29,8 +29,9 @@
*/
#include "config.h"
-#include "HTMLCollection.h"
+#include "V8HTMLCollection.h"
+#include "HTMLCollection.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8NamedNodesCollection.h"
@@ -69,7 +70,7 @@ static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::
return V8DOMWrapper::convertNodeToV8Object(result.release());
}
-NAMED_PROPERTY_GETTER(HTMLCollection)
+v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLCollection.NamedPropertyGetter");
// Search the prototype chain first.
@@ -84,21 +85,21 @@ NAMED_PROPERTY_GETTER(HTMLCollection)
return v8::Handle<v8::Value>();
// Finally, search the DOM structure.
- HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, info.Holder());
+ HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder());
return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
}
-CALLBACK_FUNC_DECL(HTMLCollectionItem)
+v8::Handle<v8::Value> V8HTMLCollection::itemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLCollection.item()");
- HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
+ HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
return getItem(imp, args[0]);
}
-CALLBACK_FUNC_DECL(HTMLCollectionNamedItem)
+v8::Handle<v8::Value> V8HTMLCollection::namedItemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLCollection.namedItem()");
- HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
+ HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
if (result.IsEmpty())
@@ -107,13 +108,13 @@ CALLBACK_FUNC_DECL(HTMLCollectionNamedItem)
return result;
}
-CALLBACK_FUNC_DECL(HTMLCollectionCallAsFunction)
+v8::Handle<v8::Value> V8HTMLCollection::callAsFunctionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLCollection.callAsFunction()");
if (args.Length() < 1)
return v8::Undefined();
- HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
+ HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
if (args.Length() == 1)
return getItem(imp, args[0]);
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index 9cf2f3d..13243ef 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -29,24 +29,22 @@
*/
#include "config.h"
-#include "HTMLDocument.h"
+#include "V8HTMLDocument.h"
#include "Frame.h"
#include "HTMLAllCollection.h"
+#include "HTMLDocument.h"
#include "HTMLCollection.h"
#include "HTMLIFrameElement.h"
#include "HTMLNames.h"
-
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
-
#include <wtf/RefPtr.h>
#include <wtf/StdLibExtras.h>
namespace WebCore {
-NAMED_PROPERTY_DELETER(HTMLDocument)
+v8::Handle<v8::Boolean> V8HTMLDocument::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
// Only handle document.all. Insert the marker object into the
// shadow internal field to signal that document.all is no longer
@@ -56,13 +54,13 @@ NAMED_PROPERTY_DELETER(HTMLDocument)
if (key != all)
return deletionNotHandledByInterceptor();
- ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCount);
- v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocumentMarkerIndex);
- info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, marker);
+ ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
+ v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex);
+ info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, marker);
return v8::True();
}
-NAMED_PROPERTY_GETTER(HTMLDocument)
+v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLDocument.NamedPropertyGetter");
AtomicString key = v8StringToAtomicWebCoreString(name);
@@ -72,14 +70,14 @@ NAMED_PROPERTY_GETTER(HTMLDocument)
// been temporarily shadowed and we return the value.
DEFINE_STATIC_LOCAL(const AtomicString, all, ("all"));
if (key == all) {
- ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCount);
- v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocumentMarkerIndex);
- v8::Local<v8::Value> value = info.Holder()->GetInternalField(kHTMLDocumentShadowIndex);
+ ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
+ v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex);
+ v8::Local<v8::Value> value = info.Holder()->GetInternalField(V8HTMLDocument::shadowIndex);
if (marker != value)
return value;
}
- HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(info.Holder());
+ HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
// Fast case for named elements that are not there.
if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl()))
@@ -101,6 +99,13 @@ NAMED_PROPERTY_GETTER(HTMLDocument)
return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.release());
}
+v8::Handle<v8::Value> V8HTMLDocument::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo &info)
+{
+ INC_STATS("DOM.HTMLDocument.IndexedPropertyGetter");
+ v8::Local<v8::Integer> indexV8 = v8::Integer::NewFromUnsigned(index);
+ return namedPropertyGetter(indexV8->ToString(), info);
+}
+
// HTMLDocument ----------------------------------------------------------------
// Concatenates "args" to a string. If args is empty, returns empty string.
@@ -115,28 +120,28 @@ static String writeHelperGetString(const v8::Arguments& args)
return str;
}
-CALLBACK_FUNC_DECL(HTMLDocumentWrite)
+v8::Handle<v8::Value> V8HTMLDocument::writeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLDocument.write()");
- HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
+ HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCallingContext();
htmlDocument->write(writeHelperGetString(args), frame ? frame->document() : NULL);
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(HTMLDocumentWriteln)
+v8::Handle<v8::Value> V8HTMLDocument::writelnCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLDocument.writeln()");
- HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
+ HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCallingContext();
htmlDocument->writeln(writeHelperGetString(args), frame ? frame->document() : NULL);
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(HTMLDocumentOpen)
+v8::Handle<v8::Value> V8HTMLDocument::openCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLDocument.open()");
- HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
+ HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
if (args.Length() > 2) {
if (Frame* frame = htmlDocument->frame()) {
@@ -173,21 +178,21 @@ CALLBACK_FUNC_DECL(HTMLDocumentOpen)
return args.Holder();
}
-ACCESSOR_GETTER(HTMLDocumentAll)
+v8::Handle<v8::Value> V8HTMLDocument::allAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLDocument.all._get");
v8::HandleScope scope;
v8::Handle<v8::Object> holder = info.Holder();
- HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(holder);
+ HTMLDocument* htmlDocument = V8HTMLDocument::toNative(holder);
return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, htmlDocument->all());
}
-ACCESSOR_SETTER(HTMLDocumentAll)
+void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLDocument.all._set");
v8::Handle<v8::Object> holder = info.Holder();
- ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCount);
- info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, value);
+ ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
+ info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, value);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
index 1ec09f7..d819e9b 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
@@ -29,9 +29,10 @@
*/
#include "config.h"
-#include "HTMLFormElement.h"
+#include "V8HTMLFormElement.h"
#include "HTMLCollection.h"
+#include "HTMLFormElement.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8NamedNodesCollection.h"
@@ -39,10 +40,10 @@
namespace WebCore {
-INDEXED_PROPERTY_GETTER(HTMLFormElement)
+v8::Handle<v8::Value> V8HTMLFormElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLFormElement.IndexedPropertyGetter");
- HTMLFormElement* form = V8DOMWrapper::convertDOMWrapperToNode<HTMLFormElement>(info.Holder());
+ HTMLFormElement* form = V8HTMLFormElement::toNative(info.Holder());
RefPtr<Node> formElement = form->elements()->item(index);
if (!formElement)
@@ -50,11 +51,10 @@ INDEXED_PROPERTY_GETTER(HTMLFormElement)
return V8DOMWrapper::convertNodeToV8Object(formElement.release());
}
-
-NAMED_PROPERTY_GETTER(HTMLFormElement)
+v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLFormElement.NamedPropertyGetter");
- HTMLFormElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLFormElement>(info.Holder());
+ HTMLFormElement* imp = V8HTMLFormElement::toNative(info.Holder());
AtomicString v = v8StringToAtomicWebCoreString(name);
// Call getNamedElements twice, first time check if it has a value
@@ -80,10 +80,15 @@ NAMED_PROPERTY_GETTER(HTMLFormElement)
return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, collection);
}
-CALLBACK_FUNC_DECL(HTMLFormElementSubmit) {
+v8::Handle<v8::Value> V8HTMLFormElement::submitCallback(const v8::Arguments& args)
+{
INC_STATS("DOM.HTMLFormElement.submit()");
- HTMLFormElement* form = V8DOMWrapper::convertDOMWrapperToNative<HTMLFormElement>(args.Holder());
- form->submit(0, false, false);
+ HTMLFormElement* form = V8HTMLFormElement::toNative(args.Holder());
+ Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
+ if (!frame)
+ return v8::Undefined();
+
+ form->submit(frame);
return v8::Undefined();
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
index 2f55758..fd831bf 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
@@ -29,10 +29,12 @@
*/
#include "config.h"
+#include "V8HTMLFrameElement.h"
+
#include "HTMLFrameElement.h"
#include "HTMLNames.h"
-
#include "V8Binding.h"
+#include "V8BindingState.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
@@ -40,23 +42,23 @@ namespace WebCore {
using namespace HTMLNames;
-ACCESSOR_SETTER(HTMLFrameElementSrc)
+void V8HTMLFrameElement::srcAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- HTMLFrameElement* frame = V8DOMWrapper::convertDOMWrapperToNode<HTMLFrameElement>(info.Holder());
+ HTMLFrameElement* frame = V8HTMLFrameElement::toNative(info.Holder());
String srcValue = toWebCoreStringWithNullCheck(value);
- if (!allowSettingFrameSrcToJavascriptUrl(frame, srcValue))
+ if (!V8BindingSecurity::allowSettingFrameSrcToJavascriptUrl(V8BindingState::Only(), frame, srcValue))
return;
frame->setAttribute(srcAttr, srcValue);
}
-ACCESSOR_SETTER(HTMLFrameElementLocation)
+void V8HTMLFrameElement::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- HTMLFrameElement* frame = V8DOMWrapper::convertDOMWrapperToNode<HTMLFrameElement>(info.Holder());
+ HTMLFrameElement* frame = V8HTMLFrameElement::toNative(info.Holder());
String locationValue = toWebCoreStringWithNullCheck(value);
- if (!allowSettingFrameSrcToJavascriptUrl(frame, locationValue))
+ if (!V8BindingSecurity::allowSettingFrameSrcToJavascriptUrl(V8BindingState::Only(), frame, locationValue))
return;
frame->setLocation(locationValue);
diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
index e8e2e72..214b11e 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
@@ -29,12 +29,13 @@
*/
#include "config.h"
-#include "HTMLFrameSetElement.h"
+#include "V8HTMLFrameSetElement.h"
#include "Document.h"
#include "Frame.h"
#include "HTMLCollection.h"
#include "HTMLFrameElement.h"
+#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
#include "Node.h"
@@ -44,10 +45,10 @@
namespace WebCore {
-NAMED_PROPERTY_GETTER(HTMLFrameSetElement)
+v8::Handle<v8::Value> V8HTMLFrameSetElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter");
- HTMLFrameSetElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLFrameSetElement>(info.Holder());
+ HTMLFrameSetElement* imp = V8HTMLFrameSetElement::toNative(info.Holder());
Node* frameNode = imp->children()->namedItem(v8StringToAtomicWebCoreString(name));
if (frameNode && frameNode->hasTagName(HTMLNames::frameTag)) {
Document* doc = static_cast<HTMLFrameElement*>(frameNode)->contentDocument();
diff --git a/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
index a4863e8..1949632 100644
--- a/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
@@ -29,10 +29,12 @@
*/
#include "config.h"
+#include "V8HTMLIFrameElement.h"
+
#include "HTMLIFrameElement.h"
#include "HTMLNames.h"
-
#include "V8Binding.h"
+#include "V8BindingState.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
@@ -40,12 +42,12 @@ namespace WebCore {
using namespace HTMLNames;
-ACCESSOR_SETTER(HTMLIFrameElementSrc)
+void V8HTMLIFrameElement::srcAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- HTMLIFrameElement* iframe = V8DOMWrapper::convertDOMWrapperToNode<HTMLIFrameElement>(info.Holder());
+ HTMLIFrameElement* iframe = V8HTMLIFrameElement::toNative(info.Holder());
String v = toWebCoreStringWithNullCheck(value);
- if (!allowSettingFrameSrcToJavascriptUrl(iframe, v))
+ if (!V8BindingSecurity::allowSettingFrameSrcToJavascriptUrl(V8BindingState::Only(), iframe, v))
return;
iframe->setAttribute(srcAttr, v);
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
index 71c99cf..57efa34 100644
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
@@ -35,8 +35,8 @@
#include "Document.h"
#include "Frame.h"
#include "HTMLNames.h"
-
#include "V8Binding.h"
+#include "V8HTMLImageElement.h"
#include "V8Proxy.h"
#include <wtf/RefPtr.h>
@@ -53,7 +53,7 @@ v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate(
v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLImageElementConstructor));
v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8Custom::kNodeMinimumInternalFieldCount);
+ instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
result->SetClassName(v8::String::New("HTMLImageElement"));
result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLIMAGEELEMENT));
@@ -61,7 +61,7 @@ v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate(
return cachedTemplate;
}
-CALLBACK_FUNC_DECL(HTMLImageElementConstructor)
+v8::Handle<v8::Value> V8Custom::v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLImageElement.Contructor");
diff --git a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
index 63fbcec..78486b3 100644
--- a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+#include "V8HTMLInputElement.h"
+
#include "HTMLInputElement.h"
#include "V8Binding.h"
@@ -37,11 +39,11 @@
namespace WebCore {
-ACCESSOR_GETTER(HTMLInputElementSelectionStart)
+v8::Handle<v8::Value> V8HTMLInputElement::selectionStartAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLInputElement.selectionStart._get");
v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLInputElement>(holder);
+ HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
if (!imp->canHaveSelection())
return throwError("Accessing selectionStart on an input element that cannot have a selection.");
@@ -50,11 +52,11 @@ ACCESSOR_GETTER(HTMLInputElementSelectionStart)
return v8::Integer::New(v);
}
-ACCESSOR_SETTER(HTMLInputElementSelectionStart)
+void V8HTMLInputElement::selectionStartAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLInputElement.selectionStart._set");
v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLInputElement>(holder);
+ HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
if (!imp->canHaveSelection()) {
throwError("Accessing selectionStart on an input element that cannot have a selection.");
@@ -63,11 +65,11 @@ ACCESSOR_SETTER(HTMLInputElementSelectionStart)
imp->setSelectionStart(value->Int32Value());
}
-ACCESSOR_GETTER(HTMLInputElementSelectionEnd)
+v8::Handle<v8::Value> V8HTMLInputElement::selectionEndAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLInputElement.selectionEnd._get");
v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLInputElement>(holder);
+ HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
if (!imp->canHaveSelection())
return throwError("Accessing selectionEnd on an input element that cannot have a selection.");
@@ -76,11 +78,11 @@ ACCESSOR_GETTER(HTMLInputElementSelectionEnd)
return v8::Integer::New(v);
}
-ACCESSOR_SETTER(HTMLInputElementSelectionEnd)
+void V8HTMLInputElement::selectionEndAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLInputElement.selectionEnd._set");
v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLInputElement>(holder);
+ HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
if (!imp->canHaveSelection()) {
throwError("Accessing selectionEnd on an input element that cannot have a selection.");
@@ -90,11 +92,11 @@ ACCESSOR_SETTER(HTMLInputElementSelectionEnd)
imp->setSelectionEnd(value->Int32Value());
}
-CALLBACK_FUNC_DECL(HTMLInputElementSetSelectionRange)
+v8::Handle<v8::Value> V8HTMLInputElement::setSelectionRangeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLInputElement.setSelectionRange");
v8::Handle<v8::Object> holder = args.Holder();
- HTMLInputElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLInputElement>(holder);
+ HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
if (!imp->canHaveSelection())
return throwError("Calling setSelectionRange on an input element that cannot have a selection.");
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
index f9c9cb4..5325933 100644
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
@@ -36,8 +36,8 @@
#include "Frame.h"
#include "HTMLNames.h"
#include "Text.h"
-
#include "V8Binding.h"
+#include "V8HTMLOptionElement.h"
#include "V8Proxy.h"
#include <wtf/RefPtr.h>
@@ -54,7 +54,7 @@ v8::Persistent<v8::FunctionTemplate> V8HTMLOptionElementConstructor::GetTemplate
v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLOptionElementConstructor));
v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8Custom::kNodeMinimumInternalFieldCount);
+ instance->SetInternalFieldCount(V8HTMLOptionElement::internalFieldCount);
result->SetClassName(v8::String::New("HTMLOptionElement"));
result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLOPTIONELEMENT));
@@ -62,7 +62,7 @@ v8::Persistent<v8::FunctionTemplate> V8HTMLOptionElementConstructor::GetTemplate
return cachedTemplate;
}
-CALLBACK_FUNC_DECL(HTMLOptionElementConstructor)
+v8::Handle<v8::Value> V8Custom::v8HTMLOptionElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLOptionElement.Contructor");
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
index 02c3499..c060df7 100644
--- a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
@@ -29,8 +29,9 @@
*/
#include "config.h"
-#include "HTMLOptionsCollection.h"
+#include "V8HTMLOptionsCollection.h"
+#include "HTMLOptionsCollection.h"
#include "HTMLOptionElement.h"
#include "ExceptionCode.h"
@@ -43,23 +44,23 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(HTMLOptionsCollectionRemove)
+v8::Handle<v8::Value> V8HTMLOptionsCollection::removeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLOptionsCollection.remove()");
- HTMLOptionsCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
+ HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
HTMLSelectElement* base = static_cast<HTMLSelectElement*>(imp->base());
return removeElement(base, args);
}
-CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd)
+v8::Handle<v8::Value> V8HTMLOptionsCollection::addCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLOptionsCollection.add()");
if (!V8HTMLOptionElement::HasInstance(args[0])) {
V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
return v8::Undefined();
}
- HTMLOptionsCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
- HTMLOptionElement* option = V8DOMWrapper::convertDOMWrapperToNode<HTMLOptionElement>(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(args[0])));
+ HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
+ HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(args[0])));
ExceptionCode ec = 0;
if (args.Length() < 2)
@@ -84,18 +85,18 @@ CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd)
return v8::Undefined();
}
-ACCESSOR_GETTER(HTMLOptionsCollectionLength)
+v8::Handle<v8::Value> V8HTMLOptionsCollection::lengthAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLOptionsCollection.length._get");
- HTMLOptionsCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+ HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder());
int v = imp->length();
return v8::Integer::New(v);
}
-ACCESSOR_SETTER(HTMLOptionsCollectionLength)
+void V8HTMLOptionsCollection::lengthAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLOptionsCollection.length._set");
- HTMLOptionsCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+ HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder());
double v = value->NumberValue();
unsigned newLength = 0;
ExceptionCode ec = 0;
@@ -113,10 +114,10 @@ ACCESSOR_SETTER(HTMLOptionsCollectionLength)
V8Proxy::setDOMException(ec);
}
-INDEXED_PROPERTY_GETTER(HTMLOptionsCollection)
+v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertyGetter");
- HTMLOptionsCollection* collection = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+ HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
RefPtr<Node> result = collection->item(index);
if (!result)
@@ -125,10 +126,10 @@ INDEXED_PROPERTY_GETTER(HTMLOptionsCollection)
return V8DOMWrapper::convertNodeToV8Object(result.release());
}
-INDEXED_PROPERTY_SETTER(HTMLOptionsCollection)
+v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertySetter");
- HTMLOptionsCollection* collection = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+ HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
HTMLSelectElement* base = static_cast<HTMLSelectElement*>(collection->base());
return toOptionsCollectionSetter(index, value, base);
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
index 13c82f3..261b5a8 100644
--- a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -32,18 +32,23 @@
#include "HTMLPlugInElement.h"
#include "ScriptInstance.h"
-
#include "V8Binding.h"
#include "V8CustomBinding.h"
+#include "V8HTMLAppletElement.h"
+#include "V8HTMLEmbedElement.h"
+#include "V8HTMLObjectElement.h"
#include "V8NPObject.h"
#include "V8Proxy.h"
namespace WebCore {
-NAMED_PROPERTY_GETTER(HTMLPlugInElement)
+// FIXME: Consider moving getter/setter helpers to V8NPObject and renaming this file to V8PluginElementFunctions
+// to match JSC bindings naming convention.
+
+template <class C>
+static v8::Handle<v8::Value> npObjectNamedGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.HTMLPlugInElement.NamedPropertyGetter");
- HTMLPlugInElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+ HTMLPlugInElement* imp = C::toNative(info.Holder());
ScriptInstance scriptInstance = imp->getInstance();
if (!scriptInstance)
return notHandledByInterceptor();
@@ -55,10 +60,10 @@ NAMED_PROPERTY_GETTER(HTMLPlugInElement)
return npObjectGetNamedProperty(instance, name);
}
-NAMED_PROPERTY_SETTER(HTMLPlugInElement)
+template <class C>
+static v8::Handle<v8::Value> npObjectNamedSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.HTMLPlugInElement.NamedPropertySetter");
- HTMLPlugInElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+ HTMLPlugInElement* imp = C::toNative(info.Holder());
ScriptInstance scriptInstance = imp->getInstance();
if (!scriptInstance)
return notHandledByInterceptor();
@@ -70,16 +75,65 @@ NAMED_PROPERTY_SETTER(HTMLPlugInElement)
return npObjectSetNamedProperty(instance, name, value);
}
-CALLBACK_FUNC_DECL(HTMLPlugInElement)
+v8::Handle<v8::Value> V8HTMLAppletElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLAppletElement.NamedPropertyGetter");
+ return npObjectNamedGetter<V8HTMLAppletElement>(name, info);
+}
+
+v8::Handle<v8::Value> V8HTMLEmbedElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLEmbedElement.NamedPropertyGetter");
+ return npObjectNamedGetter<V8HTMLEmbedElement>(name, info);
+}
+
+v8::Handle<v8::Value> V8HTMLObjectElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLObjectElement.NamedPropertyGetter");
+ return npObjectNamedGetter<V8HTMLObjectElement>(name, info);
+}
+
+v8::Handle<v8::Value> V8HTMLAppletElement::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLAppletElement.NamedPropertySetter");
+ return npObjectNamedSetter<V8HTMLAppletElement>(name, value, info);
+}
+
+v8::Handle<v8::Value> V8HTMLEmbedElement::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLEmbedElement.NamedPropertySetter");
+ return npObjectNamedSetter<V8HTMLEmbedElement>(name, value, info);
+}
+
+v8::Handle<v8::Value> V8HTMLObjectElement::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLObjectElement.NamedPropertySetter");
+ return npObjectNamedSetter<V8HTMLObjectElement>(name, value, info);
+}
+
+v8::Handle<v8::Value> V8HTMLAppletElement::callAsFunctionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.HTMLAppletElement()");
+ return npObjectInvokeDefaultHandler(args);
+}
+
+v8::Handle<v8::Value> V8HTMLEmbedElement::callAsFunctionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.HTMLEmbedElement()");
+ return npObjectInvokeDefaultHandler(args);
+}
+
+v8::Handle<v8::Value> V8HTMLObjectElement::callAsFunctionCallback(const v8::Arguments& args)
{
- INC_STATS("DOM.HTMLPluginElement()");
+ INC_STATS("DOM.HTMLObjectElement()");
return npObjectInvokeDefaultHandler(args);
}
-INDEXED_PROPERTY_GETTER(HTMLPlugInElement)
+template <class C>
+v8::Handle<v8::Value> npObjectIndexedGetter(uint32_t index, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLPlugInElement.IndexedPropertyGetter");
- HTMLPlugInElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+ HTMLPlugInElement* imp = C::toNative(info.Holder());
ScriptInstance scriptInstance = imp->getInstance();
if (!scriptInstance)
return notHandledByInterceptor();
@@ -91,10 +145,11 @@ INDEXED_PROPERTY_GETTER(HTMLPlugInElement)
return npObjectGetIndexedProperty(instance, index);
}
-INDEXED_PROPERTY_SETTER(HTMLPlugInElement)
+template <class C>
+v8::Handle<v8::Value> npObjectIndexedSetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLPlugInElement.IndexedPropertySetter");
- HTMLPlugInElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+ HTMLPlugInElement* imp = C::toNative(info.Holder());
ScriptInstance scriptInstance = imp->getInstance();
if (!scriptInstance)
return notHandledByInterceptor();
@@ -106,4 +161,40 @@ INDEXED_PROPERTY_SETTER(HTMLPlugInElement)
return npObjectSetIndexedProperty(instance, index, value);
}
+v8::Handle<v8::Value> V8HTMLAppletElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLAppletElement.IndexedPropertyGetter");
+ return npObjectIndexedGetter<V8HTMLAppletElement>(index, info);
+}
+
+v8::Handle<v8::Value> V8HTMLEmbedElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLEmbedElement.IndexedPropertyGetter");
+ return npObjectIndexedGetter<V8HTMLEmbedElement>(index, info);
+}
+
+v8::Handle<v8::Value> V8HTMLObjectElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLObjectElement.IndexedPropertyGetter");
+ return npObjectIndexedGetter<V8HTMLObjectElement>(index, info);
+}
+
+v8::Handle<v8::Value> V8HTMLAppletElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLAppletElement.IndexedPropertySetter");
+ return npObjectIndexedSetter<V8HTMLAppletElement>(index, value, info);
+}
+
+v8::Handle<v8::Value> V8HTMLEmbedElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLEmbedElement.IndexedPropertySetter");
+ return npObjectIndexedSetter<V8HTMLEmbedElement>(index, value, info);
+}
+
+v8::Handle<v8::Value> V8HTMLObjectElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLObjectElement.IndexedPropertySetter");
+ return npObjectIndexedSetter<V8HTMLObjectElement>(index, value, info);
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
index 661ffa2..0904b3e 100644
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
@@ -33,25 +33,75 @@
#include "HTMLSelectElement.h"
#include "HTMLOptionElement.h"
+#include "HTMLOptionsCollection.h"
#include "V8Binding.h"
+#include "V8Collection.h"
#include "V8CustomBinding.h"
#include "V8HTMLOptionElement.h"
+#include "V8HTMLSelectElement.h"
+#include "V8NamedNodesCollection.h"
#include "V8Proxy.h"
namespace WebCore {
-CALLBACK_FUNC_DECL(HTMLSelectElementRemove)
+v8::Handle<v8::Value> V8HTMLSelectElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLSelectElement.NamedPropertyGetter");
+ HTMLSelectElement* select = V8HTMLSelectElement::toNative(info.Holder());
+ v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
+
+ if (!value.IsEmpty())
+ return value;
+
+ // Search local callback properties next to find IDL defined properties.
+ if (info.Holder()->HasRealNamedCallbackProperty(name))
+ return notHandledByInterceptor();
+
+ PassRefPtr<HTMLOptionsCollection> collection = select->options();
+
+ Vector<RefPtr<Node> > items;
+ collection->namedItems(v8StringToAtomicWebCoreString(name), items);
+
+ if (!items.size())
+ return notHandledByInterceptor();
+
+ if (items.size() == 1)
+ return V8DOMWrapper::convertNodeToV8Object(items.at(0).release());
+
+ NodeList* list = new V8NamedNodesCollection(items);
+ return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
+}
+
+v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
+{
+ ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
+ ASSERT(V8DOMWrapper::domWrapperType(info.Holder()) == V8ClassIndex::NODE);
+ RefPtr<Node> result = V8HTMLSelectElement::toNative(info.Holder())->item(index);
+ if (!result)
+ return notHandledByInterceptor();
+
+ return V8DOMWrapper::convertNodeToV8Object(result.release());
+}
+
+v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLSelectElement.IndexedPropertySetter");
+ HTMLSelectElement* select = V8HTMLSelectElement::toNative(info.Holder());
+ return toOptionsCollectionSetter(index, value, select);
+}
+
+v8::Handle<v8::Value> V8HTMLSelectElement::removeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLSelectElement.remove");
- HTMLSelectElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(args.Holder());
+ HTMLSelectElement* imp = V8HTMLSelectElement::toNative(args.Holder());
return removeElement(imp, args);
}
v8::Handle<v8::Value> removeElement(HTMLSelectElement* imp, const v8::Arguments& args)
{
if (V8HTMLOptionElement::HasInstance(args[0])) {
- HTMLOptionElement* element = V8DOMWrapper::convertDOMWrapperToNode<HTMLOptionElement>(v8::Handle<v8::Object>::Cast(args[0]));
+ HTMLOptionElement* element = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>::Cast(args[0]));
imp->remove(element->index());
return v8::Undefined();
}
diff --git a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
index c884d15..b857d6e 100644
--- a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
@@ -29,18 +29,21 @@
*/
#include "config.h"
-#include "History.h"
+#include "V8History.h"
#include "ExceptionCode.h"
+#include "History.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
+#include "V8BindingState.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
-CALLBACK_FUNC_DECL(HistoryPushState)
+
+v8::Handle<v8::Value> V8History::pushStateCallback(const v8::Arguments& args)
{
- RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(toWebCoreString(args[0]));
+ RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0]);
v8::TryCatch tryCatch;
String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
@@ -54,14 +57,14 @@ CALLBACK_FUNC_DECL(HistoryPushState)
}
ExceptionCode ec = 0;
- History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, args.Holder());
+ History* history = V8History::toNative(args.Holder());
history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
return throwError(ec);
}
-CALLBACK_FUNC_DECL(HistoryReplaceState)
+v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args)
{
- RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(toWebCoreString(args[0]));
+ RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0]);
v8::TryCatch tryCatch;
String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
@@ -75,9 +78,25 @@ CALLBACK_FUNC_DECL(HistoryReplaceState)
}
ExceptionCode ec = 0;
- History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, args.Holder());
+ History* history = V8History::toNative(args.Holder());
history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
return throwError(ec);
}
+bool V8History::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
+{
+ ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
+ // Only allow same origin access.
+ History* history = V8History::toNative(host);
+ return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false);
+}
+
+bool V8History::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
+{
+ ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
+ // Only allow same origin access.
+ History* history = V8History::toNative(host);
+ return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false);
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8XPathEvaluatorConstructor.cpp b/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp
index 69a8635..5ee9542 100644
--- a/WebCore/bindings/v8/custom/V8XPathEvaluatorConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -29,17 +29,21 @@
*/
#include "config.h"
-#include "XPathEvaluator.h"
+#include "V8IDBRequest.h"
-#include "V8Binding.h"
+#include "SerializedScriptValue.h"
#include "V8Proxy.h"
namespace WebCore {
-CALLBACK_FUNC_DECL(XPathEvaluatorConstructor)
+v8::Handle<v8::Value> V8IDBRequest::resultAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.XPathEvaluator.Constructor");
- return V8Proxy::constructDOMObject<V8ClassIndex::XPATHEVALUATOR, XPathEvaluator>(args);
+ IDBRequest* request = V8IDBRequest::toNative(info.Holder());
+ SerializedScriptValue* result = request->result();
+ if (!result)
+ return v8::Null();
+
+ return result->deserialize();
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8ClientRectListCustom.cpp b/WebCore/bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp
index 3c62e14..66220ea 100644
--- a/WebCore/bindings/v8/custom/V8ClientRectListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,27 +29,29 @@
*/
#include "config.h"
-#include "ClientRectList.h"
-
-#include "ClientRect.h"
+#include "V8IndexedDatabaseRequest.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
-#include <wtf/RefPtr.h>
-
namespace WebCore {
-INDEXED_PROPERTY_GETTER(ClientRectList)
+v8::Handle<v8::Value> V8IndexedDatabaseRequest::openCallback(const v8::Arguments& args)
{
- INC_STATS("DOM.ClientRectList.IndexedPropertyGetter");
- ClientRectList* imp = V8DOMWrapper::convertToNativeObject<ClientRectList>(V8ClassIndex::CLIENTRECTLIST, info.Holder());
- RefPtr<ClientRect> result = imp->item(index);
- if (!result)
- return notHandledByInterceptor();
-
- return V8DOMWrapper::convertToV8Object(V8ClassIndex::CLIENTRECT, result.release());
+ IndexedDatabaseRequest* imp = V8IndexedDatabaseRequest::toNative(args.Holder());
+ if (args.Length() < 2)
+ return throwError(V8Proxy::TypeError);
+ V8Parameter<> name = args[0];
+ V8Parameter<> description = args[1];
+ bool modifyDatabase = true;
+ if (args.Length() > 2)
+ modifyDatabase = args[2]->BooleanValue();
+
+ ExceptionCode ec = 0;
+ imp->open(name, description, modifyDatabase, ec);
+ if (ec)
+ return throwError(ec);
+ return v8::Handle<v8::Value>();
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index fac6733..0ddcf97 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -29,45 +29,98 @@
*/
#include "config.h"
-#include "InjectedScriptHost.h"
+#include "V8InjectedScriptHost.h"
-#include "Database.h"
#include "DOMWindow.h"
+#include "Database.h"
#include "Frame.h"
+#include "InjectedScriptHost.h"
#include "InspectorController.h"
#include "Node.h"
#include "Page.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
+#include "V8Database.h"
+#include "V8Node.h"
#include "V8Proxy.h"
+#include "V8Storage.h"
namespace WebCore {
-CALLBACK_FUNC_DECL(InjectedScriptHostInspectedWindow)
+static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter)
{
- INC_STATS("InjectedScriptHost.inspectedWindow()");
+ InjectedScriptHost* nativeObject = static_cast<InjectedScriptHost*>(parameter);
+ nativeObject->deref();
+ object.Dispose();
+}
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
- InspectorController* ic = host->inspectorController();
- if (!ic)
- return v8::Undefined();
- return V8DOMWrapper::convertToV8Object<DOMWindow>(V8ClassIndex::DOMWINDOW, ic->inspectedPage()->mainFrame()->domWindow());
+static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(InjectedScriptHost* host)
+{
+ V8ClassIndex::V8WrapperType descriptorType = V8ClassIndex::INJECTEDSCRIPTHOST;
+ v8::Local<v8::Function> function = V8DOMWrapper::getTemplate(descriptorType)->GetFunction();
+ if (function.IsEmpty()) {
+ // Return if allocation failed.
+ return v8::Local<v8::Object>();
+ }
+ v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
+ if (instance.IsEmpty()) {
+ // Avoid setting the wrapper if allocation failed.
+ return v8::Local<v8::Object>();
+ }
+ V8DOMWrapper::setDOMWrapper(instance, V8ClassIndex::ToInt(descriptorType), host);
+ // Create a weak reference to the v8 wrapper of InspectorBackend to deref
+ // InspectorBackend when the wrapper is garbage collected.
+ host->ref();
+ v8::Persistent<v8::Object> weakHandle = v8::Persistent<v8::Object>::New(instance);
+ weakHandle.MakeWeak(host, &WeakReferenceCallback);
+ return instance;
}
-CALLBACK_FUNC_DECL(InjectedScriptHostWrapCallback)
+static ScriptObject createInjectedScript(const String& scriptSource, InjectedScriptHost* injectedScriptHost, ScriptState* inspectedScriptState, long id)
{
- INC_STATS("InjectedScriptHost.wrapCallback()");
- return args[0];
+ v8::HandleScope scope;
+
+ v8::Local<v8::Context> inspectedContext = inspectedScriptState->context();
+ v8::Context::Scope contextScope(inspectedContext);
+
+ // Call custom code to create InjectedScripHost wrapper specific for the context
+ // instead of calling V8DOMWrapper::convertToV8Object that would create the
+ // wrapper in the current context.
+ // FIXME: make it possible to use generic bindings factory for InjectedScriptHost.
+ v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper(injectedScriptHost);
+ if (scriptHostWrapper.IsEmpty())
+ return ScriptObject();
+
+ v8::Local<v8::Object> windowGlobal = inspectedContext->Global();
+
+ // Inject javascript into the context. The compiled script is supposed to evaluate into
+ // a single anonymous function(it's anonymous to avoid cluttering the global object with
+ // inspector's stuff) the function is called a few lines below with InjectedScriptHost wrapper,
+ // injected script id and explicit reference to the inspected global object. The function is expected
+ // to create and configure InjectedScript instance that is going to be used by the inspector.
+ v8::Local<v8::Script> script = v8::Script::Compile(v8String(scriptSource));
+ v8::Local<v8::Value> v = script->Run();
+ ASSERT(!v.IsEmpty());
+ ASSERT(v->IsFunction());
+
+ v8::Handle<v8::Value> args[] = {
+ scriptHostWrapper,
+ windowGlobal,
+ v8::Number::New(id)
+ };
+ v8::Local<v8::Value> injectedScriptValue = v8::Function::Cast(*v)->Call(windowGlobal, 3, args);
+ v8::Local<v8::Object> injectedScript(v8::Object::Cast(*injectedScriptValue));
+ return ScriptObject(inspectedScriptState, injectedScript);
}
-CALLBACK_FUNC_DECL(InjectedScriptHostNodeForId)
+v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Arguments& args)
{
INC_STATS("InjectedScriptHost.nodeForId()");
if (args.Length() < 1)
return v8::Undefined();
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
Node* node = host->nodeForId(args[0]->ToInt32()->Value());
if (!node)
@@ -80,63 +133,44 @@ CALLBACK_FUNC_DECL(InjectedScriptHostNodeForId)
return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node);
}
-CALLBACK_FUNC_DECL(InjectedScriptHostWrapObject)
-{
- INC_STATS("InjectedScriptHost.wrapObject()");
- if (args.Length() < 2)
- return v8::Undefined();
-
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
- return host->wrapObject(ScriptValue(args[0]), toWebCoreStringWithNullCheck(args[1])).v8Value();
-}
-
-CALLBACK_FUNC_DECL(InjectedScriptHostUnwrapObject)
-{
- INC_STATS("InjectedScriptHost.unwrapObject()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
- return host->unwrapObject(toWebCoreStringWithNullCheck(args[0])).v8Value();
-}
-
-CALLBACK_FUNC_DECL(InjectedScriptHostPushNodePathToFrontend)
+v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const v8::Arguments& args)
{
INC_STATS("InjectedScriptHost.pushNodePathToFrontend()");
- if (args.Length() < 2)
+ if (args.Length() < 3)
return v8::Undefined();
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
- Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0]));
- bool selectInUI = args[1]->ToBoolean()->Value();
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ Node* node = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ bool withChildren = args[1]->ToBoolean()->Value();
+ bool selectInUI = args[2]->ToBoolean()->Value();
if (node)
- return v8::Number::New(host->pushNodePathToFrontend(node, selectInUI));
+ return v8::Number::New(host->pushNodePathToFrontend(node, withChildren, selectInUI));
return v8::Undefined();
}
#if ENABLE(DATABASE)
-CALLBACK_FUNC_DECL(InjectedScriptHostDatabaseForId)
+v8::Handle<v8::Value> V8InjectedScriptHost::databaseForIdCallback(const v8::Arguments& args)
{
INC_STATS("InjectedScriptHost.databaseForId()");
if (args.Length() < 1)
return v8::Undefined();
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
Database* database = host->databaseForId(args[0]->ToInt32()->Value());
if (!database)
return v8::Undefined();
return V8DOMWrapper::convertToV8Object<Database>(V8ClassIndex::DATABASE, database);
}
-CALLBACK_FUNC_DECL(InjectedScriptHostSelectDatabase)
+v8::Handle<v8::Value> V8InjectedScriptHost::selectDatabaseCallback(const v8::Arguments& args)
{
INC_STATS("InjectedScriptHost.selectDatabase()");
if (args.Length() < 1)
return v8::Undefined();
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
- Database* database = V8DOMWrapper::convertToNativeObject<Database>(V8ClassIndex::DATABASE, v8::Handle<v8::Object>::Cast(args[0]));
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(args[0]));
if (database)
host->selectDatabase(database);
@@ -145,14 +179,14 @@ CALLBACK_FUNC_DECL(InjectedScriptHostSelectDatabase)
#endif
#if ENABLE(DOM_STORAGE)
-CALLBACK_FUNC_DECL(InjectedScriptHostSelectDOMStorage)
+v8::Handle<v8::Value> V8InjectedScriptHost::selectDOMStorageCallback(const v8::Arguments& args)
{
INC_STATS("InjectedScriptHost.selectDOMStorage()");
if (args.Length() < 1)
return v8::Undefined();
- InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScriptHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder());
- Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, v8::Handle<v8::Object>::Cast(args[0]));
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(args[0]));
if (storage)
host->selectDOMStorage(storage);
@@ -160,4 +194,28 @@ CALLBACK_FUNC_DECL(InjectedScriptHostSelectDOMStorage)
}
#endif
+ScriptObject InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState)
+{
+ v8::HandleScope handleScope;
+ v8::Local<v8::Context> context = inspectedScriptState->context();
+ v8::Context::Scope contextScope(context);
+
+ v8::Local<v8::Object> global = context->Global();
+ // Skip proxy object. The proxy object will survive page navigation while we need
+ // an object whose lifetime consides with that of the inspected context.
+ global = v8::Local<v8::Object>::Cast(global->GetPrototype());
+
+ v8::Local<v8::String> key = v8::String::New("Devtools_InjectedScript");
+ v8::Local<v8::Value> val = global->GetHiddenValue(key);
+ if (!val.IsEmpty() && val->IsObject())
+ return ScriptObject(inspectedScriptState, v8::Local<v8::Object>::Cast(val));
+
+ ASSERT(!m_injectedScriptSource.isEmpty());
+ ScriptObject injectedScriptObject = createInjectedScript(m_injectedScriptSource, this, inspectedScriptState, m_nextInjectedScriptId);
+ m_idToInjectedScript.set(m_nextInjectedScriptId, injectedScriptObject);
+ ++m_nextInjectedScriptId;
+ global->SetHiddenValue(key, injectedScriptObject.v8Object());
+ return injectedScriptObject;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
index 15b45e9..df63bf1 100644
--- a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
@@ -29,15 +29,10 @@
*/
#include "config.h"
-#include "InspectorFrontendHost.h"
+#include "V8InspectorFrontendHost.h"
-#include "ExceptionCode.h"
#include "InspectorController.h"
-#include "Node.h"
-#include "Range.h"
-#include "Page.h"
-#include "TextIterator.h"
-#include "VisiblePosition.h"
+#include "InspectorFrontendHost.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
@@ -45,46 +40,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(InspectorFrontendHostSearch)
-{
- INC_STATS("InspectorFrontendHost.search()");
-
- if (args.Length() < 2)
- return v8::Undefined();
-
- Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0]));
- if (!node)
- return v8::Undefined();
-
- String target = toWebCoreStringWithNullCheck(args[1]);
- if (target.isEmpty())
- return v8::Undefined();
-
- v8::Local<v8::Array> result = v8::Array::New();
- RefPtr<Range> searchRange(rangeOfContents(node));
-
- ExceptionCode ec = 0;
- int index = 0;
- do {
- RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, false));
- if (resultRange->collapsed(ec))
- break;
-
- // A non-collapsed result range can in some funky whitespace cases still not
- // advance the range's start position (4509328). Break to avoid infinite loop.
- VisiblePosition newStart = endVisiblePosition(resultRange.get(), DOWNSTREAM);
- if (newStart == startVisiblePosition(searchRange.get(), DOWNSTREAM))
- break;
-
- result->Set(v8::Number::New(index++), V8DOMWrapper::convertToV8Object(V8ClassIndex::RANGE, resultRange.release()));
-
- setStart(searchRange.get(), newStart);
- } while (true);
-
- return result;
-}
-
-CALLBACK_FUNC_DECL(InspectorFrontendHostShowContextMenu)
+v8::Handle<v8::Value> V8InspectorFrontendHost::showContextMenuCallback(const v8::Arguments& args)
{
return v8::Undefined();
}
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index 1ed4c51..ce816b6 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -29,23 +29,24 @@
*/
#include "config.h"
-#include "Location.h"
+#include "V8Location.h"
+#include "CSSHelper.h"
+#include "Document.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "KURL.h"
+#include "Location.h"
+#include "PlatformString.h"
+#include "ScriptController.h"
#include "V8Binding.h"
+#include "V8BindingState.h"
#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8Location.h"
#include "V8Utilities.h"
#include "V8Proxy.h"
-#include "PlatformString.h"
-#include "KURL.h"
-#include "Document.h"
-#include "FrameLoader.h"
-#include "ScriptController.h"
-#include "CSSHelper.h"
-#include "Frame.h"
-
namespace WebCore {
// Notes about V8/JSC porting of this file.
@@ -58,11 +59,11 @@ namespace WebCore {
// we're just making all these custom for now. The functionality is simple
// and mirrors JSLocationCustom.cpp.
-ACCESSOR_SETTER(LocationHash)
+void V8Location::hashAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.hash._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
String hash = toWebCoreString(value);
Frame* frame = imp->frame();
@@ -81,11 +82,11 @@ ACCESSOR_SETTER(LocationHash)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_SETTER(LocationHost)
+void V8Location::hostAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.host._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
String host = toWebCoreString(value);
Frame* frame = imp->frame();
@@ -101,11 +102,11 @@ ACCESSOR_SETTER(LocationHost)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_SETTER(LocationHostname)
+void V8Location::hostnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.hostname._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
String hostname = toWebCoreString(value);
Frame* frame = imp->frame();
@@ -118,11 +119,11 @@ ACCESSOR_SETTER(LocationHostname)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_SETTER(LocationHref)
+void V8Location::hrefAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.href._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
Frame* frame = imp->frame();
if (!frame)
@@ -138,11 +139,11 @@ ACCESSOR_SETTER(LocationHref)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_SETTER(LocationPathname)
+void V8Location::pathnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.pathname._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
String pathname = toWebCoreString(value);
Frame* frame = imp->frame();
@@ -155,11 +156,11 @@ ACCESSOR_SETTER(LocationPathname)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_SETTER(LocationPort)
+void V8Location::portAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.port._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
String port = toWebCoreString(value);
Frame* frame = imp->frame();
@@ -172,11 +173,11 @@ ACCESSOR_SETTER(LocationPort)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_SETTER(LocationProtocol)
+void V8Location::protocolAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.protocol._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
String protocol = toWebCoreString(value);
Frame* frame = imp->frame();
@@ -189,11 +190,11 @@ ACCESSOR_SETTER(LocationProtocol)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_SETTER(LocationSearch)
+void V8Location::searchAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.search._set");
v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
String query = toWebCoreString(value);
Frame* frame = imp->frame();
@@ -206,68 +207,68 @@ ACCESSOR_SETTER(LocationSearch)
navigateIfAllowed(frame, url, false, false);
}
-ACCESSOR_GETTER(LocationReload)
+v8::Handle<v8::Value> V8Location::reloadAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.reload._get");
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
+ static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
return privateTemplate->GetFunction();
}
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
- if (!V8Proxy::canAccessFrame(imp->frame(), false)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
+ Location* imp = V8Location::toNative(holder);
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) {
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
return sharedTemplate->GetFunction();
- } else
- return privateTemplate->GetFunction();
+ }
+ return privateTemplate->GetFunction();
}
-ACCESSOR_GETTER(LocationReplace)
+v8::Handle<v8::Value> V8Location::replaceAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.replace._get");
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReplaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
+ static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
return privateTemplate->GetFunction();
}
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
- if (!V8Proxy::canAccessFrame(imp->frame(), false)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReplaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
+ Location* imp = V8Location::toNative(holder);
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) {
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
return sharedTemplate->GetFunction();
- } else
- return privateTemplate->GetFunction();
+ }
+ return privateTemplate->GetFunction();
}
-ACCESSOR_GETTER(LocationAssign)
+v8::Handle<v8::Value> V8Location::assignAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Location.assign._get");
static v8::Persistent<v8::FunctionTemplate> privateTemplate =
- v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationAssignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
+ v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
return privateTemplate->GetFunction();
}
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
- if (!V8Proxy::canAccessFrame(imp->frame(), false)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationAssignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
+ Location* imp = V8Location::toNative(holder);
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) {
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
return sharedTemplate->GetFunction();
- } else
- return privateTemplate->GetFunction();
+ }
+ return privateTemplate->GetFunction();
}
-CALLBACK_FUNC_DECL(LocationReload)
+v8::Handle<v8::Value> V8Location::reloadCallback(const v8::Arguments& args)
{
// FIXME: we ignore the "forceget" parameter.
INC_STATS("DOM.Location.reload");
v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
Frame* frame = imp->frame();
if (!frame || !ScriptController::isSafeScript(frame))
@@ -278,11 +279,11 @@ CALLBACK_FUNC_DECL(LocationReload)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(LocationReplace)
+v8::Handle<v8::Value> V8Location::replaceCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Location.replace");
v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
Frame* frame = imp->frame();
if (!frame)
@@ -299,11 +300,11 @@ CALLBACK_FUNC_DECL(LocationReplace)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(LocationAssign)
+v8::Handle<v8::Value> V8Location::assignCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Location.assign");
v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+ Location* imp = V8Location::toNative(holder);
Frame* frame = imp->frame();
if (!frame)
@@ -320,7 +321,7 @@ CALLBACK_FUNC_DECL(LocationAssign)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(LocationValueOf)
+v8::Handle<v8::Value> V8Location::valueOfCallback(const v8::Arguments& args)
{
// Just return the this object the way the normal valueOf function
// on the Object prototype would. The valueOf function is only
@@ -330,31 +331,31 @@ CALLBACK_FUNC_DECL(LocationValueOf)
return args.This();
}
-CALLBACK_FUNC_DECL(LocationToString)
+v8::Handle<v8::Value> V8Location::toStringCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Location.toString");
v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
- if (!V8Proxy::canAccessFrame(imp->frame(), true))
+ Location* imp = V8Location::toNative(holder);
+ if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return v8::Undefined();
String result = imp->href();
return v8String(result);
}
-INDEXED_ACCESS_CHECK(Location)
+bool V8Location::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::LOCATION);
// Only allow same origin access
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, host);
- return V8Proxy::canAccessFrame(imp->frame(), false);
+ Location* imp = V8Location::toNative(host);
+ return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false);
}
-NAMED_ACCESS_CHECK(Location)
+bool V8Location::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::LOCATION);
// Only allow same origin access
- Location* imp = V8DOMWrapper::convertToNativeObject<Location>(V8ClassIndex::LOCATION, host);
- return V8Proxy::canAccessFrame(imp->frame(), false);
+ Location* imp = V8Location::toNative(host);
+ return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
index ca02b16..3ea8e26 100644
--- a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
@@ -29,13 +29,13 @@
*/
#include "config.h"
-#include "MessageChannel.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
+#include "V8MessageChannel.h"
#include "Document.h"
#include "Frame.h"
+#include "MessageChannel.h"
+#include "V8Binding.h"
+#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
@@ -44,7 +44,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(MessageChannelConstructor)
+v8::Handle<v8::Value> V8MessageChannel::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MessageChannel.Constructor");
// FIXME: The logic here is almost exact duplicate of V8::constructDOMObject.
@@ -66,8 +66,8 @@ CALLBACK_FUNC_DECL(MessageChannelConstructor)
// Create references from the MessageChannel wrapper to the two
// MessagePort wrappers to make sure that the MessagePort wrappers
// stay alive as long as the MessageChannel wrapper is around.
- messageChannel->SetInternalField(kMessageChannelPort1Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1()));
- messageChannel->SetInternalField(kMessageChannelPort2Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2()));
+ messageChannel->SetInternalField(V8MessageChannel::port1Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1()));
+ messageChannel->SetInternalField(V8MessageChannel::port2Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2()));
// Setup the standard wrapper object internal fields.
V8DOMWrapper::setDOMWrapper(messageChannel, V8ClassIndex::MESSAGECHANNEL, obj.get());
diff --git a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
index c5af635..9e40855 100644
--- a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+#include "V8MessageEvent.h"
+
#include "MessageEvent.h"
#include "SerializedScriptValue.h"
@@ -40,10 +42,10 @@
namespace WebCore {
-ACCESSOR_GETTER(MessageEventPorts)
+v8::Handle<v8::Value> V8MessageEvent::portsAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.MessageEvent.ports");
- MessageEvent* event = V8DOMWrapper::convertToNativeObject<MessageEvent>(V8ClassIndex::MESSAGEEVENT, info.Holder());
+ MessageEvent* event = V8MessageEvent::toNative(info.Holder());
MessagePortArray* ports = event->ports();
if (!ports || ports->isEmpty())
@@ -56,17 +58,24 @@ ACCESSOR_GETTER(MessageEventPorts)
return portArray;
}
-CALLBACK_FUNC_DECL(MessageEventInitMessageEvent)
+v8::Handle<v8::Value> V8MessageEvent::initMessageEventCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MessageEvent.initMessageEvent");
- MessageEvent* event = V8DOMWrapper::convertToNativeObject<MessageEvent>(V8ClassIndex::MESSAGEEVENT, args.Holder());
+ MessageEvent* event = V8MessageEvent::toNative(args.Holder());
String typeArg = v8ValueToWebCoreString(args[0]);
bool canBubbleArg = args[1]->BooleanValue();
bool cancelableArg = args[2]->BooleanValue();
- RefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(v8ValueToWebCoreString(args[3]));
+ RefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(args[3]);
String originArg = v8ValueToWebCoreString(args[4]);
String lastEventIdArg = v8ValueToWebCoreString(args[5]);
- DOMWindow* sourceArg = V8DOMWindow::HasInstance(args[6]) ? V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, v8::Handle<v8::Object>::Cast(args[6])) : 0;
+
+ DOMWindow* sourceArg = 0;
+ if (args[6]->IsObject()) {
+ v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(args[6]);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, wrapper);
+ if (!window.IsEmpty())
+ sourceArg = V8DOMWindow::toNative(window);
+ }
OwnPtr<MessagePortArray> portArray;
if (!isUndefinedOrNull(args[7])) {
diff --git a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp b/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
index 0d8631f..cc70bc5 100644
--- a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
@@ -43,42 +43,42 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(MessagePortAddEventListener)
+v8::Handle<v8::Value> V8MessagePort::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MessagePort.addEventListener()");
- MessagePort* messagePort = V8DOMWrapper::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args.Holder());
+ MessagePort* messagePort = V8MessagePort::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(messagePort, args[1], false, ListenerFindOrCreate);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
messagePort->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kMessagePortRequestCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(MessagePortRemoveEventListener)
+v8::Handle<v8::Value> V8MessagePort::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MessagePort.removeEventListener()");
- MessagePort* messagePort = V8DOMWrapper::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args.Holder());
+ MessagePort* messagePort = V8MessagePort::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(messagePort, args[1], false, ListenerFindOnly);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
messagePort->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kMessagePortRequestCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(MessagePortPostMessage)
+v8::Handle<v8::Value> V8MessagePort::postMessageCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MessagePort.postMessage");
- MessagePort* messagePort = V8DOMWrapper::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args.Holder());
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(toWebCoreString(args[0]));
+ MessagePort* messagePort = V8MessagePort::toNative(args.Holder());
+ RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0]);
MessagePortArray portArray;
if (args.Length() > 1) {
if (!getMessagePortArray(args[1], portArray))
@@ -129,7 +129,7 @@ bool getMessagePortArray(v8::Local<v8::Value> value, MessagePortArray& portArray
throwError("MessagePortArray argument must contain only MessagePorts");
return false;
}
- portArray[i] = V8DOMWrapper::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, v8::Handle<v8::Object>::Cast(port));
+ portArray[i] = V8MessagePort::toNative(v8::Handle<v8::Object>::Cast(port));
}
return true;
}
diff --git a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
index afa90b7..c7fff5a 100644
--- a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
@@ -29,8 +29,9 @@
*/
#include "config.h"
-#include "NamedNodeMap.h"
+#include "V8NamedNodeMap.h"
+#include "NamedNodeMap.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
@@ -39,10 +40,10 @@
namespace WebCore {
-INDEXED_PROPERTY_GETTER(NamedNodeMap)
+v8::Handle<v8::Value> V8NamedNodeMap::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
{
INC_STATS("DOM.NamedNodeMap.IndexedPropertyGetter");
- NamedNodeMap* imp = V8DOMWrapper::convertToNativeObject<NamedNodeMap>(V8ClassIndex::NAMEDNODEMAP, info.Holder());
+ NamedNodeMap* imp = V8NamedNodeMap::toNative(info.Holder());
RefPtr<Node> result = imp->item(index);
if (!result)
return notHandledByInterceptor();
@@ -50,7 +51,7 @@ INDEXED_PROPERTY_GETTER(NamedNodeMap)
return V8DOMWrapper::convertNodeToV8Object(result.release());
}
-NAMED_PROPERTY_GETTER(NamedNodeMap)
+v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.NamedNodeMap.NamedPropertyGetter");
// Search the prototype chain first.
@@ -63,7 +64,7 @@ NAMED_PROPERTY_GETTER(NamedNodeMap)
return notHandledByInterceptor();
// Finally, search the DOM.
- NamedNodeMap* imp = V8DOMWrapper::convertToNativeObject<NamedNodeMap>(V8ClassIndex::NAMEDNODEMAP, info.Holder());
+ NamedNodeMap* imp = V8NamedNodeMap::toNative(info.Holder());
RefPtr<Node> result = imp->getNamedItem(toWebCoreString(name));
if (!result)
return notHandledByInterceptor();
diff --git a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
index 6a7b209..266745d 100644
--- a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
@@ -1,10 +1,10 @@
/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
- *
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -29,20 +29,17 @@
*/
#include "config.h"
-#include "Navigator.h"
+#include "V8Navigator.h"
-#include "V8Binding.h"
-#include "V8CustomBinding.h"
-#include "V8Proxy.h"
+#include "RuntimeEnabledFeatures.h"
namespace WebCore {
-ACCESSOR_GETTER(NavigatorAppVersion)
+#if ENABLE(GEOLOCATION)
+bool V8Navigator::GeolocationEnabled()
{
- INC_STATS("DOM.Navigator.appVersion");
- v8::Handle<v8::Object> holder = info.Holder();
- Navigator* navigator = V8DOMWrapper::convertToNativeObject<Navigator>(V8ClassIndex::NAVIGATOR, holder);
- return v8StringOrUndefined(navigator->appVersion());
+ return RuntimeEnabledFeatures::geolocationEnabled();
}
+#endif
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
index 9b4b9aa..79afbe8 100644
--- a/WebCore/bindings/v8/custom/V8NodeCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
@@ -45,25 +45,25 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(NodeAddEventListener)
+v8::Handle<v8::Value> V8Node::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Node.addEventListener()");
- Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(args.Holder());
+ Node* node = V8Node::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(node, args[1], false, ListenerFindOrCreate);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
node->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kNodeEventListenerCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(NodeRemoveEventListener)
+v8::Handle<v8::Value> V8Node::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Node.removeEventListener()");
- Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(args.Holder());
+ Node* node = V8Node::toNative(args.Holder());
// It is possbile that the owner document of the node is detached
// from the frame.
@@ -73,21 +73,21 @@ CALLBACK_FUNC_DECL(NodeRemoveEventListener)
AtomicString type = v8ValueToAtomicWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
node->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kNodeEventListenerCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
// This function is customized to take advantage of the optional 4th argument: shouldLazyAttach
-CALLBACK_FUNC_DECL(NodeInsertBefore)
+v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Node.insertBefore");
v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8DOMWrapper::convertDOMWrapperToNode<Node>(holder);
+ Node* imp = V8Node::toNative(holder);
ExceptionCode ec = 0;
- Node* newChild = V8Node::HasInstance(args[0]) ? V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- Node* refChild = V8Node::HasInstance(args[1]) ? V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[1])) : 0;
+ Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ Node* refChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
bool success = imp->insertBefore(newChild, refChild, ec, true);
if (ec) {
V8Proxy::setDOMException(ec);
@@ -99,14 +99,14 @@ CALLBACK_FUNC_DECL(NodeInsertBefore)
}
// This function is customized to take advantage of the optional 4th argument: shouldLazyAttach
-CALLBACK_FUNC_DECL(NodeReplaceChild)
+v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Node.replaceChild");
v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8DOMWrapper::convertDOMWrapperToNode<Node>(holder);
+ Node* imp = V8Node::toNative(holder);
ExceptionCode ec = 0;
- Node* newChild = V8Node::HasInstance(args[0]) ? V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- Node* oldChild = V8Node::HasInstance(args[1]) ? V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[1])) : 0;
+ Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ Node* oldChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
bool success = imp->replaceChild(newChild, oldChild, ec, true);
if (ec) {
V8Proxy::setDOMException(ec);
@@ -117,13 +117,13 @@ CALLBACK_FUNC_DECL(NodeReplaceChild)
return v8::Null();
}
-CALLBACK_FUNC_DECL(NodeRemoveChild)
+v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Node.removeChild");
v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8DOMWrapper::convertDOMWrapperToNode<Node>(holder);
+ Node* imp = V8Node::toNative(holder);
ExceptionCode ec = 0;
- Node* oldChild = V8Node::HasInstance(args[0]) ? V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ Node* oldChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
bool success = imp->removeChild(oldChild, ec);
if (ec) {
V8Proxy::setDOMException(ec);
@@ -135,13 +135,13 @@ CALLBACK_FUNC_DECL(NodeRemoveChild)
}
// This function is customized to take advantage of the optional 4th argument: shouldLazyAttach
-CALLBACK_FUNC_DECL(NodeAppendChild)
+v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Node.appendChild");
v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8DOMWrapper::convertDOMWrapperToNode<Node>(holder);
+ Node* imp = V8Node::toNative(holder);
ExceptionCode ec = 0;
- Node* newChild = V8Node::HasInstance(args[0]) ? V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
bool success = imp->appendChild(newChild, ec, true );
if (ec) {
V8Proxy::setDOMException(ec);
diff --git a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp b/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
index 8839420..032900c 100644
--- a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
@@ -29,9 +29,10 @@
*/
#include "config.h"
-#include "NodeFilter.h"
+#include "V8NodeFilter.h"
#include "ExceptionCode.h"
+#include "NodeFilter.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
@@ -39,7 +40,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(NodeFilterAcceptNode)
+v8::Handle<v8::Value> V8NodeFilter::acceptNodeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.NodeFilter.acceptNode()");
return throwError(NOT_SUPPORTED_ERR);
diff --git a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
index 47ae8ee..074eac3 100644
--- a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
@@ -29,8 +29,9 @@
*/
#include "config.h"
-#include "NodeIterator.h"
+#include "V8NodeIterator.h"
+#include "NodeIterator.h"
#include "ScriptState.h"
#include "V8Binding.h"
@@ -56,24 +57,24 @@ static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ExceptionCode
return V8DOMWrapper::convertNodeToV8Object(object);
}
-CALLBACK_FUNC_DECL(NodeIteratorNextNode)
+v8::Handle<v8::Value> V8NodeIterator::nextNodeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.NodeIterator.nextNode()");
- NodeIterator* nodeIterator = V8DOMWrapper::convertToNativeObject<NodeIterator>(V8ClassIndex::NODEITERATOR, args.Holder());
+ NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
ExceptionCode ec = 0;
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = nodeIterator->nextNode(&state, ec);
return toV8(result.release(), ec, &state);
}
-CALLBACK_FUNC_DECL(NodeIteratorPreviousNode)
+v8::Handle<v8::Value> V8NodeIterator::previousNodeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.NodeIterator.previousNode()");
- NodeIterator* nodeIterator = V8DOMWrapper::convertToNativeObject<NodeIterator>(V8ClassIndex::NODEITERATOR, args.Holder());
+ NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
ExceptionCode ec = 0;
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = nodeIterator->previousNode(&state, ec);
return toV8(result.release(), ec, &state);
}
diff --git a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
index ad10952..5721a7e 100644
--- a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+#include "V8NodeList.h"
+
#include "NodeList.h"
#include "V8Binding.h"
@@ -40,10 +42,10 @@
namespace WebCore {
-NAMED_PROPERTY_GETTER(NodeList)
+v8::Handle<v8::Value> V8NodeList::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.NodeList.NamedPropertyGetter");
- NodeList* list = V8DOMWrapper::convertToNativeObject<NodeList>(V8ClassIndex::NODELIST, info.Holder());
+ NodeList* list = V8NodeList::toNative(info.Holder());
String key = toWebCoreString(name);
// Length property cannot be overridden.
@@ -58,4 +60,22 @@ NAMED_PROPERTY_GETTER(NodeList)
return V8DOMWrapper::convertNodeToV8Object(result.release());
}
+// Need to support call so that list(0) works.
+v8::Handle<v8::Value> V8NodeList::callAsFunctionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.NodeList.callAsFunction()");
+ if (args.Length() < 1)
+ return v8::Undefined();
+
+ NodeList* list = V8NodeList::toNative(args.Holder());
+
+ // The first argument must be a number.
+ v8::Local<v8::Uint32> index = args[0]->ToArrayIndex();
+ if (index.IsEmpty())
+ return v8::Undefined();
+
+ RefPtr<Node> result = list->item(index->Uint32Value());
+ return V8DOMWrapper::convertNodeToV8Object(result.release());
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
index a1f20cc..1cb4554 100644
--- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#if ENABLE(NOTIFICATIONS)
+#include "V8NotificationCenter.h"
#include "NotImplemented.h"
#include "Notification.h"
@@ -39,6 +40,7 @@
#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8CustomVoidCallback.h"
+#include "V8Notification.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
@@ -46,42 +48,42 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(NotificationAddEventListener)
+v8::Handle<v8::Value> V8Notification::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Notification.addEventListener()");
- Notification* notification = V8DOMWrapper::convertToNativeObject<Notification>(V8ClassIndex::NOTIFICATION, args.Holder());
+ Notification* notification = V8Notification::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(notification, args[1], false, ListenerFindOrCreate);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
notification->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kNotificationRequestCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(NotificationRemoveEventListener)
+v8::Handle<v8::Value> V8Notification::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Notification.removeEventListener()");
- Notification* notification = V8DOMWrapper::convertToNativeObject<Notification>(V8ClassIndex::NOTIFICATION, args.Holder());
+ Notification* notification = V8Notification::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(notification, args[1], false, ListenerFindOnly);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
notification->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kNotificationRequestCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(NotificationCenterCreateHTMLNotification)
+v8::Handle<v8::Value> V8NotificationCenter::createHTMLNotificationCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.NotificationCenter.CreateHTMLNotification()");
- NotificationCenter* notificationCenter = V8DOMWrapper::convertToNativeObject<NotificationCenter>(V8ClassIndex::NOTIFICATIONCENTER, args.Holder());
+ NotificationCenter* notificationCenter = V8NotificationCenter::toNative(args.Holder());
ExceptionCode ec = 0;
String url = toWebCoreString(args[0]);
@@ -96,10 +98,10 @@ CALLBACK_FUNC_DECL(NotificationCenterCreateHTMLNotification)
return V8DOMWrapper::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
}
-CALLBACK_FUNC_DECL(NotificationCenterCreateNotification)
+v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.NotificationCenter.CreateNotification()");
- NotificationCenter* notificationCenter = V8DOMWrapper::convertToNativeObject<NotificationCenter>(V8ClassIndex::NOTIFICATIONCENTER, args.Holder());
+ NotificationCenter* notificationCenter = V8NotificationCenter::toNative(args.Holder());
ExceptionCode ec = 0;
RefPtr<Notification> notification = notificationCenter->createNotification(toWebCoreString(args[0]), toWebCoreString(args[1]), toWebCoreString(args[2]), ec);
@@ -113,10 +115,10 @@ CALLBACK_FUNC_DECL(NotificationCenterCreateNotification)
return V8DOMWrapper::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
}
-CALLBACK_FUNC_DECL(NotificationCenterRequestPermission)
+v8::Handle<v8::Value> V8NotificationCenter::requestPermissionCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.NotificationCenter.RequestPermission()");
- NotificationCenter* notificationCenter = V8DOMWrapper::convertToNativeObject<NotificationCenter>(V8ClassIndex::NOTIFICATIONCENTER, args.Holder());
+ NotificationCenter* notificationCenter = V8NotificationCenter::toNative(args.Holder());
ScriptExecutionContext* context = notificationCenter->context();
// Requesting permission is only valid from a page context.
diff --git a/WebCore/bindings/v8/custom/V8FileListCustom.cpp b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
index bc533cf..46e9929 100644
--- a/WebCore/bindings/v8/custom/V8FileListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,26 +29,39 @@
*/
#include "config.h"
-#include "FileList.h"
+#include "V8PopStateEvent.h"
-#include "File.h"
-#include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "PopStateEvent.h"
+#include "SerializedScriptValue.h"
#include "V8Proxy.h"
-#include <wtf/RefPtr.h>
-
namespace WebCore {
-INDEXED_PROPERTY_GETTER(FileList)
+v8::Handle<v8::Value> V8PopStateEvent::initPopStateEventCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.PopStateEvent.initPopStateEvent");
+
+ String typeArg = v8ValueToWebCoreString(args[0]);
+ bool canBubbleArg = args[1]->BooleanValue();
+ bool cancelableArg = args[2]->BooleanValue();
+ RefPtr<SerializedScriptValue> stateArg = SerializedScriptValue::create(args[3]);
+
+ PopStateEvent* event = V8PopStateEvent::toNative(args.Holder());
+ event->initPopStateEvent(typeArg, canBubbleArg, cancelableArg, stateArg.release());
+
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.FileList.IndexedPropertyGetter");
- FileList* fileList = V8DOMWrapper::convertToNativeObject<FileList>(V8ClassIndex::FILELIST, info.Holder());
- RefPtr<File> file = fileList->item(index);
- if (!file)
- return notHandledByInterceptor();
+ INC_STATS("DOM.PopStateEvent.state");
+
+ PopStateEvent* event = V8PopStateEvent::toNative(info.Holder());
+ SerializedScriptValue* state = event->state();
+ if (!state)
+ return v8::Null();
- return V8DOMWrapper::convertToV8Object(V8ClassIndex::FILE, file.release());
+ return state->deserialize();
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
index 73aae12..ab58d1c 100644
--- a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#if ENABLE(DATABASE)
+#include "V8SQLResultSetRowList.h"
#include "SQLResultSetRowList.h"
#include "V8Binding.h"
@@ -39,7 +40,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(SQLResultSetRowListItem)
+v8::Handle<v8::Value> V8SQLResultSetRowList::itemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SQLResultSetRowList.item()");
@@ -53,7 +54,7 @@ CALLBACK_FUNC_DECL(SQLResultSetRowListItem)
return v8::Undefined();
}
- SQLResultSetRowList* rowList = V8DOMWrapper::convertToNativeObject<SQLResultSetRowList>(V8ClassIndex::SQLRESULTSETROWLIST, args.Holder());
+ SQLResultSetRowList* rowList = V8SQLResultSetRowList::toNative(args.Holder());
unsigned long index = args[0]->IntegerValue();
if (index < 0 || index >= rowList->length()) {
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
index dc801bd..98fbd9a 100644
--- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
@@ -32,6 +32,8 @@
#if ENABLE(DATABASE)
+#include "V8SQLTransaction.h"
+
#include "Database.h"
#include "SQLValue.h"
#include "V8Binding.h"
@@ -45,7 +47,7 @@ using namespace WTF;
namespace WebCore {
-CALLBACK_FUNC_DECL(SQLTransactionExecuteSql)
+v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SQLTransaction.executeSql()");
@@ -94,7 +96,7 @@ CALLBACK_FUNC_DECL(SQLTransactionExecuteSql)
return throwError("sqlArgs should be array or object!", V8Proxy::TypeError);
}
- SQLTransaction* transaction = V8DOMWrapper::convertToNativeObject<SQLTransaction>(V8ClassIndex::SQLTRANSACTION, args.Holder());
+ SQLTransaction* transaction = V8SQLTransaction::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
diff --git a/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp b/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
index dff4ff4..23b5b06 100644
--- a/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
@@ -31,10 +31,10 @@
#include <config.h>
#if ENABLE(SVG)
-
-#include "SVGElementInstance.h"
+#include "V8SVGElementInstance.h"
#include "EventListener.h"
+#include "SVGElementInstance.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
@@ -44,33 +44,33 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(SVGElementInstanceAddEventListener)
+v8::Handle<v8::Value> V8SVGElementInstance::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGElementInstance.AddEventListener()");
- SVGElementInstance* instance = V8DOMWrapper::convertDOMWrapperToNative<SVGElementInstance>(args.Holder());
+ SVGElementInstance* instance = V8SVGElementInstance::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(instance, args[1], false, ListenerFindOrCreate);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
instance->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kNodeEventListenerCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(SVGElementInstanceRemoveEventListener)
+v8::Handle<v8::Value> V8SVGElementInstance::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGElementInstance.RemoveEventListener()");
- SVGElementInstance* instance = V8DOMWrapper::convertDOMWrapperToNative<SVGElementInstance>(args.Holder());
+ SVGElementInstance* instance = V8SVGElementInstance::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(instance, args[1], false, ListenerFindOnly);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
instance->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kNodeEventListenerCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
diff --git a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
index 9f75f5a..129801d 100644
--- a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
@@ -31,9 +31,9 @@
#include <config.h>
#if ENABLE(SVG)
+#include "V8SVGLength.h"
#include "SVGLength.h"
-
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8SVGPODTypeWrapper.h"
@@ -41,18 +41,18 @@
namespace WebCore {
-ACCESSOR_GETTER(SVGLengthValue)
+v8::Handle<v8::Value> V8SVGLength::valueAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.SVGLength.value");
- V8SVGPODTypeWrapper<SVGLength>* wrapper = V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<SVGLength> >(V8ClassIndex::SVGLENGTH, info.Holder());
+ V8SVGPODTypeWrapper<SVGLength>* wrapper = V8SVGPODTypeWrapper<SVGLength>::toNative(info.Holder());
SVGLength imp = *wrapper;
return v8::Number::New(imp.value(V8Proxy::svgContext(wrapper)));
}
-CALLBACK_FUNC_DECL(SVGLengthConvertToSpecifiedUnits)
+v8::Handle<v8::Value> V8SVGLength::convertToSpecifiedUnitsCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGLength.convertToSpecifiedUnits");
- V8SVGPODTypeWrapper<SVGLength>* wrapper = V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<SVGLength> >(V8ClassIndex::SVGLENGTH, args.Holder());
+ V8SVGPODTypeWrapper<SVGLength>* wrapper = V8SVGPODTypeWrapper<SVGLength>::toNative(args.Holder());
SVGLength imp = *wrapper;
SVGElement* context = V8Proxy::svgContext(wrapper);
imp.convertToSpecifiedUnits(toInt32(args[0]), context);
diff --git a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
index 690eac1..78284cd 100644
--- a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
@@ -44,7 +44,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(SVGMatrixMultiply)
+v8::Handle<v8::Value> V8SVGMatrix::multiplyCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.multiply()");
if (args.Length() < 1)
@@ -53,16 +53,16 @@ CALLBACK_FUNC_DECL(SVGMatrixMultiply)
if (!V8SVGMatrix::HasInstance(args[0]))
return throwError("secondMatrix argument was not a SVGMatrix");
- TransformationMatrix m1 = *V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<TransformationMatrix> >(V8ClassIndex::SVGMATRIX, args.Holder());
- TransformationMatrix m2 = *V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<TransformationMatrix> >(V8ClassIndex::SVGMATRIX, v8::Handle<v8::Object>::Cast(args[0]));
+ TransformationMatrix m1 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
+ TransformationMatrix m2 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(v8::Handle<v8::Object>::Cast(args[0]));
return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)));
}
-CALLBACK_FUNC_DECL(SVGMatrixInverse)
+v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.inverse()");
- TransformationMatrix matrix = *V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<TransformationMatrix> >(V8ClassIndex::SVGMATRIX, args.Holder());
+ TransformationMatrix matrix = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
ExceptionCode ec = 0;
TransformationMatrix result = matrix.inverse();
@@ -77,10 +77,10 @@ CALLBACK_FUNC_DECL(SVGMatrixInverse)
return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result));
}
-CALLBACK_FUNC_DECL(SVGMatrixRotateFromVector)
+v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.rotateFromVector()");
- TransformationMatrix matrix = *V8DOMWrapper::convertToNativeObject<V8SVGPODTypeWrapper<TransformationMatrix> >(V8ClassIndex::SVGMATRIX, args.Holder());
+ TransformationMatrix matrix = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
ExceptionCode ec = 0;
float x = toFloat(args[0]);
float y = toFloat(args[1]);
diff --git a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
index de53ac7..549de94 100644
--- a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
@@ -32,7 +32,7 @@
#if ENABLE(SHARED_WORKERS)
-#include "SharedWorker.h"
+#include "V8SharedWorker.h"
#include "ExceptionCode.h"
#include "Frame.h"
@@ -45,7 +45,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(SharedWorkerConstructor)
+v8::Handle<v8::Value> V8SharedWorker::constructorCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.SharedWorker.Constructor");
diff --git a/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
index f3f4687..ff3ac5e 100755
--- a/WebCore/bindings/v8/custom/V8StorageCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#if ENABLE(DOM_STORAGE)
+#include "V8Storage.h"
#include "Storage.h"
#include "V8Binding.h"
@@ -40,9 +41,9 @@
namespace WebCore {
// Get an array containing the names of indexed properties in a collection.
-v8::Handle<v8::Array> V8Custom::v8StorageNamedPropertyEnumerator(const v8::AccessorInfo& info)
+v8::Handle<v8::Array> V8Storage::namedPropertyEnumerator(const v8::AccessorInfo& info)
{
- Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+ Storage* storage = V8Storage::toNative(info.Holder());
unsigned int length = storage->length();
v8::Handle<v8::Array> properties = v8::Array::New(length);
for (unsigned int i = 0; i < length; ++i) {
@@ -57,7 +58,7 @@ v8::Handle<v8::Array> V8Custom::v8StorageNamedPropertyEnumerator(const v8::Acces
static v8::Handle<v8::Value> storageGetter(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
{
- Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+ Storage* storage = V8Storage::toNative(info.Holder());
String name = toWebCoreString(v8Name);
if (storage->contains(name) && name != "length")
@@ -66,14 +67,14 @@ static v8::Handle<v8::Value> storageGetter(v8::Local<v8::String> v8Name, const v
return notHandledByInterceptor();
}
-INDEXED_PROPERTY_GETTER(Storage)
+v8::Handle<v8::Value> V8Storage::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Storage.IndexedPropertyGetter");
v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
return storageGetter(indexV8->ToString(), info);
}
-NAMED_PROPERTY_GETTER(Storage)
+v8::Handle<v8::Value> V8Storage::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Storage.NamedPropertyGetter");
return storageGetter(name, info);
@@ -81,7 +82,7 @@ NAMED_PROPERTY_GETTER(Storage)
static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Local<v8::Value> v8Value, const v8::AccessorInfo& info)
{
- Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+ Storage* storage = V8Storage::toNative(info.Holder());
String name = toWebCoreString(v8Name);
String value = toWebCoreString(v8Value);
@@ -101,14 +102,14 @@ static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Loc
return v8Value;
}
-INDEXED_PROPERTY_SETTER(Storage)
+v8::Handle<v8::Value> V8Storage::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Storage.NamedPropertyGetter");
v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
return storageSetter(indexV8->ToString(), value, info);
}
-NAMED_PROPERTY_SETTER(Storage)
+v8::Handle<v8::Value> V8Storage::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Storage.NamedPropertySetter");
return storageSetter(name, value, info);
@@ -116,7 +117,7 @@ NAMED_PROPERTY_SETTER(Storage)
static v8::Handle<v8::Boolean> storageDeleter(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
{
- Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+ Storage* storage = V8Storage::toNative(info.Holder());
String name = toWebCoreString(v8Name);
if (storage->contains(name)) {
@@ -127,14 +128,14 @@ static v8::Handle<v8::Boolean> storageDeleter(v8::Local<v8::String> v8Name, cons
return deletionNotHandledByInterceptor();
}
-INDEXED_PROPERTY_DELETER(Storage)
+v8::Handle<v8::Boolean> V8Storage::indexedPropertyDeleter(uint32_t index, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Storage.IndexedPropertyDeleter");
v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
return storageDeleter(indexV8->ToString(), info);
}
-NAMED_PROPERTY_DELETER(Storage)
+v8::Handle<v8::Boolean> V8Storage::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Storage.NamedPropertyDeleter");
return storageDeleter(name, info);
diff --git a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp b/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
index 32a48eb..a718451 100644
--- a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
@@ -29,16 +29,17 @@
*/
#include "config.h"
+#include "V8StyleSheetList.h"
+
#include "HTMLStyleElement.h"
#include "StyleSheetList.h"
-
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
-NAMED_PROPERTY_GETTER(StyleSheetList)
+v8::Handle<v8::Value> V8StyleSheetList::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.StyleSheetList.NamedPropertyGetter");
@@ -46,7 +47,7 @@ NAMED_PROPERTY_GETTER(StyleSheetList)
return notHandledByInterceptor();
// Search style sheet.
- StyleSheetList* imp = V8DOMWrapper::convertToNativeObject<StyleSheetList>(V8ClassIndex::STYLESHEETLIST, info.Holder());
+ StyleSheetList* imp = V8StyleSheetList::toNative(info.Holder());
HTMLStyleElement* item = imp->getNamedItem(toWebCoreString(name));
if (!item)
return notHandledByInterceptor();
diff --git a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
index 5052b7a..b848197 100644
--- a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
@@ -29,10 +29,11 @@
*/
#include "config.h"
-#include "TreeWalker.h"
+#include "V8TreeWalker.h"
#include "Node.h"
#include "ScriptState.h"
+#include "TreeWalker.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
@@ -54,72 +55,72 @@ static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ScriptState* s
return V8DOMWrapper::convertNodeToV8Object(object);
}
-CALLBACK_FUNC_DECL(TreeWalkerParentNode)
+v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TreeWalker.parentNode()");
- TreeWalker* treeWalker = V8DOMWrapper::convertToNativeObject<TreeWalker>(V8ClassIndex::TREEWALKER, args.Holder());
+ TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = treeWalker->parentNode(&state);
return toV8(result.release(), &state);
}
-CALLBACK_FUNC_DECL(TreeWalkerFirstChild)
+v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TreeWalker.firstChild()");
- TreeWalker* treeWalker = V8DOMWrapper::convertToNativeObject<TreeWalker>(V8ClassIndex::TREEWALKER, args.Holder());
+ TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = treeWalker->firstChild(&state);
return toV8(result.release(), &state);
}
-CALLBACK_FUNC_DECL(TreeWalkerLastChild)
+v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TreeWalker.lastChild()");
- TreeWalker* treeWalker = V8DOMWrapper::convertToNativeObject<TreeWalker>(V8ClassIndex::TREEWALKER, args.Holder());
+ TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = treeWalker->lastChild(&state);
return toV8(result.release(), &state);
}
-CALLBACK_FUNC_DECL(TreeWalkerNextNode)
+v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TreeWalker.nextNode()");
- TreeWalker* treeWalker = V8DOMWrapper::convertToNativeObject<TreeWalker>(V8ClassIndex::TREEWALKER, args.Holder());
+ TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = treeWalker->nextNode(&state);
return toV8(result.release(), &state);
}
-CALLBACK_FUNC_DECL(TreeWalkerPreviousNode)
+v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TreeWalker.previousNode()");
- TreeWalker* treeWalker = V8DOMWrapper::convertToNativeObject<TreeWalker>(V8ClassIndex::TREEWALKER, args.Holder());
+ TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = treeWalker->previousNode(&state);
return toV8(result.release(), &state);
}
-CALLBACK_FUNC_DECL(TreeWalkerNextSibling)
+v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TreeWalker.nextSibling()");
- TreeWalker* treeWalker = V8DOMWrapper::convertToNativeObject<TreeWalker>(V8ClassIndex::TREEWALKER, args.Holder());
+ TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = treeWalker->nextSibling(&state);
return toV8(result.release(), &state);
}
-CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling)
+v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TreeWalker.previousSibling()");
- TreeWalker* treeWalker = V8DOMWrapper::convertToNativeObject<TreeWalker>(V8ClassIndex::TREEWALKER, args.Holder());
+ TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
- ScriptState state;
+ EmptyScriptState state;
RefPtr<Node> result = treeWalker->previousSibling(&state);
return toV8(result.release(), &state);
}
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
index 16a1f51..bc167c5 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
@@ -41,7 +41,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLArrayBufferConstructor)
+v8::Handle<v8::Value> V8WebGLArrayBuffer::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLArrayBuffer.Constructor");
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
index 1a4b6a4..6a702f5 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
@@ -75,9 +75,7 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args,
if (argLen > 3)
return throwError("Wrong number of arguments to new WebGL<T>Array(WebGLArrayBuffer, int, int)");
- WebGLArrayBuffer* buf =
- V8DOMWrapper::convertToNativeObject<WebGLArrayBuffer>(V8ClassIndex::WEBGLARRAYBUFFER,
- args[0]->ToObject());
+ WebGLArrayBuffer* buf = V8WebGLArrayBuffer::toNative(args[0]->ToObject());
if (buf == NULL)
return throwError("Could not convert argument 0 to a WebGLArrayBuffer");
bool ok;
@@ -155,7 +153,7 @@ v8::Handle<v8::Value> getWebGLArrayElement(const v8::Arguments& args,
V8Proxy::setDOMException(SYNTAX_ERR);
return notHandledByInterceptor();
}
- T* array = V8DOMWrapper::convertToNativeObject<T>(wrapperType, args.Holder());
+ T* array = reinterpret_cast<T*>(args.Holder()->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
if (index >= array->length())
return v8::Undefined();
ElementType result;
@@ -174,9 +172,11 @@ v8::Handle<v8::Value> setWebGLArrayFromArray(T* webGLArray, const v8::Arguments&
if (args.Length() == 2)
offset = toInt32(args[1]);
uint32_t length = toInt32(array->Get(v8::String::New("length")));
- for (uint32_t i = 0; i < length; i++) {
- webGLArray->set(offset + i, array->Get(v8::Integer::New(i))->NumberValue());
- }
+ if (offset + length > webGLArray->length())
+ V8Proxy::setDOMException(INDEX_SIZE_ERR);
+ else
+ for (uint32_t i = 0; i < length; i++)
+ webGLArray->set(offset + i, array->Get(v8::Integer::New(i))->NumberValue());
}
return v8::Undefined();
@@ -191,10 +191,10 @@ v8::Handle<v8::Value> setWebGLArray(const v8::Arguments& args,
return notHandledByInterceptor();
}
- CPlusPlusArrayType* array = V8DOMWrapper::convertToNativeObject<CPlusPlusArrayType>(wrapperType, args.Holder());
+ CPlusPlusArrayType* array = JavaScriptWrapperArrayType::toNative(args.Holder());
if (args.Length() == 2 && args[0]->IsInt32()) {
- // void set(in unsigned long index, in long value);
+ // void set(in unsigned long index, in {long|float} value);
uint32_t index = toInt32(args[0]);
array->set(index, args[1]->NumberValue());
return v8::Undefined();
@@ -202,7 +202,7 @@ v8::Handle<v8::Value> setWebGLArray(const v8::Arguments& args,
if (JavaScriptWrapperArrayType::HasInstance(args[0])) {
// void set(in WebGL<T>Array array, [Optional] in unsigned long offset);
- CPlusPlusArrayType* src = V8DOMWrapper::convertToNativeObject<CPlusPlusArrayType>(wrapperType, args[0]->ToObject());
+ CPlusPlusArrayType* src = JavaScriptWrapperArrayType::toNative(args[0]->ToObject());
uint32_t offset = 0;
if (args.Length() == 2)
offset = toInt32(args[1]);
diff --git a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
index 5719c8a..6d52c83 100644
--- a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
@@ -44,48 +44,20 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLByteArrayConstructor)
+v8::Handle<v8::Value> V8WebGLByteArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLByteArray.Contructor");
return constructWebGLArray<WebGLByteArray>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLBYTEARRAY));
}
-// Get the specified value from the byte buffer and return it wrapped as a JavaScript Number object to V8. Accesses outside the valid byte buffer range return "undefined".
-INDEXED_PROPERTY_GETTER(WebGLByteArray)
-{
- INC_STATS("DOM.WebGLByteArray.IndexedPropertyGetter");
- WebGLByteArray* byteBuffer = V8DOMWrapper::convertToNativeObject<WebGLByteArray>(V8ClassIndex::WEBGLBYTEARRAY, info.Holder());
-
- if ((index < 0) || (index >= byteBuffer->length()))
- return v8::Undefined();
- signed char result;
- if (!byteBuffer->get(index, result))
- return v8::Undefined();
- return v8::Number::New(result);
-}
-
-// Set the specified value in the byte buffer. Accesses outside the valid byte buffer range are silently ignored.
-INDEXED_PROPERTY_SETTER(WebGLByteArray)
-{
- INC_STATS("DOM.WebGLByteArray.IndexedPropertySetter");
- WebGLByteArray* array = V8DOMWrapper::convertToNativeObject<WebGLByteArray>(V8ClassIndex::WEBGLBYTEARRAY, info.Holder());
-
- if ((index >= 0) && (index < array->length())) {
- if (!value->IsNumber())
- return throwError("Could not convert value argument to a number");
- array->set(index, value->NumberValue());
- }
- return value;
-}
-
-CALLBACK_FUNC_DECL(WebGLByteArrayGet)
+v8::Handle<v8::Value> V8WebGLByteArray::getCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLByteArray.get()");
return getWebGLArrayElement<WebGLByteArray, signed char>(args, V8ClassIndex::WEBGLBYTEARRAY);
}
-CALLBACK_FUNC_DECL(WebGLByteArraySet)
+v8::Handle<v8::Value> V8WebGLByteArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLByteArray.set()");
return setWebGLArray<WebGLByteArray, V8WebGLByteArray>(args, V8ClassIndex::WEBGLBYTEARRAY);
diff --git a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
index 6e56760..4d4b0e2 100644
--- a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
@@ -44,45 +44,20 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLFloatArrayConstructor)
+v8::Handle<v8::Value> V8WebGLFloatArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLFloatArray.Contructor");
return constructWebGLArray<WebGLFloatArray>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLFLOATARRAY));
}
-// Get the specified value from the array and return it wrapped as a JavaScript Number object to V8. Accesses outside the valid array range return "undefined".
-INDEXED_PROPERTY_GETTER(WebGLFloatArray)
-{
- INC_STATS("DOM.WebGLFloatArray.IndexedPropertyGetter");
- WebGLFloatArray* array = V8DOMWrapper::convertToNativeObject<WebGLFloatArray>(V8ClassIndex::WEBGLFLOATARRAY, info.Holder());
-
- if ((index < 0) || (index >= array->length()))
- return v8::Undefined();
- float result;
- if (!array->get(index, result))
- return v8::Undefined();
- return v8::Number::New(result);
-}
-
-// Set the specified value in the array. Accesses outside the valid array range are silently ignored.
-INDEXED_PROPERTY_SETTER(WebGLFloatArray)
-{
- INC_STATS("DOM.WebGLFloatArray.IndexedPropertySetter");
- WebGLFloatArray* array = V8DOMWrapper::convertToNativeObject<WebGLFloatArray>(V8ClassIndex::WEBGLFLOATARRAY, info.Holder());
-
- if ((index >= 0) && (index < array->length()))
- array->set(index, value->NumberValue());
- return value;
-}
-
-CALLBACK_FUNC_DECL(WebGLFloatArrayGet)
+v8::Handle<v8::Value> V8WebGLFloatArray::getCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLFloatArray.get()");
return getWebGLArrayElement<WebGLFloatArray, float>(args, V8ClassIndex::WEBGLFLOATARRAY);
}
-CALLBACK_FUNC_DECL(WebGLFloatArraySet)
+v8::Handle<v8::Value> V8WebGLFloatArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLFloatArray.set()");
return setWebGLArray<WebGLFloatArray, V8WebGLFloatArray>(args, V8ClassIndex::WEBGLFLOATARRAY);
diff --git a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
index 1bd30b2..7dde0a0 100644
--- a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
@@ -44,48 +44,20 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLIntArrayConstructor)
+v8::Handle<v8::Value> V8WebGLIntArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLIntArray.Contructor");
return constructWebGLArray<WebGLIntArray>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLINTARRAY));
}
-// Get the specified value from the integer array and return it wrapped as a JavaScript Number object to V8. Accesses outside the valid pixel buffer range return "undefined".
-INDEXED_PROPERTY_GETTER(WebGLIntArray)
-{
- INC_STATS("DOM.WebGLIntArray.IndexedPropertyGetter");
- WebGLIntArray* array = V8DOMWrapper::convertToNativeObject<WebGLIntArray>(V8ClassIndex::WEBGLINTARRAY, info.Holder());
-
- if ((index < 0) || (index >= array->length()))
- return v8::Undefined();
- int result;
- if (!array->get(index, result))
- return v8::Undefined();
- return v8::Number::New(result);
-}
-
-// Set the specified value in the integer array. Accesses outside the valid integer array range are silently ignored.
-INDEXED_PROPERTY_SETTER(WebGLIntArray)
-{
- INC_STATS("DOM.WebGLIntArray.IndexedPropertySetter");
- WebGLIntArray* array = V8DOMWrapper::convertToNativeObject<WebGLIntArray>(V8ClassIndex::WEBGLINTARRAY, info.Holder());
-
- if ((index >= 0) && (index < array->length())) {
- if (!value->IsNumber())
- return throwError("Could not convert value argument to a number");
- array->set(index, value->NumberValue());
- }
- return value;
-}
-
-CALLBACK_FUNC_DECL(WebGLIntArrayGet)
+v8::Handle<v8::Value> V8WebGLIntArray::getCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLIntArray.get()");
return getWebGLArrayElement<WebGLIntArray, int>(args, V8ClassIndex::WEBGLINTARRAY);
}
-CALLBACK_FUNC_DECL(WebGLIntArraySet)
+v8::Handle<v8::Value> V8WebGLIntArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLIntArray.set()");
return setWebGLArray<WebGLIntArray, V8WebGLIntArray>(args, V8ClassIndex::WEBGLINTARRAY);
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index fd73a5b..19b73d4 100644
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -32,7 +32,7 @@
#if ENABLE(3D_CANVAS)
-#include "WebGLRenderingContext.h"
+#include "V8WebGLRenderingContext.h"
#include "ExceptionCode.h"
@@ -54,7 +54,10 @@
#include "V8WebGLUnsignedShortArray.h"
#include "V8HTMLCanvasElement.h"
#include "V8HTMLImageElement.h"
+#include "V8HTMLVideoElement.h"
+#include "V8ImageData.h"
#include "V8Proxy.h"
+#include "WebGLRenderingContext.h"
namespace WebCore {
@@ -98,7 +101,7 @@ static int* jsArrayToIntArray(v8::Handle<v8::Array> array, uint32_t len)
return data;
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextBufferData)
+v8::Handle<v8::Value> V8WebGLRenderingContext::bufferDataCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.bufferData()");
@@ -112,8 +115,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextBufferData)
return notHandledByInterceptor();
}
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok;
int target = toInt32(args[0], ok);
if (!ok) {
@@ -130,7 +132,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextBufferData)
ExceptionCode exceptionCode;
context->bufferData(target, size, usage, exceptionCode);
} else if (V8WebGLArray::HasInstance(args[1])) {
- WebGLArray* array = V8DOMWrapper::convertToNativeObject<WebGLArray>(V8ClassIndex::WEBGLARRAY, args[1]->ToObject());
+ WebGLArray* array = V8WebGLArray::toNative(args[1]->ToObject());
ExceptionCode exceptionCode;
context->bufferData(target, array, usage, exceptionCode);
} else {
@@ -140,7 +142,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextBufferData)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextBufferSubData)
+v8::Handle<v8::Value> V8WebGLRenderingContext::bufferSubDataCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.bufferSubData()");
@@ -151,8 +153,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextBufferSubData)
return notHandledByInterceptor();
}
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok;
int target = toInt32(args[0], ok);
if (!ok) {
@@ -168,7 +169,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextBufferSubData)
V8Proxy::setDOMException(SYNTAX_ERR);
return notHandledByInterceptor();
}
- WebGLArray* array = V8DOMWrapper::convertToNativeObject<WebGLArray>(V8ClassIndex::WEBGLARRAY, args[2]->ToObject());
+ WebGLArray* array = V8WebGLArray::toNative(args[2]->ToObject());
ExceptionCode exceptionCode;
context->bufferSubData(target, offset, array, exceptionCode);
return v8::Undefined();
@@ -225,8 +226,7 @@ static v8::Handle<v8::Value> getObjectParameter(const v8::Arguments& args, Objec
}
ExceptionCode ec = 0;
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok;
unsigned target = toInt32(args[0], ok);
if (!ok) {
@@ -269,8 +269,7 @@ static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value,
ok = false;
WebGLUniformLocation* location = 0;
if (V8WebGLUniformLocation::HasInstance(value)) {
- location = V8DOMWrapper::convertToNativeObject<WebGLUniformLocation>(
- V8ClassIndex::WEBGLUNIFORMLOCATION, value->ToObject());
+ location = V8WebGLUniformLocation::toNative(value->ToObject());
ok = true;
}
return location;
@@ -280,13 +279,13 @@ enum WhichProgramCall {
kProgramParameter, kUniform
};
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetBufferParameter)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getBufferParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getBufferParameter()");
return getObjectParameter(args, kBuffer);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetFramebufferAttachmentParameter)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getFramebufferAttachmentParameter()");
@@ -296,8 +295,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetFramebufferAttachmentParameter)
}
ExceptionCode ec = 0;
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok;
unsigned target = toInt32(args[0], ok);
if (!ok) {
@@ -322,7 +320,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetFramebufferAttachmentParameter)
return toV8(info);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetParameter)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getParameter()");
@@ -332,8 +330,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetParameter)
}
ExceptionCode ec = 0;
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok;
unsigned pname = toInt32(args[0], ok);
if (!ok) {
@@ -348,7 +345,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetParameter)
return toV8(info);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetProgramParameter)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getProgramParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getProgramParameter()");
@@ -358,9 +355,8 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetProgramParameter)
}
ExceptionCode ec = 0;
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
- WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? v8DOMWrapperTo<WebGLProgram>(V8ClassIndex::WEBGLPROGRAM, v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
+ WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
bool ok;
unsigned pname = toInt32(args[1], ok);
if (!ok) {
@@ -375,13 +371,13 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetProgramParameter)
return toV8(info);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetRenderbufferParameter)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getRenderbufferParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getRenderbufferParameter()");
return getObjectParameter(args, kRenderbuffer);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetShaderParameter)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getShaderParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getShaderParameter()");
@@ -391,9 +387,8 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetShaderParameter)
}
ExceptionCode ec = 0;
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
- WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? v8DOMWrapperTo<WebGLShader>(V8ClassIndex::WEBGLSHADER, v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
+ WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
bool ok;
unsigned pname = toInt32(args[1], ok);
if (!ok) {
@@ -408,13 +403,13 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetShaderParameter)
return toV8(info);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetTexParameter)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getTexParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getTexParameter()");
return getObjectParameter(args, kTexture);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetUniform)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getUniformCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getUniform()");
@@ -424,9 +419,8 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetUniform)
}
ExceptionCode ec = 0;
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
- WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? v8DOMWrapperTo<WebGLProgram>(V8ClassIndex::WEBGLPROGRAM, v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
+ WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
bool ok = false;
WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);
@@ -443,13 +437,13 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextGetUniform)
return toV8(info);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextGetVertexAttrib)
+v8::Handle<v8::Value> V8WebGLRenderingContext::getVertexAttribCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getVertexAttrib()");
return getObjectParameter(args, kVertexAttrib);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextTexImage2D)
+v8::Handle<v8::Value> V8WebGLRenderingContext::texImage2DCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.texImage2D()");
@@ -458,10 +452,14 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextTexImage2D)
// in GLint internalformat,
// in GLsizei width, in GLsizei height, in GLint border,
// in GLenum format, in GLenum type, in WebGLArray pixels);
+ // * void texImage2D(in GLenum target, in GLint level, in ImageData pixels,
+ // [Optional] in GLboolean flipY, [Optional] in GLboolean premulitplyAlpha);
// * void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image,
// [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha);
// * void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement image,
// [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha);
+ // * void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement image,
+ // [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha);
if (args.Length() != 3 &&
args.Length() != 4 &&
args.Length() != 5 &&
@@ -470,8 +468,7 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextTexImage2D)
return notHandledByInterceptor();
}
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok;
int target = toInt32(args[0], ok);
if (!ok) {
@@ -488,21 +485,28 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextTexImage2D)
if (args.Length() == 3 ||
args.Length() == 4 ||
args.Length() == 5) {
- v8::Handle<v8::Value> arg = args[2];
bool flipY = false;
bool premultiplyAlpha = false;
if (args.Length() >= 4)
flipY = args[3]->BooleanValue();
if (args.Length() >= 5)
premultiplyAlpha = args[4]->BooleanValue();
+
+ v8::Handle<v8::Value> arg = args[2];
if (V8HTMLImageElement::HasInstance(arg)) {
- HTMLImageElement* element = V8DOMWrapper::convertDOMWrapperToNode<HTMLImageElement>(v8::Handle<v8::Object>::Cast(arg));
+ HTMLImageElement* element = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg));
context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
} else if (V8HTMLCanvasElement::HasInstance(arg)) {
- HTMLCanvasElement* element = V8DOMWrapper::convertDOMWrapperToNode<HTMLCanvasElement>(v8::Handle<v8::Object>::Cast(arg));
+ HTMLCanvasElement* element = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg));
context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
- } else {
- // FIXME: support HTMLVideoElement and ImageData.
+ } else if(V8ImageData::HasInstance(arg)) {
+ ImageData* imageElement = V8ImageData::toNative(v8::Handle<v8::Object>::Cast(arg));
+ context->texImage2D(target, level, imageElement, flipY, premultiplyAlpha, ec);
+ } else if (V8HTMLVideoElement::HasInstance(arg)) {
+ HTMLVideoElement* element = V8HTMLVideoElement::toNative(v8::Handle<v8::Object>::Cast(arg));
+ context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
+ }
+ else {
// FIXME: consider different / better exception type.
V8Proxy::setDOMException(SYNTAX_ERR);
return notHandledByInterceptor();
@@ -540,10 +544,20 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextTexImage2D)
return notHandledByInterceptor();
}
v8::Handle<v8::Value> arg = args[8];
- if (V8WebGLArray::HasInstance(arg)) {
- WebGLArray* array = V8DOMWrapper::convertToNativeObject<WebGLArray>(V8ClassIndex::WEBGLARRAY, arg->ToObject());
- // FIXME: must do validation similar to JOGL's to ensure that
- // the incoming array is of the appropriate length and type
+ if (!arg->IsObject())
+ // Assume that the user is passing null for texture
+ context->texImage2D(target,
+ level,
+ internalformat,
+ width,
+ height,
+ border,
+ format,
+ type,
+ 0,
+ ec);
+ else if (V8WebGLArray::HasInstance(arg)) {
+ WebGLArray* array = V8WebGLArray::toNative(arg->ToObject());
context->texImage2D(target,
level,
internalformat,
@@ -571,13 +585,145 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextTexImage2D)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextTexSubImage2D)
+v8::Handle<v8::Value> V8WebGLRenderingContext::texSubImage2DCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.texSubImage2D()");
- // FIXME: implement
- notImplemented();
+ // Currently supported forms:
+ // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
+ // in GLsizei width, in GLsizei height,
+ // in GLenum format, in GLenum type, in WebGLArray pixels);
+ // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
+ // in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
+ // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
+ // in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
+ // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
+ // in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
+ // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
+ // in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
+
+ if (args.Length() != 5 &&
+ args.Length() != 6 &&
+ args.Length() != 7 &&
+ args.Length() != 9) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
+ bool ok;
+ int target = toInt32(args[0], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ int level = toInt32(args[1], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ int xoff = toInt32(args[2], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ int yoff = toInt32(args[3], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+
+ ExceptionCode ec = 0;
+ if (args.Length() == 5 ||
+ args.Length() == 6 ||
+ args.Length() == 7) {
+ bool flipY = false;
+ bool premultiplyAlpha = false;
+ if (args.Length() >= 6)
+ flipY = args[5]->BooleanValue();
+ if (args.Length() >= 7)
+ premultiplyAlpha = args[6]->BooleanValue();
+
+ v8::Handle<v8::Value> arg = args[4];
+ if (V8HTMLImageElement::HasInstance(arg)) {
+ HTMLImageElement* element = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg));
+ context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
+ } else if (V8HTMLCanvasElement::HasInstance(arg)) {
+ HTMLCanvasElement* element = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg));
+ context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
+ } else if(V8ImageData::HasInstance(arg)) {
+ ImageData* imageElement = V8ImageData::toNative(v8::Handle<v8::Object>::Cast(arg));
+ context->texSubImage2D(target, level, xoff, yoff, imageElement, flipY, premultiplyAlpha, ec);
+ } else if (V8HTMLVideoElement::HasInstance(arg)) {
+ HTMLVideoElement* element = V8HTMLVideoElement::toNative(v8::Handle<v8::Object>::Cast(arg));
+ context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
+ }
+ else {
+ // FIXME: consider different / better exception type.
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ // Fall through
+ } else if (args.Length() == 9) {
+ int width = toInt32(args[4], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ int height = toInt32(args[5], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ int format = toInt32(args[6], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ int type = toInt32(args[7], ok);
+ if (!ok) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ v8::Handle<v8::Value> arg = args[8];
+ if (!arg->IsObject())
+ // Assume that the user is passing null for texture
+ context->texSubImage2D(target,
+ level,
+ xoff,
+ yoff,
+ width,
+ height,
+ format,
+ type,
+ 0,
+ ec);
+ else if (V8WebGLArray::HasInstance(arg)) {
+ WebGLArray* array = V8WebGLArray::toNative(arg->ToObject());
+ context->texSubImage2D(target,
+ level,
+ xoff,
+ yoff,
+ width,
+ height,
+ format,
+ type,
+ array,
+ ec);
+ // Fall through
+ } else {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ } else {
+ ASSERT_NOT_REACHED();
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+ if (ec) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
return v8::Undefined();
}
@@ -634,16 +780,14 @@ static v8::Handle<v8::Value> vertexAttribAndUniformHelperf(const v8::Arguments&
else
location = toWebGLUniformLocation(args[0], ok);
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
if (!ok) {
V8Proxy::setDOMException(SYNTAX_ERR);
return notHandledByInterceptor();
}
if (V8WebGLFloatArray::HasInstance(args[1])) {
- WebGLFloatArray* array =
- V8DOMWrapper::convertToNativeObject<WebGLFloatArray>(V8ClassIndex::WEBGLFLOATARRAY, args[1]->ToObject());
+ WebGLFloatArray* array = V8WebGLFloatArray::toNative(args[1]->ToObject());
ASSERT(array != NULL);
ExceptionCode ec = 0;
switch (functionToCall) {
@@ -710,8 +854,7 @@ static v8::Handle<v8::Value> uniformHelperi(const v8::Arguments& args,
return notHandledByInterceptor();
}
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok = false;
WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
@@ -720,8 +863,7 @@ static v8::Handle<v8::Value> uniformHelperi(const v8::Arguments& args,
return notHandledByInterceptor();
}
if (V8WebGLIntArray::HasInstance(args[1])) {
- WebGLIntArray* array =
- V8DOMWrapper::convertToNativeObject<WebGLIntArray>(V8ClassIndex::WEBGLINTARRAY, args[1]->ToObject());
+ WebGLIntArray* array = V8WebGLIntArray::toNative(args[1]->ToObject());
ASSERT(array != NULL);
ExceptionCode ec = 0;
switch (functionToCall) {
@@ -763,49 +905,49 @@ static v8::Handle<v8::Value> uniformHelperi(const v8::Arguments& args,
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform1fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform1fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform1fv()");
return vertexAttribAndUniformHelperf(args, kUniform1v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform1iv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform1ivCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform1iv()");
return uniformHelperi(args, kUniform1v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform2fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform2fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform2fv()");
return vertexAttribAndUniformHelperf(args, kUniform2v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform2iv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform2ivCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform2iv()");
return uniformHelperi(args, kUniform2v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform3fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform3fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform3fv()");
return vertexAttribAndUniformHelperf(args, kUniform3v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform3iv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform3ivCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform3iv()");
return uniformHelperi(args, kUniform3v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform4fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform4fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform4fv()");
return vertexAttribAndUniformHelperf(args, kUniform4v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniform4iv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniform4ivCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniform4iv()");
return uniformHelperi(args, kUniform4v);
@@ -828,8 +970,7 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args,
return notHandledByInterceptor();
}
- WebGLRenderingContext* context =
- V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
bool ok = false;
WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
@@ -840,8 +981,7 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args,
}
bool transpose = args[1]->BooleanValue();
if (V8WebGLFloatArray::HasInstance(args[2])) {
- WebGLFloatArray* array =
- V8DOMWrapper::convertToNativeObject<WebGLFloatArray>(V8ClassIndex::WEBGLFLOATARRAY, args[2]->ToObject());
+ WebGLFloatArray* array = V8WebGLFloatArray::toNative(args[2]->ToObject());
ASSERT(array != NULL);
ExceptionCode ec = 0;
switch (matrixSize) {
@@ -881,43 +1021,43 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args,
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniformMatrix2fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniformMatrix2fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniformMatrix2fv()");
return uniformMatrixHelper(args, 2);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniformMatrix3fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniformMatrix3fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniformMatrix3fv()");
return uniformMatrixHelper(args, 3);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextUniformMatrix4fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::uniformMatrix4fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.uniformMatrix4fv()");
return uniformMatrixHelper(args, 4);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextVertexAttrib1fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib1fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.vertexAttrib1fv()");
return vertexAttribAndUniformHelperf(args, kVertexAttrib1v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextVertexAttrib2fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib2fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.vertexAttrib2fv()");
return vertexAttribAndUniformHelperf(args, kVertexAttrib2v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextVertexAttrib3fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib3fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.vertexAttrib3fv()");
return vertexAttribAndUniformHelperf(args, kVertexAttrib3v);
}
-CALLBACK_FUNC_DECL(WebGLRenderingContextVertexAttrib4fv)
+v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib4fvCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.vertexAttrib4fv()");
return vertexAttribAndUniformHelperf(args, kVertexAttrib4v);
diff --git a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
index f8a26c3..9d3b478 100644
--- a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
@@ -44,48 +44,20 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLShortArrayConstructor)
+v8::Handle<v8::Value> V8WebGLShortArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLShortArray.Contructor");
return constructWebGLArray<WebGLShortArray>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLSHORTARRAY));
}
-// Get the specified value from the array and return it wrapped as a JavaScript Number object to V8. Accesses outside the valid array range return "undefined".
-INDEXED_PROPERTY_GETTER(WebGLShortArray)
-{
- INC_STATS("DOM.WebGLShortArray.IndexedPropertyGetter");
- WebGLShortArray* array = V8DOMWrapper::convertToNativeObject<WebGLShortArray>(V8ClassIndex::WEBGLSHORTARRAY, info.Holder());
-
- if ((index < 0) || (index >= array->length()))
- return v8::Undefined();
- short result;
- if (!array->get(index, result))
- return v8::Undefined();
- return v8::Number::New(result);
-}
-
-// Set the specified value in the array. Accesses outside the valid array range are silently ignored.
-INDEXED_PROPERTY_SETTER(WebGLShortArray)
-{
- INC_STATS("DOM.WebGLShortArray.IndexedPropertySetter");
- WebGLShortArray* array = V8DOMWrapper::convertToNativeObject<WebGLShortArray>(V8ClassIndex::WEBGLSHORTARRAY, info.Holder());
-
- if ((index >= 0) && (index < array->length())) {
- if (!value->IsNumber())
- return throwError("Could not convert value argument to a number");
- array->set(index, value->NumberValue());
- }
- return value;
-}
-
-CALLBACK_FUNC_DECL(WebGLShortArrayGet)
+v8::Handle<v8::Value> V8WebGLShortArray::getCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLShortArray.get()");
return getWebGLArrayElement<WebGLShortArray, short>(args, V8ClassIndex::WEBGLSHORTARRAY);
}
-CALLBACK_FUNC_DECL(WebGLShortArraySet)
+v8::Handle<v8::Value> V8WebGLShortArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLShortArray.set()");
return setWebGLArray<WebGLShortArray, V8WebGLShortArray>(args, V8ClassIndex::WEBGLSHORTARRAY);
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
index 391f213..3cc658a 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
@@ -44,48 +44,20 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLUnsignedByteArrayConstructor)
+v8::Handle<v8::Value> V8WebGLUnsignedByteArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedByteArray.Contructor");
return constructWebGLArray<WebGLUnsignedByteArray>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY));
}
-// Get the specified value from the array and return it wrapped as a JavaScript Number object to V8. Accesses outside the valid array range return "undefined".
-INDEXED_PROPERTY_GETTER(WebGLUnsignedByteArray)
-{
- INC_STATS("DOM.WebGLUnsignedByteArray.IndexedPropertyGetter");
- WebGLUnsignedByteArray* array = V8DOMWrapper::convertToNativeObject<WebGLUnsignedByteArray>(V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY, info.Holder());
-
- if ((index < 0) || (index >= array->length()))
- return v8::Undefined();
- unsigned char result;
- if (!array->get(index, result))
- return v8::Undefined();
- return v8::Number::New(result);
-}
-
-// Set the specified value in the array. Accesses outside the valid array range are silently ignored.
-INDEXED_PROPERTY_SETTER(WebGLUnsignedByteArray)
-{
- INC_STATS("DOM.WebGLUnsignedByteArray.IndexedPropertySetter");
- WebGLUnsignedByteArray* array = V8DOMWrapper::convertToNativeObject<WebGLUnsignedByteArray>(V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY, info.Holder());
-
- if ((index >= 0) && (index < array->length())) {
- if (!value->IsNumber())
- return throwError("Could not convert value argument to a number");
- array->set(index, value->NumberValue());
- }
- return value;
-}
-
-CALLBACK_FUNC_DECL(WebGLUnsignedByteArrayGet)
+v8::Handle<v8::Value> V8WebGLUnsignedByteArray::getCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedByteArray.get()");
return getWebGLArrayElement<WebGLUnsignedByteArray, unsigned char>(args, V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY);
}
-CALLBACK_FUNC_DECL(WebGLUnsignedByteArraySet)
+v8::Handle<v8::Value> V8WebGLUnsignedByteArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedByteArray.set()");
return setWebGLArray<WebGLUnsignedByteArray, V8WebGLUnsignedByteArray>(args, V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY);
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
index 92b9fe0..93ccbd4 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
@@ -44,48 +44,20 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLUnsignedIntArrayConstructor)
+v8::Handle<v8::Value> V8WebGLUnsignedIntArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedIntArray.Contructor");
return constructWebGLArray<WebGLUnsignedIntArray>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLUNSIGNEDINTARRAY));
}
-// Get the specified value from the integer array and return it wrapped as a JavaScript Number object to V8. Accesses outside the valid pixel buffer range return "undefined".
-INDEXED_PROPERTY_GETTER(WebGLUnsignedIntArray)
-{
- INC_STATS("DOM.WebGLUnsignedIntArray.IndexedPropertyGetter");
- WebGLUnsignedIntArray* array = V8DOMWrapper::convertToNativeObject<WebGLUnsignedIntArray>(V8ClassIndex::WEBGLUNSIGNEDINTARRAY, info.Holder());
-
- if ((index < 0) || (index >= array->length()))
- return v8::Undefined();
- unsigned int result;
- if (!array->get(index, result))
- return v8::Undefined();
- return v8::Number::New(result);
-}
-
-// Set the specified value in the integer array. Accesses outside the valid integer array range are silently ignored.
-INDEXED_PROPERTY_SETTER(WebGLUnsignedIntArray)
-{
- INC_STATS("DOM.WebGLUnsignedIntArray.IndexedPropertySetter");
- WebGLUnsignedIntArray* array = V8DOMWrapper::convertToNativeObject<WebGLUnsignedIntArray>(V8ClassIndex::WEBGLUNSIGNEDINTARRAY, info.Holder());
-
- if ((index >= 0) && (index < array->length())) {
- if (!value->IsNumber())
- return throwError("Could not convert value argument to a number");
- array->set(index, value->NumberValue());
- }
- return value;
-}
-
-CALLBACK_FUNC_DECL(WebGLUnsignedIntArrayGet)
+v8::Handle<v8::Value> V8WebGLUnsignedIntArray::getCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedIntArray.get()");
return getWebGLArrayElement<WebGLUnsignedIntArray, unsigned int>(args, V8ClassIndex::WEBGLUNSIGNEDINTARRAY);
}
-CALLBACK_FUNC_DECL(WebGLUnsignedIntArraySet)
+v8::Handle<v8::Value> V8WebGLUnsignedIntArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedIntArray.set()");
return setWebGLArray<WebGLUnsignedIntArray, V8WebGLUnsignedIntArray>(args, V8ClassIndex::WEBGLUNSIGNEDINTARRAY);
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
index ce261e9..d9e47cd 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
@@ -44,48 +44,20 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebGLUnsignedShortArrayConstructor)
+v8::Handle<v8::Value> V8WebGLUnsignedShortArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedShortArray.Contructor");
return constructWebGLArray<WebGLUnsignedShortArray>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY));
}
-// Get the specified value from the array and return it wrapped as a JavaScript Number object to V8. Accesses outside the valid array range return "undefined".
-INDEXED_PROPERTY_GETTER(WebGLUnsignedShortArray)
-{
- INC_STATS("DOM.WebGLUnsignedShortArray.IndexedPropertyGetter");
- WebGLUnsignedShortArray* array = V8DOMWrapper::convertToNativeObject<WebGLUnsignedShortArray>(V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY, info.Holder());
-
- if ((index < 0) || (index >= array->length()))
- return v8::Undefined();
- unsigned short result;
- if (!array->get(index, result))
- return v8::Undefined();
- return v8::Number::New(result);
-}
-
-// Set the specified value in the array. Accesses outside the valid array range are silently ignored.
-INDEXED_PROPERTY_SETTER(WebGLUnsignedShortArray)
-{
- INC_STATS("DOM.WebGLUnsignedShortArray.IndexedPropertySetter");
- WebGLUnsignedShortArray* array = V8DOMWrapper::convertToNativeObject<WebGLUnsignedShortArray>(V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY, info.Holder());
-
- if ((index >= 0) && (index < array->length())) {
- if (!value->IsNumber())
- return throwError("Could not convert value argument to a number");
- array->set(index, value->NumberValue());
- }
- return value;
-}
-
-CALLBACK_FUNC_DECL(WebGLUnsignedShortArrayGet)
+v8::Handle<v8::Value> V8WebGLUnsignedShortArray::getCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedShortArray.get()");
return getWebGLArrayElement<WebGLUnsignedShortArray, unsigned short>(args, V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY);
}
-CALLBACK_FUNC_DECL(WebGLUnsignedShortArraySet)
+v8::Handle<v8::Value> V8WebGLUnsignedShortArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLUnsignedShortArray.set()");
return setWebGLArray<WebGLUnsignedShortArray, V8WebGLUnsignedShortArray>(args, V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY);
diff --git a/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
index 4819064..55518d2 100644
--- a/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
@@ -29,7 +29,7 @@
*/
#include "config.h"
-#include "WebKitCSSMatrix.h"
+#include "V8WebKitCSSMatrix.h"
#include "Document.h"
#include "DocumentFragment.h"
@@ -44,7 +44,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WebKitCSSMatrixConstructor)
+v8::Handle<v8::Value> V8WebKitCSSMatrix::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebKitCSSMatrix.Constructor");
diff --git a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
index b2a807d..4e0d575 100755
--- a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
@@ -29,19 +29,19 @@
*/
#include "config.h"
+#include "V8WebKitPoint.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8DOMWrapper.h"
#include "V8Index.h"
#include "V8Proxy.h"
-#include "WebKitPoint.h"
#include <wtf/MathExtras.h>
namespace WebCore {
-CALLBACK_FUNC_DECL(WebKitPointConstructor)
+v8::Handle<v8::Value> V8WebKitPoint::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebKitPoint.Constructor");
float x = 0;
diff --git a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp b/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
index b20635b..2451b90 100644
--- a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
@@ -32,22 +32,23 @@
#if ENABLE(WEB_SOCKETS)
-#include "WebSocket.h"
+#include "V8WebSocket.h"
#include "Frame.h"
#include "Settings.h"
#include "V8Binding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
+#include "WebSocket.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
namespace WebCore {
-CALLBACK_FUNC_DECL(WebSocketAddEventListener)
+v8::Handle<v8::Value> V8WebSocket::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebSocket.addEventListener()");
- WebSocket* webSocket = V8DOMWrapper::convertToNativeObject<WebSocket>(V8ClassIndex::WEBSOCKET, args.Holder());
+ WebSocket* webSocket = V8WebSocket::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(webSocket, args[1], false, ListenerFindOrCreate);
if (listener) {
@@ -55,27 +56,27 @@ CALLBACK_FUNC_DECL(WebSocketAddEventListener)
bool useCapture = args[2]->BooleanValue();
webSocket->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kWebSocketCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WebSocketRemoveEventListener)
+v8::Handle<v8::Value> V8WebSocket::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebSocket.removeEventListener()");
- WebSocket* webSocket = V8DOMWrapper::convertToNativeObject<WebSocket>(V8ClassIndex::WEBSOCKET, args.Holder());
+ WebSocket* webSocket = V8WebSocket::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(webSocket, args[1], false, ListenerFindOnly);
if (listener) {
String type = toWebCoreString(args[0]);
bool useCapture = args[2]->BooleanValue();
webSocket->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kWebSocketCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WebSocketConstructor)
+v8::Handle<v8::Value> V8WebSocket::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebSocket.Constructor");
@@ -92,14 +93,9 @@ CALLBACK_FUNC_DECL(WebSocketConstructor)
return throwError("Empty URL", V8Proxy::SyntaxError);
// Get the script execution context.
- ScriptExecutionContext* context = 0;
- // TODO: Workers
- if (!context) {
- Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
- if (!frame)
- return throwError("WebSocket constructor's associated frame is not available", V8Proxy::ReferenceError);
- context = frame->document();
- }
+ ScriptExecutionContext* context = getScriptExecutionContext();
+ if (!context)
+ return throwError("WebSocket constructor's associated frame is not available", V8Proxy::ReferenceError);
const KURL& url = context->completeURL(toWebCoreString(urlstring));
@@ -128,10 +124,10 @@ CALLBACK_FUNC_DECL(WebSocketConstructor)
return args.Holder();
}
-CALLBACK_FUNC_DECL(WebSocketSend)
+v8::Handle<v8::Value> V8WebSocket::sendCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebSocket.send()");
- WebSocket* webSocket = V8DOMWrapper::convertToNativeObject<WebSocket>(V8ClassIndex::WEBSOCKET, args.Holder());
+ WebSocket* webSocket = V8WebSocket::toNative(args.Holder());
ExceptionCode ec = 0;
bool ret = false;
@@ -146,15 +142,6 @@ CALLBACK_FUNC_DECL(WebSocketSend)
return v8Boolean(ret);
}
-CALLBACK_FUNC_DECL(WebSocketClose)
-{
- INC_STATS("DOM.WebSocket.close()");
- WebSocket* webSocket = V8DOMWrapper::convertToNativeObject<WebSocket>(V8ClassIndex::WEBSOCKET, args.Holder());
-
- webSocket->close();
- return v8::Undefined();
-}
-
} // namespace WebCore
#endif // ENABLE(WEB_SOCKETS)
diff --git a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
index 9b68ac0..9d54f8e 100755
--- a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#if ENABLE(WORKERS)
+#include "V8WorkerContext.h"
#include "DOMTimer.h"
#include "ExceptionCode.h"
@@ -41,28 +42,29 @@
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "V8WorkerContextEventListener.h"
+#include "WebSocket.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
namespace WebCore {
#if ENABLE(NOTIFICATIONS)
-ACCESSOR_RUNTIME_ENABLER(WorkerContextWebkitNotifications)
+bool V8WorkerContext::WebkitNotificationsEnabled()
{
return RuntimeEnabledFeatures::notificationsEnabled();
}
#endif
-ACCESSOR_GETTER(WorkerContextSelf)
+#if ENABLE(WEB_SOCKETS)
+bool V8WorkerContext::WebSocketEnabled()
{
- INC_STATS(L"DOM.WorkerContext.self._get");
- WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(info.Holder());
- return WorkerContextExecutionProxy::convertWorkerContextToV8Object(workerContext);
+ return WebSocket::isAvailable();
}
+#endif
v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singleShot)
{
- WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(args.Holder());
+ WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
int argumentCount = args.Length();
if (argumentCount < 1)
@@ -94,7 +96,7 @@ v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singl
return v8::Integer::New(timerId);
}
-CALLBACK_FUNC_DECL(WorkerContextImportScripts)
+v8::Handle<v8::Value> V8WorkerContext::importScriptsCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.WorkerContext.importScripts()");
if (!args.Length())
@@ -117,7 +119,7 @@ CALLBACK_FUNC_DECL(WorkerContextImportScripts)
urls.append(toWebCoreString(scriptUrl));
}
- WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(args.Holder());
+ WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
ExceptionCode ec = 0;
workerContext->importScripts(urls, callerURL, callerLine, ec);
@@ -128,22 +130,22 @@ CALLBACK_FUNC_DECL(WorkerContextImportScripts)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WorkerContextSetTimeout)
+v8::Handle<v8::Value> V8WorkerContext::setTimeoutCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.WorkerContext.setTimeout()");
return SetTimeoutOrInterval(args, true);
}
-CALLBACK_FUNC_DECL(WorkerContextSetInterval)
+v8::Handle<v8::Value> V8WorkerContext::setIntervalCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.WorkerContext.setInterval()");
return SetTimeoutOrInterval(args, false);
}
-CALLBACK_FUNC_DECL(WorkerContextAddEventListener)
+v8::Handle<v8::Value> V8WorkerContext::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.WorkerContext.addEventListener()");
- WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(args.Holder());
+ WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(workerContext, args[1], false, ListenerFindOrCreate);
if (listener) {
@@ -151,15 +153,15 @@ CALLBACK_FUNC_DECL(WorkerContextAddEventListener)
bool useCapture = args[2]->BooleanValue();
workerContext->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kWorkerContextRequestCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(WorkerContextRemoveEventListener)
+v8::Handle<v8::Value> V8WorkerContext::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.WorkerContext.removeEventListener()");
- WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(args.Holder());
+ WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(workerContext, args[1], false, ListenerFindOnly);
if (listener) {
@@ -167,7 +169,7 @@ CALLBACK_FUNC_DECL(WorkerContextRemoveEventListener)
bool useCapture = args[2]->BooleanValue();
workerContext->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kWorkerContextRequestCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
diff --git a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
index 454e41f..ffca2a4 100755
--- a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#if ENABLE(WORKERS)
+#include "V8Worker.h"
#include "Worker.h"
@@ -47,7 +48,7 @@
namespace WebCore {
-CALLBACK_FUNC_DECL(WorkerConstructor)
+v8::Handle<v8::Value> V8Worker::constructorCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.Worker.Constructor");
@@ -87,11 +88,11 @@ CALLBACK_FUNC_DECL(WorkerConstructor)
return wrapperObject;
}
-CALLBACK_FUNC_DECL(WorkerPostMessage)
+v8::Handle<v8::Value> V8Worker::postMessageCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Worker.postMessage");
- Worker* worker = V8DOMWrapper::convertToNativeObject<Worker>(V8ClassIndex::WORKER, args.Holder());
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(toWebCoreString(args[0]));
+ Worker* worker = V8Worker::toNative(args.Holder());
+ RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0]);
MessagePortArray portArray;
if (args.Length() > 1) {
if (!getMessagePortArray(args[1], portArray))
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
index af647cd..e31e05f 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
@@ -29,19 +29,19 @@
*/
#include "config.h"
+#include "V8XMLHttpRequest.h"
#include "Frame.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
-#include "XMLHttpRequest.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
namespace WebCore {
-CALLBACK_FUNC_DECL(XMLHttpRequestConstructor)
+v8::Handle<v8::Value> V8XMLHttpRequest::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.Constructor");
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index c3e4645..d7cdcd1 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -29,32 +29,33 @@
*/
#include "config.h"
-#include "XMLHttpRequest.h"
+#include "V8XMLHttpRequest.h"
#include "Frame.h"
#include "V8Binding.h"
+#include "V8Blob.h"
#include "V8CustomBinding.h"
#include "V8Document.h"
-#include "V8File.h"
#include "V8HTMLDocument.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
+#include "XMLHttpRequest.h"
namespace WebCore {
-ACCESSOR_GETTER(XMLHttpRequestResponseText)
+v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.XMLHttpRequest.responsetext._get");
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, info.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
return xmlHttpRequest->responseText().v8StringOrNull();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestAddEventListener)
+v8::Handle<v8::Value> V8XMLHttpRequest::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.addEventListener()");
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, args.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(xmlHttpRequest, args[1], false, ListenerFindOrCreate);
if (listener) {
@@ -62,15 +63,15 @@ CALLBACK_FUNC_DECL(XMLHttpRequestAddEventListener)
bool useCapture = args[2]->BooleanValue();
xmlHttpRequest->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kXMLHttpRequestCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestRemoveEventListener)
+v8::Handle<v8::Value> V8XMLHttpRequest::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.removeEventListener()");
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, args.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(xmlHttpRequest, args[1], false, ListenerFindOnly);
if (listener) {
@@ -78,13 +79,13 @@ CALLBACK_FUNC_DECL(XMLHttpRequestRemoveEventListener)
bool useCapture = args[2]->BooleanValue();
xmlHttpRequest->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kXMLHttpRequestCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestOpen)
+v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.open()");
// Four cases:
@@ -96,7 +97,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestOpen)
if (args.Length() < 2)
return throwError("Not enough arguments", V8Proxy::SyntaxError);
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, args.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
String method = toWebCoreString(args[0]);
String urlstring = toWebCoreString(args[1]);
@@ -133,10 +134,10 @@ static bool IsDocumentType(v8::Handle<v8::Value> value)
return V8Document::HasInstance(value) || V8HTMLDocument::HasInstance(value);
}
-CALLBACK_FUNC_DECL(XMLHttpRequestSend)
+v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.send()");
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, args.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
ExceptionCode ec = 0;
if (args.Length() < 1)
@@ -145,14 +146,14 @@ CALLBACK_FUNC_DECL(XMLHttpRequestSend)
v8::Handle<v8::Value> arg = args[0];
if (IsDocumentType(arg)) {
v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
- Document* document = V8DOMWrapper::convertDOMWrapperToNode<Document>(object);
+ Document* document = V8Document::toNative(object);
ASSERT(document);
xmlHttpRequest->send(document, ec);
- } else if (V8File::HasInstance(arg)) {
+ } else if (V8Blob::HasInstance(arg)) {
v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
- File* file = V8DOMWrapper::convertDOMWrapperToNative<File>(object);
- ASSERT(file);
- xmlHttpRequest->send(file, ec);
+ Blob* blob = V8Blob::toNative(object);
+ ASSERT(blob);
+ xmlHttpRequest->send(blob, ec);
} else
xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec);
}
@@ -163,12 +164,13 @@ CALLBACK_FUNC_DECL(XMLHttpRequestSend)
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestSetRequestHeader) {
+v8::Handle<v8::Value> V8XMLHttpRequest::setRequestHeaderCallback(const v8::Arguments& args)
+{
INC_STATS("DOM.XMLHttpRequest.setRequestHeader()");
if (args.Length() < 2)
return throwError("Not enough arguments", V8Proxy::SyntaxError);
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, args.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
ExceptionCode ec = 0;
String header = toWebCoreString(args[0]);
String value = toWebCoreString(args[1]);
@@ -178,13 +180,13 @@ CALLBACK_FUNC_DECL(XMLHttpRequestSetRequestHeader) {
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestGetResponseHeader)
+v8::Handle<v8::Value> V8XMLHttpRequest::getResponseHeaderCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.getResponseHeader()");
if (args.Length() < 1)
return throwError("Not enough arguments", V8Proxy::SyntaxError);
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, args.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
ExceptionCode ec = 0;
String header = toWebCoreString(args[0]);
String result = xmlHttpRequest->getResponseHeader(header, ec);
@@ -193,19 +195,19 @@ CALLBACK_FUNC_DECL(XMLHttpRequestGetResponseHeader)
return v8StringOrNull(result);
}
-CALLBACK_FUNC_DECL(XMLHttpRequestOverrideMimeType)
+v8::Handle<v8::Value> V8XMLHttpRequest::overrideMimeTypeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.overrideMimeType()");
if (args.Length() < 1)
return throwError("Not enough arguments", V8Proxy::SyntaxError);
- XMLHttpRequest* xmlHttpRequest = V8DOMWrapper::convertToNativeObject<XMLHttpRequest>(V8ClassIndex::XMLHTTPREQUEST, args.Holder());
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
String value = toWebCoreString(args[0]);
xmlHttpRequest->overrideMimeType(value);
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestDispatchEvent)
+v8::Handle<v8::Value> V8XMLHttpRequest::dispatchEventCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.dispatchEvent()");
return v8::Undefined();
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
index 9323f71..0690189 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
@@ -29,7 +29,7 @@
*/
#include "config.h"
-#include "XMLHttpRequestUpload.h"
+#include "V8XMLHttpRequestUpload.h"
#include "ExceptionCode.h"
#include "V8Binding.h"
@@ -37,15 +37,16 @@
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "XMLHttpRequest.h"
+#include "XMLHttpRequestUpload.h"
#include <wtf/Assertions.h>
namespace WebCore {
-CALLBACK_FUNC_DECL(XMLHttpRequestUploadAddEventListener)
+v8::Handle<v8::Value> V8XMLHttpRequestUpload::addEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequestUpload.addEventListener()");
- XMLHttpRequestUpload* xmlHttpRequestUpload = V8DOMWrapper::convertToNativeObject<XMLHttpRequestUpload>(V8ClassIndex::XMLHTTPREQUESTUPLOAD, args.Holder());
+ XMLHttpRequestUpload* xmlHttpRequestUpload = V8XMLHttpRequestUpload::toNative(args.Holder());
XMLHttpRequest* xmlHttpRequest = xmlHttpRequestUpload->associatedXMLHttpRequest();
@@ -55,15 +56,15 @@ CALLBACK_FUNC_DECL(XMLHttpRequestUploadAddEventListener)
bool useCapture = args[2]->BooleanValue();
xmlHttpRequestUpload->addEventListener(type, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], V8Custom::kXMLHttpRequestCacheIndex);
+ createHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestUploadRemoveEventListener)
+v8::Handle<v8::Value> V8XMLHttpRequestUpload::removeEventListenerCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequestUpload.removeEventListener()");
- XMLHttpRequestUpload* xmlHttpRequestUpload = V8DOMWrapper::convertToNativeObject<XMLHttpRequestUpload>(V8ClassIndex::XMLHTTPREQUESTUPLOAD, args.Holder());
+ XMLHttpRequestUpload* xmlHttpRequestUpload = V8XMLHttpRequestUpload::toNative(args.Holder());
XMLHttpRequest* xmlHttpRequest = xmlHttpRequestUpload->associatedXMLHttpRequest();
@@ -73,13 +74,13 @@ CALLBACK_FUNC_DECL(XMLHttpRequestUploadRemoveEventListener)
bool useCapture = args[2]->BooleanValue();
xmlHttpRequestUpload->removeEventListener(type, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], V8Custom::kXMLHttpRequestCacheIndex);
+ removeHiddenDependency(args.Holder(), args[1], cacheIndex);
}
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XMLHttpRequestUploadDispatchEvent)
+v8::Handle<v8::Value> V8XMLHttpRequestUpload::dispatchEventCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequestUpload.dispatchEvent()");
return throwError(NOT_SUPPORTED_ERR);
diff --git a/WebCore/bindings/v8/custom/V8XMLSerializerConstructor.cpp b/WebCore/bindings/v8/custom/V8XMLSerializerConstructor.cpp
deleted file mode 100644
index dd1c3ad..0000000
--- a/WebCore/bindings/v8/custom/V8XMLSerializerConstructor.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "XMLSerializer.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-CALLBACK_FUNC_DECL(XMLSerializerConstructor)
-{
- INC_STATS("DOM.XMLSerializer.Constructor");
- return V8Proxy::constructDOMObject<V8ClassIndex::XMLSERIALIZER, XMLSerializer>(args);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
index 1ad7d4a..fd0305a 100644
--- a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
@@ -29,7 +29,7 @@
*/
#include "config.h"
-#include "XSLTProcessor.h"
+#include "V8XSLTProcessor.h"
#include "Document.h"
#include "DocumentFragment.h"
@@ -40,57 +40,58 @@
#include "V8Document.h"
#include "V8Node.h"
#include "V8Proxy.h"
+#include "XSLTProcessor.h"
#include <wtf/RefPtr.h>
namespace WebCore {
-CALLBACK_FUNC_DECL(XSLTProcessorConstructor)
+v8::Handle<v8::Value> V8XSLTProcessor::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XSLTProcessor.Constructor");
return V8Proxy::constructDOMObject<V8ClassIndex::XSLTPROCESSOR, XSLTProcessor>(args);
}
-CALLBACK_FUNC_DECL(XSLTProcessorImportStylesheet)
+v8::Handle<v8::Value> V8XSLTProcessor::importStylesheetCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XSLTProcessor.importStylesheet");
if (!V8Node::HasInstance(args[0]))
return v8::Undefined();
- XSLTProcessor* imp = V8DOMWrapper::convertToNativeObject<XSLTProcessor>(V8ClassIndex::XSLTPROCESSOR, args.Holder());
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
- Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0]));
+ Node* node = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
imp->importStylesheet(node);
return v8::Undefined();
}
-CALLBACK_FUNC_DECL(XSLTProcessorTransformToFragment)
+v8::Handle<v8::Value> V8XSLTProcessor::transformToFragmentCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XSLTProcessor.transformToFragment");
if (!V8Node::HasInstance(args[0]) || !V8Document::HasInstance(args[1]))
return v8::Undefined();
- XSLTProcessor* imp = V8DOMWrapper::convertToNativeObject<XSLTProcessor>(V8ClassIndex::XSLTPROCESSOR, args.Holder());
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
- Node* source = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0]));
- Document* owner = V8DOMWrapper::convertDOMWrapperToNode<Document>(v8::Handle<v8::Object>::Cast(args[1]));
+ Node* source = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ Document* owner = V8Document::toNative(v8::Handle<v8::Object>::Cast(args[1]));
RefPtr<DocumentFragment> result = imp->transformToFragment(source, owner);
return V8DOMWrapper::convertNodeToV8Object(result.release());
}
-CALLBACK_FUNC_DECL(XSLTProcessorTransformToDocument)
+v8::Handle<v8::Value> V8XSLTProcessor::transformToDocumentCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XSLTProcessor.transformToDocument");
if (!V8Node::HasInstance(args[0]))
return v8::Undefined();
- XSLTProcessor* imp = V8DOMWrapper::convertToNativeObject<XSLTProcessor>(V8ClassIndex::XSLTPROCESSOR, args.Holder());
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
- Node* source = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0]));
+ Node* source = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
if (!source)
return v8::Undefined();
@@ -102,13 +103,13 @@ CALLBACK_FUNC_DECL(XSLTProcessorTransformToDocument)
}
-CALLBACK_FUNC_DECL(XSLTProcessorSetParameter)
+v8::Handle<v8::Value> V8XSLTProcessor::setParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XSLTProcessor.setParameter");
if (isUndefinedOrNull(args[1]) || isUndefinedOrNull(args[2]))
return v8::Undefined();
- XSLTProcessor* imp = V8DOMWrapper::convertToNativeObject<XSLTProcessor>(V8ClassIndex::XSLTPROCESSOR, args.Holder());
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
String namespaceURI = toWebCoreString(args[0]);
String localName = toWebCoreString(args[1]);
@@ -119,13 +120,13 @@ CALLBACK_FUNC_DECL(XSLTProcessorSetParameter)
}
-CALLBACK_FUNC_DECL(XSLTProcessorGetParameter)
+v8::Handle<v8::Value> V8XSLTProcessor::getParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XSLTProcessor.getParameter");
if (isUndefinedOrNull(args[1]))
return v8::Undefined();
- XSLTProcessor* imp = V8DOMWrapper::convertToNativeObject<XSLTProcessor>(V8ClassIndex::XSLTPROCESSOR, args.Holder());
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
String namespaceURI = toWebCoreString(args[0]);
String localName = toWebCoreString(args[1]);
@@ -136,13 +137,13 @@ CALLBACK_FUNC_DECL(XSLTProcessorGetParameter)
return v8String(result);
}
-CALLBACK_FUNC_DECL(XSLTProcessorRemoveParameter)
+v8::Handle<v8::Value> V8XSLTProcessor::removeParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XSLTProcessor.removeParameter");
if (isUndefinedOrNull(args[1]))
return v8::Undefined();
- XSLTProcessor* imp = V8DOMWrapper::convertToNativeObject<XSLTProcessor>(V8ClassIndex::XSLTPROCESSOR, args.Holder());
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
String namespaceURI = toWebCoreString(args[0]);
String localName = toWebCoreString(args[1]);