diff --git a/mozilla/java/README b/mozilla/java/README
index f0dcc713223..485f14e2d7e 100644
--- a/mozilla/java/README
+++ b/mozilla/java/README
@@ -75,3 +75,6 @@ Problems?
* post to netscape.public.mozilla.java newsgroup
+A sample of working debugger opts for msdev:
+
+-DNSPR_LOG_MODULES=javadom:4,webclient:4,webclientstub:4,pluglets:4 -DNSPR_LOG_FILE=F:\Projects\mozilla\FIREFOX_2_0_0_3_RELEASE\mozilla\java\webclient\build.test\webclient.log -Dbuild.test.results.dir=F:\Projects\mozilla\FIREFOX_2_0_0_3_RELEASE\mozilla\java\webclient\build.test -DBROWSER_BIN_DIR=F:\Projects\mozilla\FIREFOX_2_0_0_3_RELEASE\mozilla\xulrunner-win32_d.obj\dist\bin -Djava.util.logging.config.file=F:\Projects\mozilla\FIREFOX_2_0_0_3_RELEASE\mozilla\java\logging.properties -Djava.library.path=F:\Projects\mozilla\FIREFOX_2_0_0_3_RELEASE\mozilla\xulrunner-win32_d.obj\dist\bin -classpath F:\Projects\mozilla\FIREFOX_2_0_0_3_RELEASE\mozilla\xulrunner-win32_d.obj\dist\classes;F:\Projects\mozilla\FIREFOX_2_0_0_3_RELEASE\mozilla\xulrunner-win32_d.obj\dist\classes\test\classes;C:\PROGRA~1\netbeans-5.5.1\ide7\modules\ext\junit-3.8.1.jar org.mozilla.webclient.test.TestBrowser
diff --git a/mozilla/java/webclient/build.xml b/mozilla/java/webclient/build.xml
index bc117660fb0..fa1241c365b 100644
--- a/mozilla/java/webclient/build.xml
+++ b/mozilla/java/webclient/build.xml
@@ -90,7 +90,8 @@
-
+
diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java
index ba404493e0d..826e6cc2cd9 100644
--- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java
+++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java
@@ -57,6 +57,8 @@ public interface WebclientFactory {
public void setAppData(String absolutePathToNativeBrowserBinDir)
throws FileNotFoundException, ClassNotFoundException;
+
+ public void setProfileDir(String profileDir);
/**
*
diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java
index 6569adbe9da..48f0eaf8db5 100644
--- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java
+++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java
@@ -102,6 +102,11 @@ public void setAppData(String absolutePathToNativeBrowserBinDir) throws FileNotF
throw new ClassNotFoundException(ule.getMessage(), ule);
}
}
+
+ public void setProfileDir(String profileDir) {
+ getWrapperFactory().setProfileDir(profileDir);
+ }
+
/******
// figure out the correct value for platformCanvasClassName
if (browserType.equals(BrowserControl.BROWSER_TYPE_NON_NATIVE)) {
@@ -137,6 +142,8 @@ public void setAppData(String absolutePathToNativeBrowserBinDir) throws FileNotF
}
********************/
+
+
public void appTerminate() throws Exception
{
getWrapperFactory().terminate();
diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
index 45544f7f7fa..a5a998f1f1d 100644
--- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
+++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
@@ -80,6 +80,12 @@ public interface WrapperFactory {
public void initialize(String verifiedBinDirAbsolutePath) throws SecurityException, UnsatisfiedLinkError;
+ public String getBinDir();
+
+ public void setProfileDir(String profileDir);
+
+ public String getProfileDir();
+
public void verifyInitialized() throws IllegalStateException;
public void terminate() throws Exception;
diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
index 0016d2ce13f..ad01c7caa39 100644
--- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
+++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
@@ -23,8 +23,15 @@
package org.mozilla.webclient.impl.wrapper_native;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.mozilla.util.Assert;
-import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import org.mozilla.util.ReturnRunnable;
@@ -32,7 +39,6 @@ import org.mozilla.webclient.ProfileManager;
import org.mozilla.webclient.impl.WrapperFactory;
import org.mozilla.webclient.impl.Service;
-import org.mozilla.webclient.UnimplementedException;
public class ProfileManagerImpl extends ImplObjectNative implements ProfileManager, Service
@@ -47,8 +53,17 @@ public ProfileManagerImpl(WrapperFactory yourFactory)
}
public void startup() {
+ String profileDir = this.getWrapperFactory().getProfileDir();
+ if (null == profileDir) {
+ createProfileDirInBinDir();
+ }
Assert.assert_it(isNativeEventThread());
- nativeStartup(getWrapperFactory().getNativeWrapperFactory(), null,
+
+ // Ensure getProfileDir ends with File.separator
+ if (!getWrapperFactory().getProfileDir().endsWith(File.separator)) {
+ getWrapperFactory().setProfileDir(getWrapperFactory().getProfileDir() + File.separator);
+ }
+ nativeStartup(getWrapperFactory().getNativeWrapperFactory(), getWrapperFactory().getProfileDir(),
getWrapperFactory().getProfile());
}
@@ -57,6 +72,42 @@ public void shutdown() {
nativeShutdown(getWrapperFactory().getNativeWrapperFactory());
}
+private String defaultProfileName = "mevgf29o.default";
+
+private void createProfileDirInBinDir() {
+ getWrapperFactory().setProfileDir(getWrapperFactory().getBinDir());
+ if (null == getWrapperFactory().getProfile()){
+ getWrapperFactory().setProfile(defaultProfileName);
+ }
+ File profileDirFile = new File(getWrapperFactory().getProfileDir() +
+ File.separator + getWrapperFactory().getProfile());
+ // Assume that if the profileDir exists, it must be valid. Otherwise
+ // create it.
+ if (!profileDirFile.exists()) {
+ profileDirFile.mkdir();
+ URL profileDirContentsResource = Thread.currentThread().getContextClassLoader().getResource("META-INF/default-profile-dir-contents.jar");
+ try {
+ JarInputStream jis = new JarInputStream(profileDirContentsResource.openStream());
+ JarEntry cur = null;
+ FileOutputStream fos = null;
+ File profileEntry = null;
+ int i;
+ while (null != (cur = jis.getNextJarEntry())) {
+ profileEntry = new File(profileDirFile, cur.getName());
+ fos = new FileOutputStream(profileEntry);
+ while (-1 != (i = jis.read())) {
+ fos.write(i);
+ }
+ fos.close();
+ jis.closeEntry();
+ }
+ jis.close();
+ } catch (IOException ex) {
+ Logger.getLogger(ProfileManagerImpl.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+}
+
public int getProfileCount()
{
Integer result = (Integer)
diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
index 06d5daa17d7..36879835bfe 100644
--- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
+++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
@@ -105,7 +105,7 @@ public class WrapperFactoryImpl extends Object implements WrapperFactory {
// Attribute Instance Variables
protected String platformCanvasClassName = null;
- protected String profileName = "webclient";
+ protected String profileName = null;
protected boolean initialized = false;
protected boolean terminated = false;
protected CountDownLatch oneCountLatch = null;
@@ -137,6 +137,9 @@ public class WrapperFactoryImpl extends Object implements WrapperFactory {
protected ProfileManager profileManager = null;
+ private String binDir = null;
+
+ private String profileDir = null;
//
// Constructors and Initializers
//
@@ -184,6 +187,7 @@ public class WrapperFactoryImpl extends Object implements WrapperFactory {
browserControls.put(result, new Integer(nativeBrowserControl));
if (1 == browserControls.size()) {
copyProxySettingsIfNecessary();
+ setMiscPrefs();
}
return result;
}
@@ -360,8 +364,10 @@ public class WrapperFactoryImpl extends Object implements WrapperFactory {
LOGGER.log(Level.SEVERE, "Unable to find method 'newNativeEventThread' on class " +
getPlatformCanvasClassName(), nsme);
}
+
+ binDir = verifiedBinDirAbsolutePath;
- final String finalStr = new String(verifiedBinDirAbsolutePath);
+ final String finalStr = new String(binDir);
eventThread.pushRunnable(new Runnable() {
public void run() {
@@ -425,6 +431,18 @@ public class WrapperFactoryImpl extends Object implements WrapperFactory {
}
+
+ public String getBinDir() {
+ return binDir;
+ }
+
+ public String getProfileDir() {
+ return profileDir;
+ }
+
+ public void setProfileDir(String profileDir) {
+ this.profileDir = profileDir;
+ }
private enum ProxyEnum {
httpProxyHost,
@@ -526,6 +544,11 @@ public class WrapperFactoryImpl extends Object implements WrapperFactory {
}
}
+ public void setMiscPrefs() {
+ prefs.setPref("security.suppress_nss_rw_impossible_warning", "true");
+
+ }
+
public void verifyInitialized() throws IllegalStateException
{
if (!initialized) {
diff --git a/mozilla/java/webclient/src_moz/ProfileManagerImpl.cpp b/mozilla/java/webclient/src_moz/ProfileManagerImpl.cpp
index 5894c13eb41..c91c61bf757 100644
--- a/mozilla/java/webclient/src_moz/ProfileManagerImpl.cpp
+++ b/mozilla/java/webclient/src_moz/ProfileManagerImpl.cpp
@@ -38,6 +38,13 @@
#include // for the profile manager
#include // for the profile manager
#include // for nsCAutoString
+#include
+#include
+#include
+#include
+#include
+
+#include "nsXPCOMCID.h" // for NS_DIRECTORY_SERVICE_CONTRACTID
// edburns_20060216
// static NS_DEFINE_CID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
@@ -171,6 +178,54 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_ProfileMa
NS_ADDREF(wcContext->sProfileInternal);
#endif // edburns_20060216
+ nsresult rv;
+
+ nsCOMPtr directoryService =
+ do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
+ nsCOMPtr properties = do_QueryInterface(directoryService);
+ nsCOMPtr profileDirFile;
+
+ PRUnichar *profileDirUnichar = (PRUnichar *)
+ ::util_GetStringChars(env, profileDir);
+ PRUnichar *profileNameUnichar = (PRUnichar *)
+ ::util_GetStringChars(env, profileNameJstr);
+
+ nsDependentString profileDirStr(profileDirUnichar);
+ nsDependentString profileNameStr(profileNameUnichar);
+ nsString fullyQualified = profileDirStr + profileNameStr;
+
+ rv = NS_NewLocalFile(fullyQualified,
+ PR_TRUE,
+ (nsILocalFile **)((nsIFile **)getter_AddRefs(profileDirFile)));
+ ::util_ReleaseStringChars(env, profileDir, profileDirUnichar);
+ ::util_ReleaseStringChars(env, profileNameJstr, profileNameUnichar);
+
+ if (NS_FAILED(rv)) {
+ ::util_ThrowExceptionToJava(env, "Can't create profile directory.");
+ return;
+ }
+
+ properties->Set("ProfD", profileDirFile);
+
+ if (NS_FAILED(rv)) {
+ ::util_ThrowExceptionToJava(env, "Can't create profile directory.");
+ return;
+ }
+
+ nsCOMPtr psm = do_GetService("@mozilla.org/psm;1");
+ if (!psm) {
+ PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
+ ("WrapperFactoryImpl_nativeAppSetup: unable to initialize PSM. https sites will crash the client\n"));
+ }
+ else {
+ PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
+ ("WrapperFactoryImpl_nativeAppSetup: successfully initialized PSM. https sites will NOT crash the client\n"));
+ }
+
+
+
+
+
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("ProfileManagerImpl_nativeStartup: exiting\n"));
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 6cd25b61232..4c3c8aa326d 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
@@ -120,6 +120,7 @@ public class TestBrowser extends JPanel {
frame.pack();
frame.setVisible(true);
+ testBrowser.setVisible(true);
if (1 == args.length) {
testBrowser.loadURL(args[0]);
}
@@ -445,6 +446,7 @@ public class TestBrowser extends JPanel {
if (curUrl == null) {
// Check if the text value starts with known protocols.
if (inputValue.toLowerCase().startsWith("http://")
+ || inputValue.toLowerCase().startsWith("https://")
|| inputValue.toLowerCase().startsWith("ftp://")
|| inputValue.toLowerCase().startsWith("gopher://")
|| inputValue.toLowerCase().startsWith("file://")) {
@@ -460,6 +462,7 @@ public class TestBrowser extends JPanel {
}
}
+ browserControlCanvas.setVisible(true);
navigation.loadURL(curUrl.toString());
// Update the address text field, statusbar, and toolbar info.