diff --git a/mozilla/java/dist/build.xml b/mozilla/java/dist/build.xml index a0cd6d6a0ce..af30c710ba7 100644 --- a/mozilla/java/dist/build.xml +++ b/mozilla/java/dist/build.xml @@ -32,8 +32,8 @@ - - + + @@ -266,7 +266,7 @@ protected="${javadoc.protected}" windowtitle="${Name} (${version})" doctitle="${Name} (${version})" - bottom="Copyright © 2002-2005 Mozilla.org All Rights Reserved."> + bottom="Copyright © 2002-2007 Mozilla.org All Rights Reserved."> diff --git a/mozilla/java/dist/netbeans/build.xml b/mozilla/java/dist/netbeans/build.xml index ac97092fc39..ca2af049e28 100755 --- a/mozilla/java/dist/netbeans/build.xml +++ b/mozilla/java/dist/netbeans/build.xml @@ -337,7 +337,7 @@ ${so.prefix}xul.${so.extension}. org.mozilla.webclient.impl.WebclientFactoryImpl org.mozilla.webclient.impl.wrapper_native.WrapperFactoryImpl - diff --git a/mozilla/java/dist/netbeans/nbproject/project.properties b/mozilla/java/dist/netbeans/nbproject/project.properties index c5a3d2753ac..3797f115149 100755 --- a/mozilla/java/dist/netbeans/nbproject/project.properties +++ b/mozilla/java/dist/netbeans/nbproject/project.properties @@ -19,10 +19,10 @@ dist.javadoc.dir=${dist.dir}/javadoc file.reference.main-java=../test/manual/src/main/java file.reference.main-java-1=../test/automated/src/main/java file.reference.main-java-2=../src/main/java -file.reference.webclient-2_0_a5.jar=../lib/webclient-2_0_a5.jar +file.reference.webclient-2_0_a6.jar=../lib/webclient-2_0_a6.jar jar.compress=false javac.classpath=\ - ${file.reference.webclient-2_0_a5.jar} + ${file.reference.webclient-2_0_a6.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/mozilla/java/webclient/src_moz/AjaxListener.cpp b/mozilla/java/webclient/src_moz/AjaxListener.cpp index 1db14194bd0..0c13c8ac432 100755 --- a/mozilla/java/webclient/src_moz/AjaxListener.cpp +++ b/mozilla/java/webclient/src_moz/AjaxListener.cpp @@ -50,11 +50,9 @@ NS_IMPL_ISUPPORTS2(AjaxListener, nsIDOMEventListener) AjaxListener::AjaxListener(EmbedProgress *owner, - JNIEnv *env, - jobject eventRegistration) : + JNIEnv *env) : mOwner(owner), mJNIEnv(env), - mEventRegistration(eventRegistration), mIsObserving(PR_FALSE) { } @@ -62,7 +60,6 @@ AjaxListener::AjaxListener(EmbedProgress *owner, AjaxListener::~AjaxListener() { mOwner->RemoveAjaxListener(); - mEventRegistration = nsnull; mJNIEnv = nsnull; mOwner = nsnull; mIsObserving = PR_FALSE; @@ -372,13 +369,17 @@ AjaxListener::ObserveAjax(nsIRequest *request, break; } - ::util_SendEventToJava(nsnull, - mEventRegistration, - DOCUMENT_LOAD_LISTENER_CLASSNAME, - DocumentLoader_maskValues[maskValue], - properties); + jobject eventRegistration = nsnull; + if (NS_SUCCEEDED(rv = mOwner->GetEventRegistration(&eventRegistration)) && + eventRegistration) { + ::util_SendEventToJava(nsnull, + eventRegistration, + DOCUMENT_LOAD_LISTENER_CLASSNAME, + DocumentLoader_maskValues[maskValue], + properties); + } - return NS_OK; + return rv; } diff --git a/mozilla/java/webclient/src_moz/AjaxListener.h b/mozilla/java/webclient/src_moz/AjaxListener.h index c2cd4150503..ba821268a38 100755 --- a/mozilla/java/webclient/src_moz/AjaxListener.h +++ b/mozilla/java/webclient/src_moz/AjaxListener.h @@ -47,7 +47,7 @@ public: }; AjaxListener(EmbedProgress *owner, - JNIEnv *env, jobject eventRegistration); + JNIEnv *env); virtual ~AjaxListener(); NS_IMETHOD StartObserving(void); @@ -62,7 +62,6 @@ private: EmbedProgress* mOwner; JNIEnv *mJNIEnv; - jobject mEventRegistration; PRBool mIsObserving; }; diff --git a/mozilla/java/webclient/src_moz/EmbedProgress.cpp b/mozilla/java/webclient/src_moz/EmbedProgress.cpp index 0f2390d0fa1..f6aa3c70924 100644 --- a/mozilla/java/webclient/src_moz/EmbedProgress.cpp +++ b/mozilla/java/webclient/src_moz/EmbedProgress.cpp @@ -507,7 +507,7 @@ EmbedProgress::GetAjaxListener(AjaxListener* *result) if (nsnull == mAjaxListener) { JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION); - mAjaxListener = new AjaxListener(this, env, mEventRegistration); + mAjaxListener = new AjaxListener(this, env); } *result = mAjaxListener; rv = NS_OK; @@ -529,6 +529,17 @@ EmbedProgress::RemoveAjaxListener(void) return rv; } +NS_IMETHODIMP +EmbedProgress::GetEventRegistration(jobject *result) +{ + if (nsnull == result) { + return NS_ERROR_NULL_POINTER; + } + *result = mEventRegistration; + return NS_OK; +} + + /* static */ void EmbedProgress::RequestToURIString(nsIRequest *aRequest, char **aString) diff --git a/mozilla/java/webclient/src_moz/EmbedProgress.h b/mozilla/java/webclient/src_moz/EmbedProgress.h index 2d8982ac351..c1620a05620 100644 --- a/mozilla/java/webclient/src_moz/EmbedProgress.h +++ b/mozilla/java/webclient/src_moz/EmbedProgress.h @@ -54,6 +54,7 @@ class EmbedProgress : public nsIWebProgressListener, NS_IMETHOD GetAjaxListener(AjaxListener** result); NS_IMETHOD RemoveAjaxListener(void); + NS_IMETHOD GetEventRegistration(jobject *result); NativeBrowserControl *mOwner; diff --git a/mozilla/java/webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java b/mozilla/java/webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java index cd33ba8b3fc..f3e40052a3e 100644 --- a/mozilla/java/webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java +++ b/mozilla/java/webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java @@ -114,7 +114,8 @@ public class TestBrowser extends JPanel { Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 1)); - contentPane.add(new TestBrowser()); + TestBrowser testBrowser = null; + contentPane.add(testBrowser = new TestBrowser()); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { @@ -124,6 +125,9 @@ public class TestBrowser extends JPanel { frame.pack(); frame.setVisible(true); + if (1 == args.length) { + testBrowser.loadURL(args[0]); + } } private void jbInit() throws Exception { @@ -410,13 +414,7 @@ public class TestBrowser extends JPanel { statusBar.lblStatus.setText(statusMessage); } - /** - * Check the current input URL string in the address text field, load it, - * and update the status info and toolbar info. - */ - void loadURL() { - String inputValue = jAddressTextField.getText(); - + void loadURL(String inputValue) { if (inputValue == null) { JOptionPane.showMessageDialog(this, "The given URL is NULL:", "Warning", JOptionPane.WARNING_MESSAGE); @@ -466,6 +464,14 @@ public class TestBrowser extends JPanel { } } } + /** + * Check the current input URL string in the address text field, load it, + * and update the status info and toolbar info. + */ + void loadURL() { + String inputValue = jAddressTextField.getText(); + loadURL(inputValue); + } void jGoButton_actionPerformed(ActionEvent e) { loadURL();