Started hooking up createElement(), and commented out some asserts that
were getting hit git-svn-id: svn://10.0.0.236/trunk@1096 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -43,7 +43,7 @@ PR_STATIC_CALLBACK(JSBool)
|
||||
GetAttributeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMAttribute *attribute = (nsIDOMAttribute*)JS_GetPrivate(cx, obj);
|
||||
NS_ASSERTION(nsnull != attribute, "null pointer");
|
||||
// NS_ASSERTION(nsnull != attribute, "null pointer");
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
@@ -36,7 +36,7 @@ PR_STATIC_CALLBACK(JSBool)
|
||||
GetAttributeListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMAttributeList *attributeList = (nsIDOMAttributeList*)JS_GetPrivate(cx, obj);
|
||||
NS_ASSERTION(nsnull != attributeList, "null pointer");
|
||||
// NS_ASSERTION(nsnull != attributeList, "null pointer");
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsString.h"
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectIID, NS_ISCRIPTOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
@@ -45,7 +46,7 @@ PR_STATIC_CALLBACK(JSBool)
|
||||
GetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMDocument *document = (nsIDOMDocument*)JS_GetPrivate(cx, obj);
|
||||
NS_ASSERTION(nsnull != document, "null pointer");
|
||||
// NS_ASSERTION(nsnull != document, "null pointer");
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
@@ -165,7 +166,29 @@ CreateDocumentContext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
CreateElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
//XXX TBI
|
||||
nsIDOMDocument *document = (nsIDOMDocument*)JS_GetPrivate(cx, obj);
|
||||
|
||||
if (nsnull != document) {
|
||||
if (argc > 0) {
|
||||
JSString* jsstring1 = JSVAL_TO_STRING(argv[0]);
|
||||
nsString tagName(JS_GetStringChars(jsstring1));
|
||||
nsIDOMElement* element;
|
||||
|
||||
if (NS_OK == document->CreateElement(tagName, nsnull, &element)) {
|
||||
// get the js object
|
||||
nsIScriptObjectOwner *owner = nsnull;
|
||||
if (NS_OK == element->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
|
||||
JSObject *object = nsnull;
|
||||
if (NS_OK == owner->GetScriptObject(cx, (void**)&object)) {
|
||||
// set the return value
|
||||
*rval = OBJECT_TO_JSVAL(object);
|
||||
}
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
NS_RELEASE(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ PR_STATIC_CALLBACK(JSBool)
|
||||
GetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMElement *element = (nsIDOMElement*)JS_GetPrivate(cx, obj);
|
||||
NS_ASSERTION(nsnull != element, "null pointer");
|
||||
// NS_ASSERTION(nsnull != element, "null pointer");
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
@@ -36,7 +36,7 @@ PR_STATIC_CALLBACK(JSBool)
|
||||
GetNodeIteratorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMNodeIterator *nodeIterator = (nsIDOMNodeIterator*)JS_GetPrivate(cx, obj);
|
||||
NS_ASSERTION(nsnull != nodeIterator, "null pointer");
|
||||
// NS_ASSERTION(nsnull != nodeIterator, "null pointer");
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
|
||||
Reference in New Issue
Block a user