M dist/mcp-test/src/test/java/cardemo/CarDemoTest.java
- this automated test is now a complete example for how to test an ajax web application in an automated fashion. M dom/classes/org/mozilla/dom/NodeImpl.java M dom/jni/org_mozilla_dom_NodeImpl.cpp - implement getTextContent() from DOM level 3. M webclient/build-tests.xml - add cardemoTest to unit test list as a place-holder until I can write a testcase that doesn't require the public Internet. A webclient/classes_spec/org/mozilla/mcp/AjaxListener.java - New class. Docs forthcoming. M webclient/classes_spec/org/mozilla/mcp/MCP.java - new methods to support complete ajax automated testing. M webclient/src_moz/AjaxListener.cpp M webclient/src_moz/AjaxListener.h - add mIsObserving flag. From our dtor, make sure to remove ourselves from the EmbedProgress. M webclient/src_moz/EmbedProgress.cpp M webclient/src_moz/EmbedProgress.h - We need to add ourselves as an observer both from SetCapturePageInfo and SetEventRegistration. M webclient/src_moz/NativeBrowserControl.cpp - Unit testing found a bug! We can't call mWindow->ReleaseChildren() until after we remove ourself as a listener. git-svn-id: svn://10.0.0.236/trunk@221594 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -137,6 +137,7 @@ public class NodeImpl implements Node, EventTarget {
|
||||
public native Node removeChild(Node oldChild) throws DOMException;
|
||||
public native Node replaceChild(Node newChild, Node oldChild) throws DOMException;
|
||||
public native void setNodeValue(String nodeValue);
|
||||
public native String getTextContent() throws DOMException;
|
||||
|
||||
protected native void finalize();
|
||||
|
||||
@@ -254,9 +255,7 @@ public void setTextContent(String textContent) {
|
||||
public Object setUserData(String key, Object data, UserDataHandler handler) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public String getTextContent() throws DOMException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "prlog.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOM3Node.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
@@ -727,6 +728,48 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getNodeValue
|
||||
return jret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_dom_NodeImpl
|
||||
* Method: getTextContent
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getTextContent
|
||||
(JNIEnv *env, jobject jthis)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node = (nsIDOMNode*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
nsCOMPtr<nsIDOM3Node> dom3Node = nsnull;;
|
||||
if (!node)
|
||||
return NULL;
|
||||
|
||||
nsString ret;
|
||||
nsresult rv;
|
||||
|
||||
dom3Node = do_QueryInterface(node, &rv);
|
||||
if (NS_SUCCEEDED(rv) && dom3Node) {
|
||||
rv = dom3Node->GetTextContent(ret);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
|
||||
if (rv == NS_ERROR_DOM_DOMSTRING_SIZE_ERR) {
|
||||
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
|
||||
}
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.getNodeValue: failed", rv, exceptionType);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.getNodeValue: NewString failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return jret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_dom_NodeImpl
|
||||
* Method: getOwnerDocument
|
||||
|
||||
Reference in New Issue
Block a user