summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt13
-rw-r--r--contrib/dom/scripts/CodeGeneratorArabicaJSC.pm37
-rw-r--r--src/bindings/swig/php/uscxmlNativePHP.php2
-rw-r--r--src/uscxml/Factory.h2
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp309
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp3
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp43
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp49
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp34
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp53
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp3
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp54
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp13
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp40
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp3
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp29
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp2
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old104
34 files changed, 678 insertions, 142 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70d8a88..938e8ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -278,7 +278,7 @@ set(CMAKE_COMPILER_STRING "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION
# see http://www.mail-archive.com/cmake@cmake.org/msg23240.html
if (APPLE)
# add_definitions("-D_DARWIN_UNLIMITED_SELECT")
- set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
+# set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
# support leopard and above
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
foreach(FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS)
@@ -454,13 +454,14 @@ if (APPLE OR IOS)
list (APPEND USCXML_CORE_LIBS ${JSC_LIBRARY})
endif()
set(JSC_FOUND ON)
+else()
+ find_package(V8)
+ if (V8_FOUND)
+ include_directories(${V8_INCLUDE_DIR})
+ list (APPEND USCXML_OPT_LIBS ${V8_LIBRARY})
+ endif()
endif()
-find_package(V8)
-if (V8_FOUND)
- include_directories(${V8_INCLUDE_DIR})
- list (APPEND USCXML_OPT_LIBS ${V8_LIBRARY})
-endif()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SHARED})
find_package(SWI)
diff --git a/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm b/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm
index 390bee0..2de92a9 100644
--- a/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm
+++ b/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm
@@ -208,12 +208,12 @@ END
push(@headerContent, "\n static JSValueRef ${getter}(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);");
}
- # if ($extensions->{'CustomIndexedGetter'}) {
- # push(@headerContent, "\n static JSValueRef indexedPropertyCustomGetter(uint32_t, const JSC::AccessorInfo&);");
- # }
- # if ($extensions->{'CustomIndexedSetter'}) {
- # push(@headerContent, "\n static JSValueRef indexedPropertyCustomSetter(uint32_t, JSC::Local<JSC::Value>, const JSC::AccessorInfo&);");
- # }
+ if ($extensions->{'CustomIndexedGetter'}) {
+ push(@headerContent, "\n static JSValueRef indexedPropertyCustomGetter(uint32_t, const JSC::AccessorInfo&);");
+ }
+ if ($extensions->{'CustomIndexedSetter'}) {
+ push(@headerContent, "\n static JSValueRef indexedPropertyCustomSetter(uint32_t, JSC::Local<JSC::Value>, const JSC::AccessorInfo&);");
+ }
push(@headerContent, "\n");
push(@headerContent, <<END);
@@ -355,7 +355,7 @@ END
} elsif($JSCType eq "Number") {
push(@implContent, "\n return JSValueMakeNumber(ctx, privData->nativeObj->${wrapperGetter});\n");
} elsif($JSCType eq "Boolean") {
- push(@implContent, "\n return JSValueMakeNumber(ctx, privData->nativeObj->${wrapperGetter});\n");
+ push(@implContent, "\n return JSValueMakeBoolean(ctx, privData->nativeObj->${wrapperGetter});\n");
}
}
push(@implContent, " }\n\n");
@@ -378,6 +378,28 @@ END
}
}
}
+ foreach my $constant (@{$interface->constants}) {
+ my $name = $constant->name;
+ my $value = $constant->value;
+ my $getter = "${name}ConstGetter";
+ push(@implContent, " JSValueRef JSC${interfaceName}::${getter}(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {");
+ my $JSCType = IdlToJSCType($constant->type);
+ if ($JSCType eq "String") {
+ push(@implContent,
+ "\n JSStringRef jscString = JSStringCreateWithUTF8CString(" . $constant->value . ");".
+ "\n return JSValueMakeString(ctx, jscString);\n");
+ } elsif($JSCType eq "Number") {
+ push(@implContent, "\n return JSValueMakeNumber(ctx, " . $constant->value . ");\n");
+ } elsif($JSCType eq "Boolean") {
+ push(@implContent, "\n return JSValueMakeBoolean(ctx, " . $constant->value . ");\n");
+ }
+ push(@implContent, <<END);
+ }
+
+END
+
+ }
+
}
sub GenerateConditionalUndefReturn
@@ -491,6 +513,7 @@ sub GenerateImplementation
}
push(@implContent, "namespace Arabica {\n");
push(@implContent, "namespace DOM {\n\n");
+ push(@implContent, "JSClassRef JSC${interfaceName}::Tmpl;\n");
GenerateClassDefStatics($interface);
GenerateImplementationAttributes($interface);
diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php
index b16f074..451fb1d 100644
--- a/src/bindings/swig/php/uscxmlNativePHP.php
+++ b/src/bindings/swig/php/uscxmlNativePHP.php
@@ -2,7 +2,7 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.9
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h
index b3bfded..7b08982 100644
--- a/src/uscxml/Factory.h
+++ b/src/uscxml/Factory.h
@@ -277,7 +277,7 @@ public:
const std::string& content) = 0;
virtual void init(const std::string& location, const Data& data) = 0;
-protected:
+ // we need it public for various static functions
InterpreterImpl* _interpreter;
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index f856f96..174c33d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -2,6 +2,7 @@
#include "JSCDataModel.h"
#include "dom/JSCDOM.h"
#include "dom/JSCDocument.h"
+#include "dom/JSCSCXMLEvent.h"
#include "uscxml/Message.h"
#include <glog/logging.h>
@@ -23,27 +24,46 @@ bool connect(pluma::Host& host) {
JSCDataModel::JSCDataModel() {
}
+// functions need to be objects to hold private data in JSC
+JSClassDefinition JSCDataModel::jsInClassDef = { 0, 0, "In", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, jsIn, 0, 0, 0 };
+JSClassDefinition JSCDataModel::jsPrintClassDef = { 0, 0, "print", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, jsPrint, 0, 0, 0 };
+
boost::shared_ptr<DataModelImpl> JSCDataModel::create(InterpreterImpl* interpreter) {
boost::shared_ptr<JSCDataModel> dm = boost::shared_ptr<JSCDataModel>(new JSCDataModel());
dm->_ctx = JSGlobalContextCreate(NULL);
dm->_interpreter = interpreter;
- Arabica::DOM::JSCDOM* dom = new Arabica::DOM::JSCDOM();
- // dom->interpreter = interpreter;
- dom->xpath = new Arabica::XPath::XPath<std::string>();
- dom->xpath->setNamespaceContext(interpreter->getNSContext());
+ dm->_dom = new Arabica::DOM::JSCDOM();
+ dm->_dom->xpath = new Arabica::XPath::XPath<std::string>();
+ dm->_dom->xpath->setNamespaceContext(interpreter->getNSContext());
+
+ // introduce global functions as objects for private data
+ JSClassRef jsInClassRef = JSClassCreate(&jsInClassDef);
+ JSObjectRef jsIn = JSObjectMake(dm->_ctx, jsInClassRef, dm.get());
+ JSStringRef inName = JSStringCreateWithUTF8CString("In");
+ JSObjectSetProperty(dm->_ctx, JSContextGetGlobalObject(dm->_ctx), inName, jsIn, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(inName);
+
+ JSClassRef jsPrintClassRef = JSClassCreate(&jsPrintClassDef);
+ JSObjectRef jsPrint = JSObjectMake(dm->_ctx, jsPrintClassRef, dm.get());
+ JSStringRef printName = JSStringCreateWithUTF8CString("print");
+ JSObjectSetProperty(dm->_ctx, JSContextGetGlobalObject(dm->_ctx), printName, jsPrint, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(inName);
dm->eval("_ioprocessors = {};");
Arabica::DOM::JSCDocument::JSCDocumentPrivate* privData = new Arabica::DOM::JSCDocument::JSCDocumentPrivate();
privData->nativeObj = new Arabica::DOM::Document<std::string>(interpreter->getDocument());
- privData->dom = dom;
+ privData->dom = dm->_dom;
JSObjectRef documentObject = JSObjectMake(dm->_ctx, Arabica::DOM::JSCDocument::getTmpl(), privData);
JSObjectRef globalObject = JSContextGetGlobalObject(dm->_ctx);
JSObjectSetProperty(dm->_ctx, globalObject, JSStringCreateWithUTF8CString("document"), documentObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
+ dm->eval("_invokers = {};");
+ dm->eval("_x = {};");
+
return dm;
}
@@ -58,7 +78,76 @@ void JSCDataModel::popContext() {
}
void JSCDataModel::setEvent(const Event& event) {
- LOG(ERROR) << "setEvent not implemented in JSC";
+ Arabica::DOM::JSCSCXMLEvent::JSCSCXMLEventPrivate* privData = new Arabica::DOM::JSCSCXMLEvent::JSCSCXMLEventPrivate();
+ privData->nativeObj = new Event(event);
+ privData->dom = _dom;
+
+ JSObjectRef eventObj = JSObjectMake(_ctx, Arabica::DOM::JSCSCXMLEvent::getTmpl(), privData);
+ JSObjectRef globalObject = JSContextGetGlobalObject(_ctx);
+
+ JSValueRef exception = NULL;
+
+ if (event.dom) {
+ JSStringRef propName = JSStringCreateWithUTF8CString("data");
+ JSObjectSetProperty(_ctx, eventObj, propName, getDocumentAsValue(event.dom), 0, &exception);
+ JSStringRelease(propName);
+ if (exception)
+ handleException(exception);
+
+ } else if (event.content.length() > 0) {
+ // _event.data is a string or JSON
+ Data json = Data::fromJSON(event.content);
+ if (json) {
+ JSStringRef propName = JSStringCreateWithUTF8CString("data");
+ JSObjectSetProperty(_ctx, eventObj, propName, getDataAsValue(json), 0, &exception);
+ JSStringRelease(propName);
+ if (exception)
+ handleException(exception);
+ } else {
+ JSStringRef propName = JSStringCreateWithUTF8CString("data");
+ JSStringRef contentStr = JSStringCreateWithUTF8CString(Interpreter::spaceNormalize(event.content).c_str());
+ JSObjectSetProperty(_ctx, eventObj, propName, JSValueMakeString(_ctx, contentStr), 0, &exception);
+ JSStringRelease(propName);
+ JSStringRelease(contentStr);
+
+ if (exception)
+ handleException(exception);
+ }
+ } else {
+ // _event.data is KVP
+ Event eventCopy(event);
+ if (!eventCopy.params.empty()) {
+ Event::params_t::iterator paramIter = eventCopy.params.begin();
+ while(paramIter != eventCopy.params.end()) {
+ eventCopy.data.compound[paramIter->first] = Data(paramIter->second, Data::VERBATIM);
+ paramIter++;
+ }
+ }
+ if (!eventCopy.namelist.empty()) {
+ Event::namelist_t::iterator nameListIter = eventCopy.namelist.begin();
+ while(nameListIter != eventCopy.namelist.end()) {
+ eventCopy.data.compound[nameListIter->first] = Data(nameListIter->second, Data::VERBATIM);
+ nameListIter++;
+ }
+ }
+ if (eventCopy.data > 0) {
+ JSStringRef propName = JSStringCreateWithUTF8CString("data");
+ JSObjectSetProperty(_ctx, eventObj, propName, getDataAsValue(eventCopy.data), 0, &exception);
+ JSStringRelease(propName);
+ if (exception)
+ handleException(exception);
+ } else {
+ // test 343 / test 488
+ JSStringRef propName = JSStringCreateWithUTF8CString("data");
+ JSObjectSetProperty(_ctx, eventObj, propName, JSValueMakeUndefined(_ctx), 0, &exception);
+ JSStringRelease(propName);
+ if (exception)
+ handleException(exception);
+ }
+ }
+
+ JSObjectSetProperty(_ctx, globalObject, JSStringCreateWithUTF8CString("_event"), eventObj, kJSPropertyAttributeDontDelete, NULL);
+
}
Data JSCDataModel::getStringAsData(const std::string& content) {
@@ -67,6 +156,45 @@ Data JSCDataModel::getStringAsData(const std::string& content) {
return data;
}
+JSValueRef JSCDataModel::getDataAsValue(const Data& data) {
+ JSValueRef exception = NULL;
+
+ if (data.compound.size() > 0) {
+ JSObjectRef value = JSObjectMake(_ctx, 0, 0);
+ std::map<std::string, Data>::const_iterator compoundIter = data.compound.begin();
+ while(compoundIter != data.compound.end()) {
+ JSStringRef key = JSStringCreateWithUTF8CString(compoundIter->first.c_str());
+ JSObjectSetProperty(_ctx, value, key, getDataAsValue(compoundIter->second), 0, &exception);
+ JSStringRelease(key);
+ if (exception)
+ handleException(exception);
+ compoundIter++;
+ }
+ return value;
+ }
+ if (data.array.size() > 0) {
+ JSValueRef elements[data.array.size()];
+ std::list<Data>::const_iterator arrayIter = data.array.begin();
+ uint32_t index = 0;
+ while(arrayIter != data.array.end()) {
+ elements[index++] = getDataAsValue(*arrayIter);
+ arrayIter++;
+ }
+ JSObjectRef value = JSObjectMakeArray(_ctx, data.array.size(), elements, &exception);
+ if (exception)
+ handleException(exception);
+ return value;
+ }
+ if (data.type == Data::VERBATIM) {
+ JSStringRef stringRef = JSStringCreateWithUTF8CString(data.atom.c_str());
+ JSValueRef value = JSValueMakeString(_ctx, stringRef);
+ JSStringRelease(stringRef);
+ return value;
+ } else {
+ return evalAsValue(data.atom);
+ }
+}
+
Data JSCDataModel::getValueAsData(const JSValueRef value) {
Data data;
JSValueRef exception = NULL;
@@ -92,7 +220,7 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) {
char* buf = (char*)malloc(JSStringGetMaximumUTF8CStringSize(stringValue));
JSStringGetUTF8CString(stringValue, buf, sizeof(buf));
- data.atom = std::string(buf, sizeof(buf));
+ data.atom = std::string(buf);
free(buf);
break;
}
@@ -108,7 +236,7 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) {
JSStringRef stringValue = JSPropertyNameArrayGetNameAtIndex(properties, i);
char* buf = (char*)malloc(JSStringGetMaximumUTF8CStringSize(stringValue));
JSStringGetUTF8CString(stringValue, buf, sizeof(buf));
- std::string property(buf, sizeof(buf));
+ std::string property(buf);
if (!isNumeric(property.c_str(), 10))
isArray = false;
propertySet.insert(property);
@@ -143,8 +271,8 @@ bool JSCDataModel::validate(const std::string& location, const std::string& sche
}
uint32_t JSCDataModel::getLength(const std::string& expr) {
- LOG(ERROR) << "I am not sure whether getLength() works :(";
- JSValueRef result = evalAsValue(expr);
+// LOG(ERROR) << "I am not sure whether getLength() works :(";
+ JSValueRef result = evalAsValue("(" + expr + ").length");
JSValueRef exception = NULL;
double length = JSValueToNumber(_ctx, result, &exception);
if (exception)
@@ -153,6 +281,29 @@ uint32_t JSCDataModel::getLength(const std::string& expr) {
return (uint32_t)length;
}
+void JSCDataModel::setForeach(const std::string& item,
+ const std::string& array,
+ const std::string& index,
+ uint32_t iteration) {
+ if (!isDeclared(item)) {
+ assign(item, Data());
+ }
+ // assign array element to item
+ std::stringstream ss;
+ ss << array << "[" << iteration << "]";
+ assign(item, ss.str());
+ if (index.length() > 0) {
+ // assign iteration element to index
+ std::stringstream ss;
+ ss << iteration;
+ assign(index, ss.str());
+ }
+}
+
+bool JSCDataModel::isDeclared(const std::string& expr) {
+ return true;
+}
+
void JSCDataModel::eval(const std::string& expr) {
evalAsValue(expr);
}
@@ -165,48 +316,170 @@ bool JSCDataModel::evalAsBool(const std::string& expr) {
std::string JSCDataModel::evalAsString(const std::string& expr) {
JSValueRef result = evalAsValue(expr);
JSValueRef exception = NULL;
+
JSStringRef stringValue = JSValueToStringCopy( _ctx, result, &exception);
if (exception)
handleException(exception);
- char* data = (char*)malloc(JSStringGetMaximumUTF8CStringSize(stringValue));
- JSStringGetUTF8CString(stringValue, data, sizeof(data));
- std::string retString(data, sizeof(data));
+ size_t maxSize = JSStringGetMaximumUTF8CStringSize(stringValue);
+ char data[maxSize];
+ JSStringGetUTF8CString(stringValue, data, maxSize);
+ std::string retString(data);
JSStringRelease(stringValue);
- free(data);
+
return retString;
}
-JSValueRef JSCDataModel::evalAsValue(const std::string& expr) {
+JSValueRef JSCDataModel::evalAsValue(const std::string& expr, bool dontThrow) {
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
JSValueRef result = JSEvaluateScript(_ctx, scriptJS, NULL, NULL, 0, &exception);
- if (exception)
+ JSStringRelease(scriptJS);
+
+ if (exception && !dontThrow)
handleException(exception);
- JSStringRelease(scriptJS);
return result;
}
void JSCDataModel::assign(const Arabica::DOM::Element<std::string>& assignElem,
const Arabica::DOM::Document<std::string>& doc,
const std::string& content) {
+ std::string key;
+ JSValueRef exception = NULL;
+ if (HAS_ATTR(assignElem, "id")) {
+ key = ATTR(assignElem, "id");
+ } else if (HAS_ATTR(assignElem, "location")) {
+ key = ATTR(assignElem, "location");
+ }
+ if (key.length() == 0)
+ throw Event("error.execution", Event::PLATFORM);
+
+ if (HAS_ATTR(assignElem, "expr")) {
+ evalAsValue(key + " = " + ATTR(assignElem, "expr"));
+ } else if (doc) {
+ JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), JSStringCreateWithUTF8CString(key.c_str()), getDocumentAsValue(doc), 0, &exception);
+ if (exception)
+ handleException(exception);
+ } else if (content.size() > 0) {
+ try {
+ evalAsValue(key + " = " + content);
+ } catch (...) {
+ evalAsValue(key + " = " + "\"" + Interpreter::spaceNormalize(content) + "\"");
+ }
+ } else {
+ JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), JSStringCreateWithUTF8CString(key.c_str()), JSValueMakeUndefined(_ctx), 0, &exception);
+ if (exception)
+ handleException(exception);
+ }
+}
+
+JSValueRef JSCDataModel::getDocumentAsValue(const Arabica::DOM::Document<std::string>& doc) {
+
+ struct Arabica::DOM::JSCDocument::JSCDocumentPrivate* retPrivData = new Arabica::DOM::JSCDocument::JSCDocumentPrivate();
+ retPrivData->dom = _dom;
+ retPrivData->nativeObj = new Arabica::DOM::Document<std::string>(doc);
+
+ JSObjectRef retObj = JSObjectMake(_ctx, Arabica::DOM::JSCDocument::getTmpl(), retPrivData);
+
+ return retObj;
}
void JSCDataModel::assign(const std::string& location, const Data& data) {
+ std::stringstream ssJSON;
+ ssJSON << data;
+ evalAsValue(location + " = " + ssJSON.str());
}
void JSCDataModel::init(const Arabica::DOM::Element<std::string>& dataElem,
const Arabica::DOM::Document<std::string>& doc,
const std::string& content) {
+ try {
+ assign(dataElem, doc, content);
+ } catch (Event e) {
+ // test 277
+ std::string key;
+ if (HAS_ATTR(dataElem, "id")) {
+ key = ATTR(dataElem, "id");
+ } else if (HAS_ATTR(dataElem, "location")) {
+ key = ATTR(dataElem, "location");
+ }
+ evalAsValue(key + " = undefined", true);
+ throw e;
+ }
}
void JSCDataModel::init(const std::string& location, const Data& data) {
+ try {
+ assign(location, data);
+ } catch (Event e) {
+ // test 277
+ evalAsValue(location + " = undefined", true);
+ throw e;
+ }
}
void JSCDataModel::handleException(JSValueRef exception) {
- assert(false);
+ JSStringRef exceptionStringRef = JSValueToStringCopy(_ctx, exception, NULL);
+ size_t maxSize = JSStringGetMaximumUTF8CStringSize(exceptionStringRef);
+ char buffer[maxSize];
+ JSStringGetUTF8CString(exceptionStringRef, buffer, maxSize);
+ JSStringRelease(exceptionStringRef);
+ std::string exceptionMsg(buffer);
+
+ Event exceptionEvent;
+ exceptionEvent.data.compound["exception"] = Data(exceptionMsg, Data::VERBATIM);
+ exceptionEvent.name = "error.execution";
+ exceptionEvent.type = Event::PLATFORM;
+
+ throw(exceptionEvent);
+
+}
+
+JSValueRef JSCDataModel::jsPrint(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
+ JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(function);
+
+ for (unsigned int i = 0; i < argumentCount; i++) {
+ if (JSValueIsString(ctx, arguments[i])) {
+ JSStringRef stringRef = JSValueToStringCopy(ctx, arguments[i], exception);
+ if (*exception)
+ INSTANCE->handleException(*exception);
+
+ size_t maxSize = JSStringGetMaximumUTF8CStringSize(stringRef);
+ char* buffer = new char[maxSize];
+
+ JSStringGetUTF8CString(stringRef, buffer, maxSize);
+ std::string msg(buffer);
+
+ std::cout << msg;
+ }
+ }
+ return JSValueMakeUndefined(ctx);
+}
+
+JSValueRef JSCDataModel::jsIn(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
+ JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(function);
+
+ for (unsigned int i = 0; i < argumentCount; i++) {
+ if (JSValueIsString(ctx, arguments[i])) {
+ JSStringRef stringRef = JSValueToStringCopy(ctx, arguments[i], exception);
+ if (*exception)
+ INSTANCE->handleException(*exception);
+
+ size_t maxSize = JSStringGetMaximumUTF8CStringSize(stringRef);
+ char* buffer = new char[maxSize];
+
+ JSStringGetUTF8CString(stringRef, buffer, maxSize);
+ std::string stateName(buffer);
+ if (Interpreter::isMember(INSTANCE->_interpreter->getState(stateName), INSTANCE->_interpreter->getConfiguration())) {
+ continue;
+ }
+ }
+ return JSValueMakeBoolean(ctx, false);
+ }
+ return JSValueMakeBoolean(ctx, true);
+
}
} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
index f99551b..28a313e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
@@ -4,6 +4,7 @@
#include "uscxml/Interpreter.h"
#include <list>
#include <JavaScriptCore/JavaScriptCore.h>
+#include "dom/JSCDOM.h"
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
@@ -58,8 +59,17 @@ public:
virtual void init(const std::string& location, const Data& data);
protected:
+ Arabica::DOM::JSCDOM* _dom;
+
+ static JSClassDefinition jsInClassDef;
+ static JSValueRef jsIn(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+ static JSClassDefinition jsPrintClassDef;
+ static JSValueRef jsPrint(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+ JSValueRef getDocumentAsValue(const Arabica::DOM::Document<std::string>& doc);
+ JSValueRef getDataAsValue(const Data& data);
Data getValueAsData(const JSValueRef value);
- JSValueRef evalAsValue(const std::string& expr);
+ JSValueRef evalAsValue(const std::string& expr, bool dontThrow = false);
void handleException(JSValueRef exception);
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp
index 62b6e9d..4de0efa 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp
@@ -5,6 +5,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCAttr::Tmpl;
JSStaticValue JSCAttr::staticValues[] = {
{ "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
@@ -29,7 +30,7 @@ JSValueRef JSCAttr::nameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStrin
JSValueRef JSCAttr::specifiedAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object);
- return JSValueMakeNumber(ctx, privData->nativeObj->getSpecified());
+ return JSValueMakeBoolean(ctx, privData->nativeObj->getSpecified());
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp
index c735084..4a6fd86 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCCDATASection::Tmpl;
JSStaticValue JSCCDATASection::staticValues[] = {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp
index 4d55722..46dbdae 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCCharacterData::Tmpl;
JSStaticValue JSCCharacterData::staticValues[] = {
{ "data", dataAttrGetter, dataAttrSetter, kJSPropertyAttributeDontDelete },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp
index b9aa25c..344e795 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCComment::Tmpl;
JSStaticValue JSCComment::staticValues[] = {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp
index e54d260..66c9666 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp
@@ -5,6 +5,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCDOMImplementation::Tmpl;
JSStaticValue JSCDOMImplementation::staticValues[] = {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp
index a3c394e..ed12bb0 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp
@@ -15,6 +15,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCDocument::Tmpl;
JSStaticValue JSCDocument::staticValues[] = {
{ "doctype", doctypeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp
new file mode 100644
index 0000000..23cc0f9
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp
@@ -0,0 +1,43 @@
+#include "JSCDocument.h"
+#include "JSCXPathResult.h"
+
+namespace Arabica {
+namespace DOM {
+
+
+JSValueRef JSCDocument::evaluateCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
+#if 0
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in evaluate");
+// if (!((V8Node::hasInstance(args[1])) && (V8XPathResult::hasInstance(args[3]))))
+// throw V8Exception("Parameter mismatch while calling evaluate");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+
+ v8::String::AsciiValue localExpression(args[0]);
+
+ XPath::XPathValue<std::string>* retVal;
+ if (args.Length() > 1) {
+ Arabica::DOM::Node<std::string>* localContextNode = V8DOM::toClassPtr<Arabica::DOM::Node<std::string> >(args[1]->ToObject()->GetInternalField(0));
+ retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *localContextNode));
+ } else {
+ retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *privData->nativeObj));
+ }
+
+ v8::Handle<v8::Function> retCtor = V8XPathResult::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ V8XPathResult::V8XPathResultPrivate* retPrivData = new V8XPathResult::V8XPathResultPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8XPathResult::jsDestructor);
+ return retObj;
+#endif
+}
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp
index 77203a7..4bcbb21 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCDocumentFragment::Tmpl;
JSStaticValue JSCDocumentFragment::staticValues[] = {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp
index 0d9d059..07bfbc1 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp
@@ -5,6 +5,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCDocumentType::Tmpl;
JSStaticValue JSCDocumentType::staticValues[] = {
{ "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp
index 4b885f0..aa4b242 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp
@@ -6,6 +6,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCElement::Tmpl;
JSStaticValue JSCElement::staticValues[] = {
{ "tagName", tagNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp
index 717b5dd..9466f27 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCEntity::Tmpl;
JSStaticValue JSCEntity::staticValues[] = {
{ "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp
index a8aac23..ea6c41e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCEntityReference::Tmpl;
JSStaticValue JSCEntityReference::staticValues[] = {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp
index 9b344d2..aeb0913 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCNamedNodeMap::Tmpl;
JSStaticValue JSCNamedNodeMap::staticValues[] = {
{ "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp
index 54e7139..fc7513b 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp
@@ -5,6 +5,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCNode::Tmpl;
JSStaticValue JSCNode::staticValues[] = {
{ "nodeName", nodeNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
@@ -238,6 +239,54 @@ JSValueRef JSCNode::localNameAttrGetter(JSContextRef ctx, JSObjectRef object, JS
return JSValueMakeString(ctx, stringRef);
}
+JSValueRef JSCNode::ELEMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 1);
+}
+
+JSValueRef JSCNode::ATTRIBUTE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 2);
+}
+
+JSValueRef JSCNode::TEXT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 3);
+}
+
+JSValueRef JSCNode::CDATA_SECTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 4);
+}
+
+JSValueRef JSCNode::ENTITY_REFERENCE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 5);
+}
+
+JSValueRef JSCNode::ENTITY_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 6);
+}
+
+JSValueRef JSCNode::PROCESSING_INSTRUCTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 7);
+}
+
+JSValueRef JSCNode::COMMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 8);
+}
+
+JSValueRef JSCNode::DOCUMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 9);
+}
+
+JSValueRef JSCNode::DOCUMENT_TYPE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 10);
+}
+
+JSValueRef JSCNode::DOCUMENT_FRAGMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 11);
+}
+
+JSValueRef JSCNode::NOTATION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 12);
+}
+
JSValueRef JSCNode::insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
if (argumentCount < 2) {
std::string errorMsg = "Wrong number of arguments in insertBefore";
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp
new file mode 100644
index 0000000..82965ad
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp
@@ -0,0 +1,34 @@
+#include "JSCNode.h"
+#include "JSCNamedNodeMap.h"
+
+namespace Arabica {
+namespace DOM {
+
+JSValueRef JSCNode::attributesCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
+#if 0
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ if (!privData->nativeObj->hasAttributes()) {
+ return v8::Undefined();
+ }
+
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
+
+#endif
+}
+
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp
index 60c47e8..b6e5723 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCNodeList::Tmpl;
JSStaticValue JSCNodeList::staticValues[] = {
{ "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp
new file mode 100644
index 0000000..788c8ec
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp
@@ -0,0 +1,53 @@
+#include "JSCNodeList.h"
+#include "JSCElement.h"
+#include "JSCNode.h"
+
+namespace Arabica {
+namespace DOM {
+
+#if 0
+v8::Handle<v8::Value> V8NodeList::indexedPropertyCustomGetter(uint32_t index, const v8::AccessorInfo &info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+
+ if (privData->nativeObj->getLength() >= index) {
+ switch(privData->nativeObj->item(index).getNodeType()) {
+ case Node_base::ELEMENT_NODE: {
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->item(index));
+
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
+ }
+ default: {
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(index));
+
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+ }
+ }
+ }
+
+ return v8::Undefined();
+
+}
+#endif
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp
index c2b56c1..3aad9a4 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp
@@ -3,6 +3,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCNodeSet::Tmpl;
JSStaticValue JSCNodeSet::staticValues[] = {
{ "size", sizeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
@@ -26,7 +27,7 @@ JSValueRef JSCNodeSet::sizeAttrGetter(JSContextRef ctx, JSObjectRef object, JSSt
JSValueRef JSCNodeSet::emptyAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(object);
- return JSValueMakeNumber(ctx, privData->nativeObj->empty());
+ return JSValueMakeBoolean(ctx, privData->nativeObj->empty());
}
JSValueRef JSCNodeSet::toDocumentOrderCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp
new file mode 100644
index 0000000..1591310
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp
@@ -0,0 +1,54 @@
+#include "JSCNodeSet.h"
+#include "JSCElement.h"
+#include "JSCNode.h"
+
+namespace Arabica {
+namespace DOM {
+
+#if 0
+v8::Handle<v8::Value> V8NodeSet::indexedPropertyCustomGetter(uint32_t index, const v8::AccessorInfo &info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+
+ if (privData->nativeObj->size() >= index) {
+ switch((*privData->nativeObj)[index].getNodeType()) {
+ case Node_base::ELEMENT_NODE: {
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>((*privData->nativeObj)[index]);
+
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
+ }
+ default: {
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>((*privData->nativeObj)[index]);
+
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+ }
+ }
+ }
+
+ return v8::Undefined();
+
+}
+#endif
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp
index ba6d506..35cdc61 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCNotation::Tmpl;
JSStaticValue JSCNotation::staticValues[] = {
{ "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp
index 864f455..037af1b 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCProcessingInstruction::Tmpl;
JSStaticValue JSCProcessingInstruction::staticValues[] = {
{ "target", targetAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp
index 2e43005..ba95603 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCSCXMLEvent::Tmpl;
JSStaticValue JSCSCXMLEvent::staticValues[] = {
{ "type", typeCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
@@ -88,6 +89,18 @@ JSValueRef JSCSCXMLEvent::invokeidAttrGetter(JSContextRef ctx, JSObjectRef objec
return JSValueMakeString(ctx, stringRef);
}
+JSValueRef JSCSCXMLEvent::INTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 1);
+}
+
+JSValueRef JSCSCXMLEvent::EXTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 2);
+}
+
+JSValueRef JSCSCXMLEvent::PLATFORMConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
+ return JSValueMakeNumber(ctx, 3);
+}
+
}
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp
new file mode 100644
index 0000000..f36e544
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp
@@ -0,0 +1,40 @@
+#include "JSCSCXMLEvent.h"
+
+namespace Arabica {
+namespace DOM {
+
+JSValueRef JSCSCXMLEvent::typeCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
+#if 0
+ v8::Local<v8::Object> self = info.Holder();
+ V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+
+ switch (privData->nativeObj->type) {
+ case uscxml::Event::INTERNAL:
+ return v8::String::New("internal");
+ break;
+ case uscxml::Event::EXTERNAL:
+ return v8::String::New("external");
+ break;
+ case uscxml::Event::PLATFORM:
+ return v8::String::New("platform");
+ break;
+ default:
+ break;
+ }
+ return v8::String::New("unknown");
+#endif
+}
+
+JSValueRef JSCSCXMLEvent::sendidCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
+#if 0
+ v8::Local<v8::Object> self = info.Holder();
+ V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+
+ if (privData->nativeObj->sendid.length() == 0 || privData->nativeObj->hideSendId)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->sendid.c_str());
+#endif
+}
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp
index 231823b..ba0b992 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCText::Tmpl;
JSStaticValue JSCText::staticValues[] = {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp
index d8dcbed..4ac7d17 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp
@@ -4,6 +4,7 @@
namespace Arabica {
namespace DOM {
+JSClassRef JSCXPathResult::Tmpl;
JSStaticValue JSCXPathResult::staticValues[] = {
{ "numberValue", numberValueAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
@@ -39,7 +40,7 @@ JSValueRef JSCXPathResult::stringValueAttrGetter(JSContextRef ctx, JSObjectRef o
JSValueRef JSCXPathResult::booleanValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(object);
- return JSValueMakeNumber(ctx, privData->nativeObj->asBool());
+ return JSValueMakeBoolean(ctx, privData->nativeObj->asBool());
}
JSValueRef JSCXPathResult::asNodeSetCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp
new file mode 100644
index 0000000..90abfa3
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp
@@ -0,0 +1,29 @@
+#include "JSCXPathResult.h"
+#include "JSCNode.h"
+
+namespace Arabica {
+namespace DOM {
+
+JSValueRef JSCXPathResult::singleNodeValueCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
+#if 0
+ v8::Local<v8::Object> self = info.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->asNodeSet()[0]);
+
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+#endif
+}
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index 34dd524..420f1bb 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -171,7 +171,7 @@ void V8DataModel::setEvent(const Event& event) {
nameListIter++;
}
}
- if (eventCopy.data.compound.size() > 0) {
+ if (eventCopy.data > 0) {
eventObj->Set(v8::String::New("data"), getDataAsValue(eventCopy.data)); // set data part of _event
} else {
// test 343 / test 488
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old
deleted file mode 100644
index 680c433..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef V8DOCUMENT_H_COKK9O3L
-#define V8DOCUMENT_H_COKK9O3L
-
-#include "V8DOM.h"
-#include "V8Node.h"
-
-namespace uscxml {
-
- class V8Document {
- public:
- static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> createElementCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> createEventCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> createExpressionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createNSResolverCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> evaluateCallback(const v8::Arguments& args);
-
- V8_DESTRUCTOR(Arabica::DOM::Document<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Document"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("createElement"),
- v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
- v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createTextNode"),
- v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createComment"),
- v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createCDATASection"),
- v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
- v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttribute"),
- v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createEntityReference"),
- v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("importNode"),
- v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createElementNS"),
- v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttributeNS"),
- v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementById"),
- v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createEvent"),
- v8::FunctionTemplate::New(V8Document::createEventCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createExpression"),
- v8::FunctionTemplate::New(V8Document::createExpressionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createNSResolver"),
- v8::FunctionTemplate::New(V8Document::createNSResolverCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("evaluate"),
- v8::FunctionTemplate::New(V8Document::evaluateCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
-
-}
-
-
-#endif /* end of include guard: V8DOCUMENT_H_COKK9O3L */