Update the DOM interface to DOM Level 2, only stubs so far.

This commit is contained in:
jst%netscape.com 2000-04-13 21:21:02 +00:00
Родитель e61792f46d
Коммит 5cd69c3154
13 изменённых файлов: 331 добавлений и 3 удалений

Просмотреть файл

@ -475,6 +475,29 @@ nsDOMAttributeMap::GetLength(PRUint32 *aLength)
return rv;
}
nsresult
nsDOMAttributeMap::GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsDOMAttributeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsDOMAttributeMap::RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#ifdef DEBUG
PR_STATIC_CALLBACK (PRIntn)
SizeAttributes(PLHashEntry* he, PRIntn i, void* arg)

Просмотреть файл

@ -49,6 +49,11 @@ public:
NS_IMETHOD SetNamedItem(nsIDOMNode* aNode, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName, nsIDOMNode** aReturn);
void DropReference();

Просмотреть файл

@ -53,6 +53,13 @@ public:
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn);
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
@ -272,6 +279,28 @@ nsXMLNamedNodeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
return NS_OK;
}
nsresult
nsXMLNamedNodeMap::GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXMLNamedNodeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXMLNamedNodeMap::RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXMLNamedNodeMap::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)

Просмотреть файл

@ -770,6 +770,30 @@ nsXULAttributes::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
return NS_OK;
}
nsresult
nsXULAttributes::GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXULAttributes::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXULAttributes::RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -47,6 +47,12 @@ public:
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)=0;
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn)=0;
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)=0;
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn)=0;
};
@ -56,6 +62,9 @@ public:
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn); \
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn); \
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); \
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn); \
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn); \
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn); \
@ -65,6 +74,9 @@ public:
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) { return _to SetNamedItem(aArg, aReturn); } \
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to RemoveNamedItem(aName, aReturn); } \
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return _to Item(aIndex, aReturn); } \
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn) { return _to GetNamedItemNS(aNamespaceURI, aLocalName, aReturn); } \
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) { return _to SetNamedItemNS(aArg, aReturn); } \
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn) { return _to RemoveNamedItemNS(aNamespaceURI, aLocalName, aReturn); } \
extern "C" NS_DOM nsresult NS_InitNamedNodeMapClass(nsIScriptContext *aContext, void **aPrototype);

Просмотреть файл

@ -9,5 +9,14 @@
raises(DOMException);
Node item(in unsigned long index);
readonly attribute unsigned long length;
// Introduced in DOM Level 2:
Node getNamedItemNS(in DOMString namespaceURI,
in DOMString localName);
// Introduced in DOM Level 2:
Node setNamedItemNS(in Node arg)
raises(DOMException);
// Introduced in DOM Level 2:
Node removeNamedItemNS(in DOMString namespaceURI,
in DOMString localName)
raises(DOMException);
};

Просмотреть файл

@ -650,10 +650,13 @@ enum nsDOMProp {
NS_DOM_PROP_MOUSEEVENT_SCREENX,
NS_DOM_PROP_MOUSEEVENT_SCREENY,
NS_DOM_PROP_NAMEDNODEMAP_GETNAMEDITEM,
NS_DOM_PROP_NAMEDNODEMAP_GETNAMEDITEMNS,
NS_DOM_PROP_NAMEDNODEMAP_ITEM,
NS_DOM_PROP_NAMEDNODEMAP_LENGTH,
NS_DOM_PROP_NAMEDNODEMAP_REMOVENAMEDITEM,
NS_DOM_PROP_NAMEDNODEMAP_REMOVENAMEDITEMNS,
NS_DOM_PROP_NAMEDNODEMAP_SETNAMEDITEM,
NS_DOM_PROP_NAMEDNODEMAP_SETNAMEDITEMNS,
NS_DOM_PROP_NAVIGATOR_APPCODENAME,
NS_DOM_PROP_NAVIGATOR_APPNAME,
NS_DOM_PROP_NAVIGATOR_APPVERSION,

Просмотреть файл

@ -649,10 +649,13 @@
"mouseevent.screenx", \
"mouseevent.screeny", \
"namednodemap.getnameditem", \
"namednodemap.getnameditemns", \
"namednodemap.item", \
"namednodemap.length", \
"namednodemap.removenameditem", \
"namednodemap.removenameditemns", \
"namednodemap.setnameditem", \
"namednodemap.setnameditemns", \
"navigator.appcodename", \
"navigator.appname", \
"navigator.appversion", \

Просмотреть файл

@ -240,7 +240,7 @@ NamedNodeMapSetNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)(void**)getter_AddRefs(b0),
kINodeIID,
NS_ConvertToString("Node"),
"Node",
cx,
argv[0])) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR);
@ -344,6 +344,142 @@ NamedNodeMapItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
}
//
// Native method GetNamedItemNS
//
PR_STATIC_CALLBACK(JSBool)
NamedNodeMapGetNamedItemNS(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNamedNodeMap *nativeThis = (nsIDOMNamedNodeMap*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
nsIDOMNode* nativeRet;
nsAutoString b0;
nsAutoString b1;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_GETNAMEDITEMNS, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
if (argc < 2) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
}
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
result = nativeThis->GetNamedItemNS(b0, b1, &nativeRet);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval);
}
return JS_TRUE;
}
//
// Native method SetNamedItemNS
//
PR_STATIC_CALLBACK(JSBool)
NamedNodeMapSetNamedItemNS(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNamedNodeMap *nativeThis = (nsIDOMNamedNodeMap*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
nsIDOMNode* nativeRet;
nsCOMPtr<nsIDOMNode> b0;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_SETNAMEDITEMNS, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
if (argc < 1) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
}
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)(void**)getter_AddRefs(b0),
kINodeIID,
"Node",
cx,
argv[0])) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR);
}
result = nativeThis->SetNamedItemNS(b0, &nativeRet);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval);
}
return JS_TRUE;
}
//
// Native method RemoveNamedItemNS
//
PR_STATIC_CALLBACK(JSBool)
NamedNodeMapRemoveNamedItemNS(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNamedNodeMap *nativeThis = (nsIDOMNamedNodeMap*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
nsIDOMNode* nativeRet;
nsAutoString b0;
nsAutoString b1;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_REMOVENAMEDITEMNS, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
if (argc < 2) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
}
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
result = nativeThis->RemoveNamedItemNS(b0, b1, &nativeRet);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval);
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for NamedNodeMap
@ -383,6 +519,9 @@ static JSFunctionSpec NamedNodeMapMethods[] =
{"setNamedItem", NamedNodeMapSetNamedItem, 1},
{"removeNamedItem", NamedNodeMapRemoveNamedItem, 1},
{"item", NamedNodeMapItem, 1},
{"getNamedItemNS", NamedNodeMapGetNamedItemNS, 2},
{"setNamedItemNS", NamedNodeMapSetNamedItemNS, 1},
{"removeNamedItemNS", NamedNodeMapRemoveNamedItemNS, 2},
{0}
};

Просмотреть файл

@ -475,6 +475,29 @@ nsDOMAttributeMap::GetLength(PRUint32 *aLength)
return rv;
}
nsresult
nsDOMAttributeMap::GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsDOMAttributeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsDOMAttributeMap::RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#ifdef DEBUG
PR_STATIC_CALLBACK (PRIntn)
SizeAttributes(PLHashEntry* he, PRIntn i, void* arg)

Просмотреть файл

@ -49,6 +49,11 @@ public:
NS_IMETHOD SetNamedItem(nsIDOMNode* aNode, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName, nsIDOMNode** aReturn);
void DropReference();

Просмотреть файл

@ -53,6 +53,13 @@ public:
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn);
// nsIScriptObjectOwner interface
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
@ -272,6 +279,28 @@ nsXMLNamedNodeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
return NS_OK;
}
nsresult
nsXMLNamedNodeMap::GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXMLNamedNodeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXMLNamedNodeMap::RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXMLNamedNodeMap::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)

Просмотреть файл

@ -770,6 +770,30 @@ nsXULAttributes::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
return NS_OK;
}
nsresult
nsXULAttributes::GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsIDOMNode** aReturn)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXULAttributes::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXULAttributes::RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName,
nsIDOMNode** aReturn)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}