diff --git a/mozilla/dom/src/nsJSAttribute.cpp b/mozilla/dom/src/nsJSAttribute.cpp index 91c66d00920..63c63ec3cf0 100644 --- a/mozilla/dom/src/nsJSAttribute.cpp +++ b/mozilla/dom/src/nsJSAttribute.cpp @@ -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)) { diff --git a/mozilla/dom/src/nsJSAttributeList.cpp b/mozilla/dom/src/nsJSAttributeList.cpp index b6700756fb6..e5c16ac8539 100644 --- a/mozilla/dom/src/nsJSAttributeList.cpp +++ b/mozilla/dom/src/nsJSAttributeList.cpp @@ -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)) { diff --git a/mozilla/dom/src/nsJSDocument.cpp b/mozilla/dom/src/nsJSDocument.cpp index 5be61500087..c24bba32600 100644 --- a/mozilla/dom/src/nsJSDocument.cpp +++ b/mozilla/dom/src/nsJSDocument.cpp @@ -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; } diff --git a/mozilla/dom/src/nsJSElement.cpp b/mozilla/dom/src/nsJSElement.cpp index 63aa3f45578..9d16b8e088a 100644 --- a/mozilla/dom/src/nsJSElement.cpp +++ b/mozilla/dom/src/nsJSElement.cpp @@ -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)) { diff --git a/mozilla/dom/src/nsJSNodeIterator.cpp b/mozilla/dom/src/nsJSNodeIterator.cpp index 54e4b020150..502e0839096 100644 --- a/mozilla/dom/src/nsJSNodeIterator.cpp +++ b/mozilla/dom/src/nsJSNodeIterator.cpp @@ -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)) {