summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ebb94e)
raw | patch | inline | side by side (parent: 3ebb94e)
author | ishmal <ishmal@users.sourceforge.net> | |
Wed, 30 Aug 2006 14:56:24 +0000 (14:56 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Wed, 30 Aug 2006 14:56:24 +0000 (14:56 +0000) |
diff --git a/src/dom/dom.h b/src/dom/dom.h
index e195dae7d5618ac9f381607d804aadcb1512d5d5..de353207422b6691decf08c797feaf338a8626ec 100644 (file)
--- a/src/dom/dom.h
+++ b/src/dom/dom.h
/**
*
*/
- virtual DOMImplementation *getDOMImplementation(unsigned long index)
+ virtual DOMImplementation *item(unsigned long index)
{
if (index >implementations.size())
return NULL;
/**
*
*/
- virtual DOMString getTextContext() throw(DOMException) = 0;
+ virtual DOMString getTextContent() throw(DOMException) = 0;
/**
*
*/
- virtual void setTextContext(const DOMString &val) throw(DOMException) = 0;
+ virtual void setTextContent(const DOMString &val) throw(DOMException) = 0;
/**
diff --git a/src/dom/domconfig.h b/src/dom/domconfig.h
index 41dce7a10756e3f08f2d0414b581e5a327f8b6b4..053e99712299d7f56dc7a48828cfb6e83dc2996e 100644 (file)
--- a/src/dom/domconfig.h
+++ b/src/dom/domconfig.h
* or GlibMM's Glib::ustring. If neither one is defined, then DOMString
* is defined as stdc++'s std::string.
*/
-#define DOM_STRING_GLIBMM
+//#define DOM_STRING_GLIBMM
//#define DOM_STRING_OWN
diff --git a/src/dom/domimpl.cpp b/src/dom/domimpl.cpp
index ecbfd123d364da4775ef7287c7b04a9c998c7444..5107518953330d312b70e927189703dcbf7717f3 100644 (file)
--- a/src/dom/domimpl.cpp
+++ b/src/dom/domimpl.cpp
const Node *refChild)
throw(DOMException)
{
- Node *node = NULL;
- return node;
+ if (!newChild)
+ return NULL;
+
+ //if no ref, then just append
+ if (!refChild)
+ return appendChild(newChild);
+
+ NodeImpl *newChildImpl = dynamic_cast<NodeImpl *>((Node *)newChild);
+ for (NodeImpl *n = firstChild ; n ; n=n->next)
+ {
+ if (n == refChild)
+ {
+ //link to new
+ if (n->prev)
+ n->prev->next = newChildImpl;
+ else
+ firstChild = newChildImpl;
+ n->prev = newChildImpl;
+ //link from new
+ newChildImpl->next = n;
+ newChildImpl->prev = n->prev;
+ //reflect new location
+ newChildImpl->parent = this;
+ newChildImpl->ownerDocument = ownerDocument;
+ return n;
+ }
+ }
+ return NULL;
}
/**
const Node *oldChild)
throw(DOMException)
{
- Node *node = NULL;
- return node;
+ if (!oldChild)
+ return NULL;
+
+ NodeImpl *newChildImpl = dynamic_cast<NodeImpl *>((Node *)newChild);
+ for (NodeImpl *n = firstChild ; n ; n=n->next)
+ {
+ if (n == oldChild)
+ {
+ //link to new
+ if (n->prev)
+ n->prev->next = newChildImpl;
+ else
+ firstChild = newChildImpl;
+ if (n->next)
+ n->next->prev = newChildImpl;
+ else
+ lastChild = newChildImpl;
+ //link from new
+ newChildImpl->next = n->next;
+ newChildImpl->prev = n->prev;
+ //reflect new location
+ newChildImpl->parent = this;
+ newChildImpl->ownerDocument = ownerDocument;
+ return n;
+ }
+ }
+ return NULL;
}
/**
Node *NodeImpl::removeChild(const Node *oldChild)
throw(DOMException)
{
- Node *node = NULL;
- return node;
+ if (!oldChild)
+ return NULL;
+
+ for (NodeImpl *n = firstChild ; n ; n=n->next)
+ {
+ if (n == oldChild)
+ {
+ if (n->prev)
+ n->prev->next = n->next;
+ if (n->next)
+ n->next->prev = n->prev;
+ return n;
+ }
+ }
+ return NULL;
}
/**
if (!newChild)
return NULL;
- Node *child = (Node *)newChild;
- NodeImpl *childImpl = dynamic_cast<NodeImpl *> (child);
+ NodeImpl *newChildImpl =
+ dynamic_cast<NodeImpl *> ((Node *)newChild);
- childImpl->parent = this;
- childImpl->ownerDocument = ownerDocument;
+ newChildImpl->parent = this;
+ newChildImpl->ownerDocument = ownerDocument;
if (!firstChild || !lastChild)
{
//Set up our first member
- firstChild = childImpl;
- lastChild = childImpl;
+ firstChild = newChildImpl;
+ lastChild = newChildImpl;
}
else
{
//link at the last position
- lastChild->next = childImpl;
- childImpl->prev = lastChild;
- lastChild = childImpl;
+ lastChild->next = newChildImpl;
+ newChildImpl->prev = lastChild;
+ lastChild = newChildImpl;
}
- return child;
+ return (Node *)newChild;
}
/**
/**
*
*/
-DOMString NodeImpl::getTextContext() throw(DOMException)
+DOMString NodeImpl::getTextContent() throw(DOMException)
{
- //no idea
- return DOMString("");
+ DOMString buf;
+ if (nodeType == TEXT_NODE ||
+ nodeType == CDATA_SECTION_NODE ||
+ nodeType == COMMENT_NODE ||
+ nodeType == PROCESSING_INSTRUCTION_NODE)
+ buf = getNodeValue();
+ else if (nodeType == ELEMENT_NODE ||
+ nodeType == ATTRIBUTE_NODE ||
+ nodeType == ENTITY_NODE ||
+ nodeType == ENTITY_REFERENCE_NODE ||
+ nodeType == DOCUMENT_FRAGMENT_NODE)
+ {
+ for (Node *n = getFirstChild() ; n ;
+ n=n->getNextSibling() )
+ {
+ if (n->getNodeType() != COMMENT_NODE &&
+ n->getNodeType() != COMMENT_NODE)
+ buf.append(n->getTextContent());
+ }
+ }
+ return buf;
}
/**
*
*/
-void NodeImpl::setTextContext(const DOMString &val) throw(DOMException)
+void NodeImpl::setTextContent(const DOMString &val) throw(DOMException)
{
- //no idea
+ //Delete children
+ for (Node *n = getFirstChild() ; n ;
+ n=n->getNextSibling() )
+ delete n;
+ firstChild = lastChild = NULL;
+
+ //Replace with a single text node
+ NodeImpl *tnode = new NodeImpl(ownerDocument);
+ tnode->nodeType = Node::TEXT_NODE;
+ tnode->setNodeValue(val);
+ appendChild(tnode);
}
{
if (userDataEntries)
delete userDataEntries;
+ //Delete children
+ for (Node *n = getFirstChild() ; n ;
+ n=n->getNextSibling() )
+ delete n;
}
diff --git a/src/dom/domimpl.h b/src/dom/domimpl.h
index bbd1693ef8dd574266465f1c268f9b29a710370a..669b3d878152b630c1f96a9571cb5991e153d7b5 100644 (file)
--- a/src/dom/domimpl.h
+++ b/src/dom/domimpl.h
/**
*
*/
- virtual DOMString getTextContext() throw(DOMException);
+ virtual DOMString getTextContent() throw(DOMException);
/**
*
*/
- virtual void setTextContext(const DOMString &val) throw(DOMException);
+ virtual void setTextContent(const DOMString &val) throw(DOMException);
/**
diff --git a/src/dom/jsbind.cpp b/src/dom/jsbind.cpp
index 4e2af1dec2aa7188c1e77ce5f81a20e27a6012d5..0cfe47761216dd0305da0725cf2c179e2d50b66f 100644 (file)
--- a/src/dom/jsbind.cpp
+++ b/src/dom/jsbind.cpp
//# U T I L I T Y
//########################################################################
+//Use this for getting the JavascriptEngine from an object method
+#define ENGINE ((JavascriptEngine *) JS_GetContextPrivate(cx))
+
/**
* The name of the property is an enumeration, so just return the value.
}
+static JSString *domToJString(JSContext *cx, const DOMString &s)
+{
+ JSString *str = JS_NewStringCopyN(cx, s.c_str(), s.size());
+ return str;
+}
+
+static DOMString jvToDomString(JSContext *cx, jsval s)
+{
+ JSString *jstr = JS_ValueToString(cx, s);
+ DOMString str = JS_GetStringBytes(jstr);
+ return str;
+}
+
+static DOMString jToDomString(JSString *s)
+{
+ DOMString str = JS_GetStringBytes(s);
+ return str;
+}
//########################################################################
//# C L A S S E S
//########################################################################
+
/**
* Appendix H: ECMAScript Language Binding
*
{
public:
+
/**
* JSConstructor - Callback for when a this object is created
*/
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
{
if (!JSVAL_IS_INT(id))
return JS_FALSE;
+ int index = JSVAL_TO_INT(id);
DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
- switch( JSVAL_TO_INT( id ) )
+ switch( index )
{
case prop_code:
{
{
if (!JSVAL_IS_INT(id))
return JS_FALSE;
+ int index = JSVAL_TO_INT( id );
DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
- switch( JSVAL_TO_INT( id ) )
+ switch( index )
{
case prop_code:
{
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_code
}
/**
- * JSGetProperty - Callback for retrieving properties
+ * JSGetProperty - Use this one for list[index] lookup
*/
static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
jsval id, jsval *vp)
{
+ if (!JSVAL_IS_INT(id))
+ return JS_TRUE;
+ int index = JSVAL_TO_INT(id);
+ DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
+ JSString *jstr = domToJString(cx, p->item(index));
+ *vp = STRING_TO_JSVAL(jstr);
+ return JS_FALSE;
+ }
+
+ /**
+ * JSGetProperty - Use this one for enumerated property names
+ */
+ static JSBool JSGetNamedProperty(JSContext *cx, JSObject *obj,
+ jsval id, jsval *vp)
+ {
if (JSVAL_IS_INT(id))
{
DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
if (JSVAL_TO_INT(id) == prop_length)
+ {
*vp = JSVAL_TO_INT(p->getLength());
- return JS_TRUE;
+ return JS_TRUE;
+ }
}
return JS_FALSE;
}
static JSBool item(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ uint32 index;
+ if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
+ return JS_FALSE;
+ DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
+ *rval = STRING_TO_JSVAL(domToJString(cx, p->item(index)));
+ return JS_TRUE;
}
/**
static JSBool contains(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
+ *rval = BOOLEAN_TO_JSVAL(p->contains( jToDomString(str)));
+ return JS_TRUE;
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
JSPropertySpec ECMA_DOMStringList::properties[] =
{
- { "length", prop_length, JSPROP_READONLY },
+ { "length", prop_length, JSPROP_READONLY, JSGetNamedProperty },
{ 0 }
};
*/
static void JSDestructor(JSContext *cx, JSObject *obj)
{
- DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
+ NameList *p = (NameList *) JS_GetPrivate(cx, obj);
delete p;
}
static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
jsval id, jsval *vp)
{
+ if (!JSVAL_IS_INT(id))
+ return JS_TRUE;
+ int index = JSVAL_TO_INT(id);
+ NameList *p = (NameList *) JS_GetPrivate(cx, obj);
+ switch (index)
+ {
+ case prop_length:
+ *vp = INT_TO_JSVAL(p->getLength());
+ return JS_TRUE;
+ }
return JS_FALSE;
}
static JSBool getName(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ uint32 index;
+ if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
+ return JS_FALSE;
+ NameList *p = (NameList *) JS_GetPrivate(cx, obj);
+ *rval = STRING_TO_JSVAL(domToJString(cx, p->getName(index)));
+ return JS_TRUE;
}
/**
static JSBool getNamespaceURI(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ uint32 index;
+ if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
+ return JS_FALSE;
+ NameList *p = (NameList *) JS_GetPrivate(cx, obj);
+ *rval = STRING_TO_JSVAL(domToJString(cx, p->getNamespaceURI(index)));
+ return JS_TRUE;
}
/**
static JSBool contains(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ NameList *p = (NameList *) JS_GetPrivate(cx, obj);
+ *rval = BOOLEAN_TO_JSVAL(p->contains( jToDomString(str)));
+ return JS_TRUE;
}
/**
static JSBool containsNS(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *ns; JSString *name;
+ if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
+ return JS_FALSE;
+ NameList *p = (NameList *) JS_GetPrivate(cx, obj);
+ *rval = BOOLEAN_TO_JSVAL(
+ p->containsNS(jToDomString(ns), jToDomString(name)));
+ return JS_TRUE;
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
+ enum
+ {
+ prop_length
+ };
static JSFunctionSpec methods[];
};
JSPropertySpec ECMA_NameList::properties[] =
{
+ { "length", prop_length, JSPROP_READONLY },
{ 0 }
};
{
if (argc != 1)
return JS_FALSE;
- DOMException *p = new DOMException(JSVAL_TO_INT( argv[0] ));
+ DOMImplementationList *p = new DOMImplementationList();
if ( ! JS_SetPrivate(cx, obj, p) )
return JS_FALSE;
*rval = OBJECT_TO_JSVAL(obj);
*/
static void JSDestructor(JSContext *cx, JSObject *obj)
{
- DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
+ DOMImplementationList *p =
+ (DOMImplementationList *) JS_GetPrivate(cx, obj);
delete p;
}
/**
- * JSGetProperty - Callback for retrieving properties
+ * JSGetProperty - Use this one for list[index] lookup
*/
static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
jsval id, jsval *vp)
{
+ if (!JSVAL_IS_INT(id))
+ return JS_TRUE;
+ int index = JSVAL_TO_INT(id);
+ DOMImplementationList *p =
+ (DOMImplementationList *) JS_GetPrivate(cx, obj);
+ DOMImplementation *di = p->item(index);
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(di));
+ return JS_FALSE;
+ }
+
+ /**
+ * JSGetProperty - Use this one for enumerated property names
+ */
+ static JSBool JSGetNamedProperty(JSContext *cx, JSObject *obj,
+ jsval id, jsval *vp)
+ {
+ if (!JSVAL_IS_INT(id))
+ return JS_TRUE;
+ int index = JSVAL_TO_INT(id);
+ DOMImplementationList *p =
+ (DOMImplementationList *) JS_GetPrivate(cx, obj);
+ switch (index)
+ {
+ case prop_length:
+ *vp = INT_TO_JSVAL(p->getLength());
+ return JS_TRUE;
+ }
return JS_FALSE;
}
static JSBool item(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ uint32 index;
+ if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
+ return JS_FALSE;
+ DOMImplementationList *p =
+ (DOMImplementationList *) JS_GetPrivate(cx, obj);
+ DOMImplementation *di = p->item(index);
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(di));
+ return JS_TRUE;
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
+ enum
+ {
+ prop_length
+ };
static JSFunctionSpec methods[];
};
JSPropertySpec ECMA_DOMImplementationList::properties[] =
{
+ { "length", prop_length, JSPROP_READONLY, JSGetNamedProperty },
{ 0 }
};
*/
static void JSDestructor(JSContext *cx, JSObject *obj)
{
- DOMImplementationSource *p = (DOMImplementationSource *) JS_GetPrivate(cx, obj);
+ DOMImplementationSource *p =
+ (DOMImplementationSource *) JS_GetPrivate(cx, obj);
delete p;
}
static JSBool getDOMImplementation(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *feature;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &feature))
+ return JS_FALSE;
+ DOMImplementationSource *p =
+ (DOMImplementationSource *) JS_GetPrivate(cx, obj);
+ DOMImplementation *di =
+ p->getDOMImplementation(jToDomString(feature));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(di));
+ return JS_TRUE;
}
/**
static JSBool getDOMImplementationList(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *feature;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &feature))
+ return JS_FALSE;
+ DOMImplementationSource *p =
+ (DOMImplementationSource *) JS_GetPrivate(cx, obj);
+ DOMImplementationList di =
+ p->getDOMImplementationList(jToDomString(feature));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementationList(&di));
+ return JS_TRUE;
}
+ static JSClass classDef;
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
jsval id, jsval *vp)
{
+ if (!JSVAL_IS_INT(id))
+ return JS_FALSE;
+ int index = JSVAL_TO_INT(id);
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ switch (index)
+ {
+ case prop_doctype:
+ {
+ DocumentType *p = d->getDoctype();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_DocumentType(p));
+ return JS_TRUE;
+ }
+ case prop_implementation:
+ {
+ DOMImplementation *p = d->getImplementation();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(p));
+ return JS_TRUE;
+ }
+ case prop_documentElement:
+ {
+ Element *p = d->getDocumentElement();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
+ return JS_TRUE;
+ }
+ case prop_inputEncoding:
+ {
+ DOMString p = d->getInputEncoding();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
+ return JS_TRUE;
+ }
+ case prop_xmlEncoding:
+ {
+ DOMString p = d->getXmlEncoding();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
+ return JS_TRUE;
+ }
+ case prop_xmlStandalone:
+ {
+ *vp = BOOLEAN_TO_JSVAL(d->getXmlStandalone());
+ return JS_TRUE;
+ }
+ case prop_xmlVersion:
+ {
+ DOMString p = d->getXmlVersion();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
+ return JS_TRUE;
+ }
+ case prop_strictErrorChecking:
+ {
+ *vp = BOOLEAN_TO_JSVAL(d->getStrictErrorChecking());
+ return JS_TRUE;
+ }
+ case prop_documentURI:
+ {
+ DOMString p = d->getDocumentURI();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
+ return JS_TRUE;
+ }
+ case prop_domConfig:
+ {
+ DOMConfiguration *p = d->getDomConfig();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_DOMConfiguration(p));
+ return JS_TRUE;
+ }
+ }
return JS_FALSE;
}
static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
jsval id, jsval *vp)
{
+ if (!JSVAL_IS_INT(id))
+ return JS_FALSE;
+ int index = JSVAL_TO_INT(id);
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ switch (index)
+ {
+ case prop_xmlStandalone:
+ {
+ d->setXmlStandalone(JSVAL_TO_BOOLEAN(*vp));
+ return JS_TRUE;
+ }
+ case prop_xmlVersion:
+ {
+ d->setXmlVersion(jvToDomString(cx, *vp));
+ return JS_TRUE;
+ }
+ case prop_strictErrorChecking:
+ {
+ d->setStrictErrorChecking(JSVAL_TO_BOOLEAN(*vp));
+ return JS_TRUE;
+ }
+ case prop_documentURI:
+ {
+ d->setDocumentURI(jvToDomString(cx, *vp));
+ return JS_TRUE;
+ }
+ }
return JS_FALSE;
}
static JSBool createElement(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Element *p = d->createElement(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
+ return JS_TRUE;
}
/**
static JSBool createDocumentFragment(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ DocumentFragment *p = d->createDocumentFragment();
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_DocumentFragment(p));
+ return JS_TRUE;
}
/**
static JSBool createTextNode(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Text *p = d->createTextNode(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Text(p));
+ return JS_TRUE;
}
/**
static JSBool createComment(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Comment *p = d->createComment(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Comment(p));
+ return JS_TRUE;
}
/**
static JSBool createCDATASection(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ CDATASection *p = d->createCDATASection(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_CDATASection(p));
+ return JS_TRUE;
}
/**
static JSBool createProcessingInstruction(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *name; JSString *data;
+ if (!JS_ConvertArguments(cx, argc, argv, "SS", &name, &data))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ ProcessingInstruction *p =
+ d->createProcessingInstruction(jToDomString(name), jToDomString(data));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_ProcessingInstruction(p));
+ return JS_TRUE;
}
/**
static JSBool createAttribute(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Attr *p = d->createAttribute(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Attr(p));
+ return JS_TRUE;
}
/**
static JSBool createEntityReference(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ EntityReference *p = d->createEntityReference(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_EntityReference(p));
+ return JS_TRUE;
}
/**
static JSBool getElementsByTagName(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ NodeList p = d->getElementsByTagName(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_NodeList(&p));
+ return JS_TRUE;
}
/**
static JSBool importNode(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSObject *impnode; JSBool deep;
+ if (!JS_ConvertArguments(cx, argc, argv, "ou", &impnode, &deep))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Node *n = (Node *)JS_GetPrivate(cx, impnode);
+ Node *p = d->importNode(n, deep);
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
}
/**
static JSBool createElementNS(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *ns; JSString *name;
+ if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Element *p =
+ d->createElementNS(jToDomString(ns), jToDomString(name));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
+ return JS_TRUE;
}
/**
static JSBool createAttributeNS(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *ns; JSString *name;
+ if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Attr *p =
+ d->createAttributeNS(jToDomString(ns), jToDomString(name));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Attr(p));
+ return JS_TRUE;
}
/**
static JSBool getElementsByTagNameNS(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *ns; JSString *name;
+ if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ NodeList p =
+ d->getElementsByTagNameNS(jToDomString(ns), jToDomString(name));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_NodeList(&p));
+ return JS_TRUE;
}
/**
static JSBool getElementById(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSString *str;
+ if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Element *p = d->getElementById(jToDomString(str));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
+ return JS_TRUE;
}
/**
static JSBool adoptNode(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSObject *impnode;
+ if (!JS_ConvertArguments(cx, argc, argv, "o", &impnode))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Node *n = (Node *)JS_GetPrivate(cx, impnode);
+ Node *p = d->adoptNode(n);
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
}
/**
static JSBool normalizeDocument(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ d->normalizeDocument();
+ return JS_TRUE;
}
/**
static JSBool renameNode(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
- return JS_FALSE;
+ JSObject *rnode; JSString *nsuri; JSString *qname;
+ if (!JS_ConvertArguments(cx, argc, argv, "oSS", &rnode, &nsuri, &qname))
+ return JS_FALSE;
+ Document *d = (Document *)JS_GetPrivate(cx, obj);
+ Node *n = (Node *)JS_GetPrivate(cx, rnode);
+ Node *p = d->renameNode(n, jToDomString(nsuri), jToDomString(qname));
+ *rval = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
}
jsval id, jsval *vp)
{
if (!JSVAL_IS_INT(id))
- return JS_FALSE;
- //Node *p = (Node *) JS_GetPrivate(cx, obj);
- switch( JSVAL_TO_INT( id ) )
+ return JS_FALSE;
+ int index = JSVAL_TO_INT(id);
+ Node *n = (Node *)JS_GetPrivate(cx, obj);
+ switch (index)
{
case prop_nodeName:
{
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, n->getNodeName()));
return JS_TRUE;
}
case prop_nodeValue:
{
- //*vp = INT_TO_JSVAL(priv->getNode()->GetAge());
- return JS_TRUE;
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, n->getNodeValue()));
+ return JS_TRUE;
+ }
+ case prop_nodeType:
+ {
+ *vp = INT_TO_JSVAL(n->getNodeType());
+ return JS_TRUE;
+ }
+ case prop_parentNode:
+ {
+ Node *p = n->getParentNode();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
+ }
+ case prop_childNodes:
+ {
+ NodeList p = n->getChildNodes();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_NodeList(&p));
+ return JS_TRUE;
+ }
+ case prop_firstChild:
+ {
+ Node *p = n->getFirstChild();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
+ }
+ case prop_lastChild:
+ {
+ Node *p = n->getLastChild();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
+ }
+ case prop_previousSibling:
+ {
+ Node *p = n->getPreviousSibling();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
+ }
+ case prop_nextSibling:
+ {
+ Node *p = n->getNextSibling();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
+ return JS_TRUE;
+ }
+ case prop_attributes:
+ {
+ NamedNodeMap p = n->getAttributes();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_NamedNodeMap(&p));
+ return JS_TRUE;
+ }
+ case prop_ownerDocument:
+ {
+ Document *p = n->getOwnerDocument();
+ *vp = OBJECT_TO_JSVAL(ENGINE->new_Document(p));
+ return JS_TRUE;
+ }
+ case prop_namespaceURI:
+ {
+ DOMString s = n->getNamespaceURI();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
+ return JS_TRUE;
+ }
+ case prop_prefix:
+ {
+ DOMString s = n->getPrefix();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
+ return JS_TRUE;
+ }
+ case prop_localName:
+ {
+ DOMString s = n->getLocalName();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
+ return JS_TRUE;
+ }
+ case prop_baseURI:
+ {
+ DOMString s = n->getBaseURI();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
+ return JS_TRUE;
+ }
+ case prop_textContent:
+ {
+ DOMString s = n->getTextContent();
+ *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
+ return JS_TRUE;
}
}
return JS_FALSE;
return JS_FALSE;
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_nodeName,
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
}
+ static JSClass classDef;
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
}
+ static JSClass classDef;
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
static JSPropertySpec staticProperties[];
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_severity,
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_lineNumber,
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_parameterNames
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
}
+ static JSClass classDef;
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_name,
return JS_FALSE;
}
+
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_publicId,
}
+ static JSClass classDef;
+
private:
// Standard JS Binding fields
- static JSClass classDef;
enum
{
prop_publicId,
}
+ static JSClass classDef;
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
static JSFunctionSpec methods[];
}
+ static JSClass classDef;
private:
// Standard JS Binding fields
- static JSClass classDef;
static JSPropertySpec properties[];
enum
{
bool JavascriptEngine::createClasses()
{
- nodeProto =
+ proto_Node =
ECMA_Node::JSInit(cx, globalObj);
- characterDataProto =
- ECMA_CharacterData::JSInit(cx, globalObj, nodeProto);
- textProto =
- ECMA_Text::JSInit(cx, globalObj, characterDataProto);
- cdataProto =
- ECMA_CDATASection::JSInit(cx, globalObj, textProto);
- documentProto =
- ECMA_CDATASection::JSInit(cx, globalObj, cdataProto);
+ proto_CharacterData =
+ ECMA_CharacterData::JSInit(cx, globalObj, proto_Node);
+ proto_Text =
+ ECMA_Text::JSInit(cx, globalObj, proto_CharacterData);
+ proto_CDATASection =
+ ECMA_CDATASection::JSInit(cx, globalObj, proto_Text);
+ proto_Document =
+ ECMA_Document::JSInit(cx, globalObj, proto_CDATASection);
return true;
}
}
JSObject *jsdoc = JS_NewObject(cx, &ECMA_Document::classDef,
- documentProto, NULL);
+ proto_Document, NULL);
//Wrap around the document... done!
JS_SetPrivate(cx, jsdoc, (void *)doc);
return jsdoc;
}
+JSObject *JavascriptEngine::new_Attr(Attr *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Attr::classDef,
+ proto_Attr,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_CDATASection(CDATASection *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_CDATASection::classDef,
+ proto_CDATASection,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_CharacterData(CharacterData *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_CharacterData::classDef,
+ proto_CharacterData,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_Comment(Comment *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Comment::classDef,
+ proto_Comment,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_Document(Document *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Document::classDef,
+ proto_Document,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DocumentFragment(DocumentFragment *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DocumentFragment::classDef,
+ proto_DocumentFragment,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DocumentType(DocumentType *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DocumentType::classDef,
+ proto_DocumentType,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMConfiguration(DOMConfiguration *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMConfiguration::classDef,
+ proto_DOMConfiguration,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMError(DOMError *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMError::classDef,
+ proto_DOMError,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMException(DOMException *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMException::classDef,
+ proto_DOMException,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMImplementation(DOMImplementation *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMImplementation::classDef,
+ proto_DOMImplementation,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMImplementationList(DOMImplementationList *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMImplementationList::classDef,
+ proto_DOMImplementationList,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMImplementationRegistry(DOMImplementationSource *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMImplementationRegistry::classDef,
+ proto_DOMImplementationRegistry,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMImplementationSource(DOMImplementationSource *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMImplementationSource::classDef,
+ proto_DOMImplementationSource,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMLocator(DOMLocator *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMLocator::classDef,
+ proto_DOMLocator,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_DOMStringList(DOMStringList *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_DOMStringList::classDef,
+ proto_DOMStringList,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_Element(Element *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Element::classDef,
+ proto_Element,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_Entity(Entity *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Entity::classDef,
+ proto_Entity,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_EntityReference(EntityReference *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_EntityReference::classDef,
+ proto_EntityReference,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_NamedNodeMap(NamedNodeMap *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_NamedNodeMap::classDef,
+ proto_NamedNodeMap,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_NameList(NameList *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_NameList::classDef,
+ proto_NameList,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_Node(Node *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Node::classDef,
+ proto_Node,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_NodeList(NodeList *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_NodeList::classDef,
+ proto_NodeList,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_Notation(Notation *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Notation::classDef,
+ proto_Notation,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_ProcessingInstruction(ProcessingInstruction *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_ProcessingInstruction::classDef,
+ proto_ProcessingInstruction,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_Text(Text *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_Text::classDef,
+ proto_Text,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_TypeInfo(TypeInfo *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_TypeInfo::classDef,
+ proto_TypeInfo,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+JSObject *JavascriptEngine::new_UserDataHandler(UserDataHandler *obj)
+{
+ JSObject *newObj = JS_NewObject(cx,
+ &ECMA_UserDataHandler::classDef,
+ proto_UserDataHandler,
+ NULL);
+ JS_SetPrivate(cx, newObj, obj);
+ return newObj;
+}
+
+
+
} // namespace dom
} // namespace w3c