summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-11-12 21:27:24 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-11-12 21:27:24 (GMT)
commitee752118ffafdcded996fea866f893d7cb018e2c (patch)
tree623808b170e3ea4d57314582b9e26eede3722ef3 /src
parentc95be52b02e921d4ba8b3e707cd2f6239ce9c99e (diff)
downloaduscxml-ee752118ffafdcded996fea866f893d7cb018e2c.zip
uscxml-ee752118ffafdcded996fea866f893d7cb018e2c.tar.gz
uscxml-ee752118ffafdcded996fea866f893d7cb018e2c.tar.bz2
Hopefully fixed unfortunate document.evaluate bug in ECMAScript bindings
Diffstat (limited to 'src')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp9
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp3
2 files changed, 10 insertions, 2 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp
index c6ee022..a6d194f 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp
@@ -24,6 +24,7 @@
#include "JSCXPathResult.h"
#include "JSCNode.h"
#include <XPath/XPath.hpp>
+#include <DOM/io/Stream.hpp>
namespace Arabica {
namespace DOM {
@@ -93,7 +94,13 @@ JSValueRef JSCDocument::evaluateCustomCallback(JSContextRef ctx, JSObjectRef fun
return JSValueMakeUndefined(ctx);
}
- Arabica::DOM::Node<std::string>* localContextNode = (Arabica::DOM::Node<std::string>*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[1], NULL));
+// Arabica::DOM::Node<std::string>* localContextNode = (Arabica::DOM::Node<std::string>*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[1], NULL));
+ JSCNode::JSCNodePrivate* otherNodePrivate = (JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[1], NULL));
+ Arabica::DOM::Node<std::string>* localContextNode = otherNodePrivate->nativeObj;
+
+// std::cout << *localContextNode << std::endl;
+// std::cout << ">>" << privData->dom->xpath->evaluate("//note/@importance", *localContextNode).asString() << "<<" << std::endl;
+
retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(localXPath, *localContextNode));
} else {
retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(localXPath, *privData->nativeObj));
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp
index 8659ccd..f9882f0 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp
@@ -59,7 +59,8 @@ v8::Handle<v8::Value> V8Document::evaluateCustomCallback(const v8::Arguments& ar
XPath::XPathValue<std::string>* retVal;
try {
if (args.Length() > 1) {
- Arabica::DOM::Node<std::string>* localContextNode = V8DOM::toClassPtr<Arabica::DOM::Node<std::string> >(args[1]->ToObject()->GetInternalField(0));
+ V8Node::V8NodePrivate* otherNodePrivate = V8DOM::toClassPtr<V8Node::V8NodePrivate>(args[1]->ToObject()->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localContextNode = otherNodePrivate->nativeObj;
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));