Bug=81023
author=ashuk ra=edburns Files modified - mozilla/java/dom/classes/org/mozilla/dom/NodeImpl.java mozilla/java/dom/classes/org/mozilla/dom/events/MutationEventImpl.java mozilla/java/dom/jni/org_mozilla_dom_NodeImpl.cpp This Fix brings JavaDOM upto sync with the latest w3c.dom interfaces built on 5/16/01 and checked into java/external as dom2.jar git-svn-id: svn://10.0.0.236/trunk@95145 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -116,6 +116,8 @@ public class NodeImpl implements Node, EventTarget {
|
||||
return "ERROR";
|
||||
}
|
||||
|
||||
public native boolean isSupported(String feature, String version);
|
||||
public native boolean hasAttributes();
|
||||
public native Node appendChild(Node newChild) throws DOMException;
|
||||
public native Node cloneNode(boolean deep);
|
||||
public native NamedNodeMap getAttributes();
|
||||
|
||||
@@ -61,7 +61,15 @@ public class MutationEventImpl extends EventImpl implements MutationEvent {
|
||||
public String getAttrName() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <code>attrChange</code> indicates the type of change which triggered
|
||||
* the attrModified event.
|
||||
*/
|
||||
public short getAttrChange() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param typeArg Specifies the event type.
|
||||
@@ -82,7 +90,8 @@ public class MutationEventImpl extends EventImpl implements MutationEvent {
|
||||
Node relatedNodeArg,
|
||||
String prevValueArg,
|
||||
String newValueArg,
|
||||
String attrNameArg) {
|
||||
String attrNameArg,
|
||||
short attrChangeArg) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,79 @@ JNIEXPORT jint JNICALL Java_org_mozilla_dom_NodeImpl_XPCOM_1hashCode
|
||||
return (jint) thisSupports;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_dom_NodeImpl
|
||||
* Method: isSupported
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_NodeImpl_isSupported
|
||||
(JNIEnv *env, jobject jthis, jstring jfeature, jstring jversion)
|
||||
{
|
||||
nsIDOMNode* node = (nsIDOMNode*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!node || !jfeature) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
|
||||
("DOMNode.isSupported: NULL pointer\n"));
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
nsString* feature = JavaDOMGlobals::GetUnicode(env, jfeature);
|
||||
if (!feature)
|
||||
return JNI_FALSE;
|
||||
|
||||
nsString* version;
|
||||
if (jversion) {
|
||||
version = JavaDOMGlobals::GetUnicode(env, jversion);
|
||||
if (!version) {
|
||||
nsMemory::Free(feature);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
} else {
|
||||
version = new nsString();
|
||||
}
|
||||
|
||||
PRBool ret = PR_FALSE;
|
||||
nsresult rv = node->IsSupported(*feature, *version, &ret);
|
||||
nsMemory::Free(feature);
|
||||
nsMemory::Free(version);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Node.isSupported: failed (%x)\n", rv));
|
||||
}
|
||||
|
||||
return ret == PR_TRUE ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_dom_NodeImpl
|
||||
* Method: hasAttributes
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_NodeImpl_hasAttributes
|
||||
(JNIEnv *env, jobject jthis)
|
||||
{
|
||||
nsIDOMNode* node = (nsIDOMNode*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!node) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
|
||||
("DOMNode.hasAttributes: NULL pointer\n"));
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
PRBool ret = PR_FALSE;
|
||||
nsresult rv = node->HasAttributes(&ret);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Node.hasAttributes: failed (%x)\n", rv));
|
||||
}
|
||||
|
||||
return ret == PR_TRUE ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_dom_NodeImpl
|
||||
* Method: finalize
|
||||
|
||||
Reference in New Issue
Block a user