Slimmed down DOM code by creating a few utility functions for conversion, etc. Fixed bug 1656 - bug in generator with an enum value of 0.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
@@ -65,9 +66,7 @@ GetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsAutoString prop;
|
||||
if (NS_OK == a->GetContent(prop)) {
|
||||
JSString *jsstring = JS_NewUCStringCopyN(cx, prop, prop.Length());
|
||||
// set the return value
|
||||
*vp = STRING_TO_JSVAL(jsstring);
|
||||
nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
@@ -78,9 +77,7 @@ GetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsAutoString prop;
|
||||
if (NS_OK == a->GetHttpEquiv(prop)) {
|
||||
JSString *jsstring = JS_NewUCStringCopyN(cx, prop, prop.Length());
|
||||
// set the return value
|
||||
*vp = STRING_TO_JSVAL(jsstring);
|
||||
nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
@@ -91,9 +88,7 @@ GetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsAutoString prop;
|
||||
if (NS_OK == a->GetName(prop)) {
|
||||
JSString *jsstring = JS_NewUCStringCopyN(cx, prop, prop.Length());
|
||||
// set the return value
|
||||
*vp = STRING_TO_JSVAL(jsstring);
|
||||
nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
@@ -104,9 +99,7 @@ GetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsAutoString prop;
|
||||
if (NS_OK == a->GetScheme(prop)) {
|
||||
JSString *jsstring = JS_NewUCStringCopyN(cx, prop, prop.Length());
|
||||
// set the return value
|
||||
*vp = STRING_TO_JSVAL(jsstring);
|
||||
nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
@@ -114,25 +107,11 @@ GetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsIJSScriptObject *object;
|
||||
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
|
||||
PRBool rval;
|
||||
rval = object->GetProperty(cx, id, vp);
|
||||
NS_RELEASE(object);
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
return nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsIJSScriptObject *object;
|
||||
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
|
||||
PRBool rval;
|
||||
rval = object->GetProperty(cx, id, vp);
|
||||
NS_RELEASE(object);
|
||||
return rval;
|
||||
}
|
||||
return nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
@@ -157,13 +136,7 @@ SetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
case HTMLMETAELEMENT_CONTENT:
|
||||
{
|
||||
nsAutoString prop;
|
||||
JSString *jsstring;
|
||||
if ((jsstring = JS_ValueToString(cx, *vp)) != nsnull) {
|
||||
prop.SetString(JS_GetStringChars(jsstring));
|
||||
}
|
||||
else {
|
||||
prop.SetString((const char *)nsnull);
|
||||
}
|
||||
nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetContent(prop);
|
||||
|
||||
@@ -172,13 +145,7 @@ SetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
case HTMLMETAELEMENT_HTTPEQUIV:
|
||||
{
|
||||
nsAutoString prop;
|
||||
JSString *jsstring;
|
||||
if ((jsstring = JS_ValueToString(cx, *vp)) != nsnull) {
|
||||
prop.SetString(JS_GetStringChars(jsstring));
|
||||
}
|
||||
else {
|
||||
prop.SetString((const char *)nsnull);
|
||||
}
|
||||
nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHttpEquiv(prop);
|
||||
|
||||
@@ -187,13 +154,7 @@ SetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
case HTMLMETAELEMENT_NAME:
|
||||
{
|
||||
nsAutoString prop;
|
||||
JSString *jsstring;
|
||||
if ((jsstring = JS_ValueToString(cx, *vp)) != nsnull) {
|
||||
prop.SetString(JS_GetStringChars(jsstring));
|
||||
}
|
||||
else {
|
||||
prop.SetString((const char *)nsnull);
|
||||
}
|
||||
nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
@@ -202,38 +163,18 @@ SetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
case HTMLMETAELEMENT_SCHEME:
|
||||
{
|
||||
nsAutoString prop;
|
||||
JSString *jsstring;
|
||||
if ((jsstring = JS_ValueToString(cx, *vp)) != nsnull) {
|
||||
prop.SetString(JS_GetStringChars(jsstring));
|
||||
}
|
||||
else {
|
||||
prop.SetString((const char *)nsnull);
|
||||
}
|
||||
nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetScheme(prop);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsIJSScriptObject *object;
|
||||
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
|
||||
PRBool rval;
|
||||
rval = object->SetProperty(cx, id, vp);
|
||||
NS_RELEASE(object);
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
return nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsIJSScriptObject *object;
|
||||
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
|
||||
PRBool rval;
|
||||
rval = object->SetProperty(cx, id, vp);
|
||||
NS_RELEASE(object);
|
||||
return rval;
|
||||
}
|
||||
return nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
@@ -246,18 +187,7 @@ SetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
PR_STATIC_CALLBACK(void)
|
||||
FinalizeHTMLMetaElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsIDOMHTMLMetaElement *a = (nsIDOMHTMLMetaElement*)JS_GetPrivate(cx, obj);
|
||||
|
||||
if (nsnull != a) {
|
||||
// get the js object
|
||||
nsIScriptObjectOwner *owner = nsnull;
|
||||
if (NS_OK == a->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
|
||||
owner->SetScriptObject(nsnull);
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
|
||||
NS_RELEASE(a);
|
||||
}
|
||||
nsGenericFinalize(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -267,17 +197,7 @@ FinalizeHTMLMetaElement(JSContext *cx, JSObject *obj)
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
EnumerateHTMLMetaElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsIDOMHTMLMetaElement *a = (nsIDOMHTMLMetaElement*)JS_GetPrivate(cx, obj);
|
||||
|
||||
if (nsnull != a) {
|
||||
// get the js object
|
||||
nsIJSScriptObject *object;
|
||||
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
|
||||
object->EnumerateProperty(cx);
|
||||
NS_RELEASE(object);
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
return nsGenericEnumerate(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -287,17 +207,7 @@ EnumerateHTMLMetaElement(JSContext *cx, JSObject *obj)
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ResolveHTMLMetaElement(JSContext *cx, JSObject *obj, jsval id)
|
||||
{
|
||||
nsIDOMHTMLMetaElement *a = (nsIDOMHTMLMetaElement*)JS_GetPrivate(cx, obj);
|
||||
|
||||
if (nsnull != a) {
|
||||
// get the js object
|
||||
nsIJSScriptObject *object;
|
||||
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
|
||||
object->Resolve(cx, id);
|
||||
NS_RELEASE(object);
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
return nsGenericResolve(cx, obj, id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user