зеркало из https://github.com/mozilla/pjs.git
r=akhil.arora@sun.com, fix by Denis Sharypov <sdv@sparc.spb.su>
13271: the wrong method was being called in ProcessingInstructionImpl.cpp 13338: handle null input arguments gracefully without crashing
This commit is contained in:
Родитель
7407ea381a
Коммит
66c3fae066
|
@ -128,13 +128,16 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_AttrImpl_setValue
|
|||
return;
|
||||
}
|
||||
|
||||
const char* cvalue = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
if (jval) {
|
||||
const char* cvalue = env->GetStringUTFChars(jval, &iscopy);
|
||||
if (!cvalue) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Attr.setValue: GetStringUTFChars failed\n"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = attr->SetValue(cvalue);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
|
|
@ -36,13 +36,16 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_appendData
|
|||
return;
|
||||
}
|
||||
|
||||
const char* value = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (jvalue) {
|
||||
value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (!value) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"CharacterData.appendData: GetStringUTFChars failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = data->AppendData(value);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -178,13 +181,16 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_insertData
|
|||
return;
|
||||
}
|
||||
|
||||
const char* value = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (jvalue) {
|
||||
value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (!value) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"CharacterData.insertData: GetStringUTFChars failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = data->InsertData((PRUint32) offset, value);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -226,13 +232,16 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_replaceData
|
|||
return;
|
||||
}
|
||||
|
||||
const char* value = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (jvalue) {
|
||||
value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (!value) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"CharacterData.replaceData: GetStringUTFChars failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = data->ReplaceData((PRUint32) offset, (PRUint32) count, value);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -266,13 +275,16 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_setData
|
|||
return;
|
||||
}
|
||||
|
||||
const char* value = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (jvalue) {
|
||||
value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (!value) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"CharacterData.setData: GetStringUTFChars failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = data->SetData(value);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
|
|
@ -143,21 +143,27 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_DOMImplementationImpl_hasFeature
|
|||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
const char* feature = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* feature = env->GetStringUTFChars(jfeature, &iscopy);
|
||||
if (jfeature) {
|
||||
feature = env->GetStringUTFChars(jfeature, &iscopy);
|
||||
if (!feature) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DOMImplementation.hasFeature: GetStringUTFChars feature failed\n"));
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
const char* version = NULL;
|
||||
jboolean iscopy2 = JNI_FALSE;
|
||||
const char* version = env->GetStringUTFChars(jversion, &iscopy2);
|
||||
if (jversion) {
|
||||
version = env->GetStringUTFChars(jversion, &iscopy2);
|
||||
if (!version) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DOMImplementation.hasFeature: GetStringUTFChars version failed\n"));
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool ret = PR_FALSE;
|
||||
nsresult rv = dom->HasFeature(feature, version, &ret);
|
||||
|
|
|
@ -61,14 +61,17 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createAttribute
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* name = NULL;
|
||||
nsIDOMAttr* ret = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* name = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (jname) {
|
||||
name = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (!name) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createAttribute: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->CreateAttribute(name, &ret);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -119,14 +122,17 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createCDATASection
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* data = NULL;
|
||||
nsIDOMCDATASection* ret = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (jdata) {
|
||||
data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (!data) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createCDATASection: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->CreateCDATASection(data, &ret);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -176,14 +182,17 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createComment
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* data = NULL;
|
||||
nsIDOMComment* ret = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (jdata) {
|
||||
data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (!data) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createComment: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->CreateComment(data, &ret);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -270,14 +279,17 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createElement
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* tagName = NULL;
|
||||
nsIDOMElement* ret = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* tagName = env->GetStringUTFChars(jtagName, &iscopy);
|
||||
if (jtagName) {
|
||||
tagName = env->GetStringUTFChars(jtagName, &iscopy);
|
||||
if (!tagName) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createElement: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->CreateElement(tagName, &ret);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -328,14 +340,17 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createEntityReferenc
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* name = NULL;
|
||||
nsIDOMEntityReference* ret = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* name = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (jname) {
|
||||
name = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (!name) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createEntityReference: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->CreateEntityReference(name, &ret);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -386,22 +401,28 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createProcessingInst
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* target = NULL;
|
||||
const char* data = NULL;
|
||||
nsIDOMProcessingInstruction* ret = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
jboolean iscopy2 = JNI_FALSE;
|
||||
const char* target = env->GetStringUTFChars(jtarget, &iscopy);
|
||||
if (jtarget) {
|
||||
target = env->GetStringUTFChars(jtarget, &iscopy);
|
||||
if (!target) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createProcessingInstruction: GetStringUTFChars target failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char* data = env->GetStringUTFChars(jdata, &iscopy2);
|
||||
if (jdata) {
|
||||
data = env->GetStringUTFChars(jdata, &iscopy2);
|
||||
if (!data) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createProcessingInstruction: GetStringUTFChars data failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->CreateProcessingInstruction(target, data, &ret);
|
||||
if (iscopy2 == JNI_TRUE)
|
||||
|
@ -454,14 +475,17 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createTextNode
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* data = NULL;
|
||||
nsIDOMText* ret = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (jdata) {
|
||||
data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (!data) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.createAttribute: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->CreateTextNode(data, &ret);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
@ -588,14 +612,17 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getElementsByTagName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* tagName = NULL;
|
||||
nsIDOMNodeList* elements = nsnull;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* tagName = env->GetStringUTFChars(jtagName, &iscopy);
|
||||
if (jtagName) {
|
||||
tagName = env->GetStringUTFChars(jtagName, &iscopy);
|
||||
if (!tagName) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.getElementsByTagName: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = doc->GetElementsByTagName(tagName, &elements);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
|
|
@ -39,13 +39,16 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ElementImpl_getAttribute
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* cname = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* cname = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (jname) {
|
||||
cname = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (!cname) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.getAttribute: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsString attr;
|
||||
nsresult rv = element->GetAttribute(cname, attr);
|
||||
|
@ -83,23 +86,28 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_getAttributeNode
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* cname = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* cname = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (jname) {
|
||||
cname = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (!cname) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.getAttributeNode: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMAttr* attr = nsnull;
|
||||
nsresult rv = element->GetAttributeNode(cname, &attr);
|
||||
if (iscopy == JNI_TRUE)
|
||||
env->ReleaseStringUTFChars(jname, cname);
|
||||
if (NS_FAILED(rv) || !attr) {
|
||||
if (NS_FAILED(rv)) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.getAttributeNode: failed", rv);
|
||||
return NULL;
|
||||
}
|
||||
if (!attr)
|
||||
return NULL;
|
||||
|
||||
jobject jattr = env->AllocObject(JavaDOMGlobals::attrClass);
|
||||
if (!jattr) {
|
||||
|
@ -135,13 +143,16 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_getElementsByTagName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char* cname = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* cname = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (jname) {
|
||||
cname = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (!cname) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.getElementsByTagName: GetStringUTFChars failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNodeList* nodes = nsnull;
|
||||
nsresult rv = element->GetElementsByTagName(cname, &nodes);
|
||||
|
@ -340,21 +351,27 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_setAttribute
|
|||
return;
|
||||
}
|
||||
|
||||
const char* name = NULL;
|
||||
const char* value = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* name = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (jname) {
|
||||
name = env->GetStringUTFChars(jname, &iscopy);
|
||||
if (!name) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.setAttribute: GetStringUTFChars name failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
jboolean iscopy2 = JNI_FALSE;
|
||||
const char* value = env->GetStringUTFChars(jvalue, &iscopy2);
|
||||
if (jvalue) {
|
||||
value = env->GetStringUTFChars(jvalue, &iscopy2);
|
||||
if (!value) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.setAttribute: GetStringUTFChars name failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = element->SetAttribute(name, value);
|
||||
if (iscopy2 == JNI_TRUE)
|
||||
|
|
|
@ -34,6 +34,9 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_NodeImpl_XPCOM_1equals
|
|||
{
|
||||
jboolean b_retFlag = JNI_FALSE;
|
||||
|
||||
if (!nodeArg)
|
||||
return b_retFlag;
|
||||
|
||||
nsIDOMNode* p_thisNode =
|
||||
(nsIDOMNode*) env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!p_thisNode) {
|
||||
|
@ -138,13 +141,16 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_appendChild
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nsIDOMNode* child = (nsIDOMNode*)
|
||||
nsIDOMNode* child = NULL;
|
||||
if (jchild) {
|
||||
child = (nsIDOMNode*)
|
||||
env->GetLongField(jchild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!child) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.appendChild: NULL child pointer");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNode* ret = nsnull;
|
||||
nsresult rv = node->AppendChild(child, &ret);
|
||||
|
@ -663,21 +669,27 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_insertBefore
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nsIDOMNode* newChild = (nsIDOMNode*)
|
||||
nsIDOMNode* newChild = NULL;
|
||||
if (jnewChild) {
|
||||
newChild = (nsIDOMNode*)
|
||||
env->GetLongField(jnewChild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!newChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.insertBefore: NULL newChild pointer");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNode* refChild = (nsIDOMNode*)
|
||||
nsIDOMNode* refChild = NULL;
|
||||
if (jrefChild) {
|
||||
refChild = (nsIDOMNode*)
|
||||
env->GetLongField(jrefChild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!refChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.insertBefore: NULL refChild pointer");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNode* ret = nsnull;
|
||||
nsresult rv = node->InsertBefore(newChild, refChild, &ret);
|
||||
|
@ -714,13 +726,16 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_removeChild
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nsIDOMNode* oldChild = (nsIDOMNode*)
|
||||
nsIDOMNode* oldChild = NULL;
|
||||
if (joldChild) {
|
||||
oldChild = (nsIDOMNode*)
|
||||
env->GetLongField(joldChild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!oldChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.removeChild: NULL oldChild pointer");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNode* ret = nsnull;
|
||||
nsresult rv = node->RemoveChild(oldChild, &ret);
|
||||
|
@ -755,21 +770,27 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_replaceChild
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nsIDOMNode* newChild = (nsIDOMNode*)
|
||||
nsIDOMNode* newChild = NULL;
|
||||
if (jnewChild) {
|
||||
newChild = (nsIDOMNode*)
|
||||
env->GetLongField(jnewChild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!newChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.replaceChild: NULL newChild pointer");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNode* oldChild = (nsIDOMNode*)
|
||||
nsIDOMNode* oldChild = NULL;
|
||||
if (joldChild) {
|
||||
oldChild = (nsIDOMNode*)
|
||||
env->GetLongField(joldChild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!oldChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.replaceChild: NULL oldChild pointer");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNode* ret = nsnull;
|
||||
nsresult rv = node->ReplaceChild(newChild, oldChild, &ret);
|
||||
|
@ -806,13 +827,16 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_NodeImpl_setNodeValue
|
|||
return;
|
||||
}
|
||||
|
||||
const char* value = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (jvalue) {
|
||||
value = env->GetStringUTFChars(jvalue, &iscopy);
|
||||
if (!value) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.setNodeValue: GetStringUTFChars failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = node->SetNodeValue(value);
|
||||
if (iscopy == JNI_TRUE)
|
||||
|
|
|
@ -72,7 +72,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ProcessingInstructionImpl_getTarg
|
|||
}
|
||||
|
||||
nsString ret;
|
||||
nsresult rv = pi->GetData(ret);
|
||||
nsresult rv = pi->GetTarget(ret);
|
||||
if (NS_FAILED(rv)) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"ProcessingInstruction.getTarget: failed", rv);
|
||||
|
@ -105,13 +105,17 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_ProcessingInstructionImpl_setData
|
|||
return;
|
||||
}
|
||||
|
||||
const char* data = NULL;
|
||||
jboolean iscopy = JNI_FALSE;
|
||||
const char* data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (jdata) {
|
||||
data = env->GetStringUTFChars(jdata, &iscopy);
|
||||
if (!data) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"ProcessingInstruction.setData: GetStringUTFChars failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = pi->SetData(data);
|
||||
if (iscopy == JNI_TRUE)
|
||||
env->ReleaseStringUTFChars(jdata, data);
|
||||
|
|
Загрузка…
Ссылка в новой задаче