diff --git a/mozilla/java/webclient/README b/mozilla/java/webclient/README index 292fc995dbe..7cf1c8b8799 100644 --- a/mozilla/java/webclient/README +++ b/mozilla/java/webclient/README @@ -12,7 +12,7 @@ Win32 Build Directions: ======================================================================== Requirements: -* built M8 mozilla tree for WinNT4.0 +* built mozilla with source code from after 10/5/99 * JDK1.1.7 or greater @@ -26,16 +26,6 @@ How To Build: * type "nmake /f makefile.win all" and hope for the best -* Due to bug 10561 (http://bugzilla.mozilla.org/show_bug.cgi?id=10561) - one must do a horrendous workaround: - - In the directory mozilla/dist/WIN32_D.OBJ/bin, copy the components.reg - file and the components directory to the following places: - - C:\WINNT\System32 - %JDKHOME%\jre\bin - %JDKHOME%\bin - How to Run: * once the build has successfully completed, run this batch file: diff --git a/mozilla/java/webclient/changelo b/mozilla/java/webclient/changelo index af469d4b003..525ede61217 100644 --- a/mozilla/java/webclient/changelo +++ b/mozilla/java/webclient/changelo @@ -1,3 +1,15 @@ +1999-10-07 > + + * This change fixes + http://bugzilla.mozilla.org/show_bug.cgi?id=15793 which caused one + to have to copy the component.reg and components directory. It + also causes webclient to do autoregistration. It also adds a + debugging method to BrowserControlMozillaShim.java + nativeDebugBreak(). + + Reviewed by Mark Lin + Approved by Ed Burns , module owner + Mon Aug 9 20:25:49 1999 Mark Lin * Ported webclient to Linux * Added a motif and win32 directory under classes/org/mozilla/webclient diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java index b8aa3999fb9..0f5a3e7c275 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java @@ -44,7 +44,7 @@ import java.awt.*; * See concrete subclasses for scope info. - * @version $Id: BrowserControlCanvas.java,v 1.2 1999-08-13 23:02:39 mark.lin%eng.sun.com Exp $ + * @version $Id: BrowserControlCanvas.java,v 1.3 1999-10-08 00:48:00 edburns%acm.org Exp $ * @see org.mozilla.webclient.win32.Win32BrowserControlCanvas @@ -93,7 +93,7 @@ private Rectangle windowRelativeBounds; * Initialize the BrowserControlMozillaShim. For now, * this initializes the Mozilla registry. */ -public BrowserControlCanvas () +protected BrowserControlCanvas () { nativeWindow = 0; webShell = null; @@ -101,14 +101,17 @@ public BrowserControlCanvas () boundsValid = false; hasFocus = false; +} // BrowserControlCanvas() ctor + +protected static void initialize(String verifiedBinDirAbsolutePath) +{ try { - BrowserControlMozillaShim.initialize(); + BrowserControlMozillaShim.initialize(verifiedBinDirAbsolutePath); } catch (Exception e) { System.out.println(e.toString()); } -} // BrowserControlCanvas() ctor - - +} + /** * Obtain the native window handle for this component's * peer. @@ -137,7 +140,7 @@ public void addNotify () // accessing its native window handle. dsi.lock(); nativeWindow = getWindow(dsi); - + try { Rectangle r = new Rectangle(getBoundsRelativeToWindow()); webShell = new BrowserControlImpl(nativeWindow, r); diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvasFactory.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvasFactory.java index 16decd68af2..bb3b1296192 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvasFactory.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvasFactory.java @@ -19,6 +19,9 @@ import org.mozilla.util.Assert; import org.mozilla.util.Log; import org.mozilla.util.ParameterCheck; +import java.io.File; +import java.io.FileNotFoundException; + /** * * BrowserControlCanvasFactory creates concrete instances of BrowserControlCanvas @@ -28,7 +31,7 @@ import org.mozilla.util.ParameterCheck; * This is a static class, it is neven instantiated. * - * @version $Id: BrowserControlCanvasFactory.java,v 1.3 1999-08-12 21:29:15 mark.lin%eng.sun.com Exp $ + * @version $Id: BrowserControlCanvasFactory.java,v 1.4 1999-10-08 00:48:01 edburns%acm.org Exp $ * * @see org.mozilla.webclient.test.EmbeddedMozilla @@ -44,6 +47,10 @@ public class BrowserControlCanvasFactory extends Object // Class Variables // + private static boolean appDataHasBeenSet = false; + private static Class browserControlCanvasClass = null; + private static String platformCanvasClassName = null; + // // Instance Variables // @@ -65,57 +72,76 @@ public BrowserControlCanvasFactory() // Class methods // -public static BrowserControlCanvas newBrowserControlCanvas() + /** + + * This method is used to set per-application instance data, such as + * the location of the browser binary. + + * @param absolutePathToNativeBrowserBinDir the path to the bin dir + * of the native browser, including the bin. ie: + * "D:\Projects\mozilla\dist\win32_d.obj\bin" + + */ + +public static void setAppData(String absolutePathToNativeBrowserBinDir) throws FileNotFoundException, ClassNotFoundException { - Class browserControlCanvasClass = null; - String className = null; - - BrowserControlCanvas result = null; - // PENDING(edburns): do some magic to determine the right kind of - // MozWebShellCanvas to instantiate + if (!appDataHasBeenSet) { + ParameterCheck.nonNull(absolutePathToNativeBrowserBinDir); + + // verify that the directory exists: + File binDir = new File(absolutePathToNativeBrowserBinDir); + if (!binDir.exists()) { + throw new FileNotFoundException("Directory " + absolutePathToNativeBrowserBinDir + " is not found."); + } - // How about this: - // I try loading sun.awt.windows.WDrawingSurfaceInfo. If it doesn't - // load, then I try loading sun.awt.motif.MDrawingSufaceInfo. If - // none loads, then I return a error message. - // If you think up of a better way, let me know. - // -- Mark - - try { + // cause the native library to be loaded + // PENDING(edburns): do some magic to determine the right kind of + // MozWebShellCanvas to instantiate + + // How about this: + // I try loading sun.awt.windows.WDrawingSurfaceInfo. If it doesn't + // load, then I try loading sun.awt.motif.MDrawingSufaceInfo. If + // none loads, then I return a error message. + // If you think up of a better way, let me know. + // -- Mark + Class win32DrawingSurfaceInfoClass = Class.forName("sun.awt.windows.WDrawingSurfaceInfo"); if (win32DrawingSurfaceInfoClass != null) { - className = "org.mozilla.webclient.win32.Win32BrowserControlCanvas"; + platformCanvasClassName = "org.mozilla.webclient.win32.Win32BrowserControlCanvas"; } - } catch (Exception e) { - // Do nothing???? - } - - try { - Class motifDrawingSurfaceInfoClass = - Class.forName("sun.awt.motif.MDrawingSurfaceInfo"); - if (motifDrawingSurfaceInfoClass != null) { - className = "org.mozilla.webclient.motif.MotifBrowserControlCanvas"; - } - } catch (Exception e) { - // Do nothing???? - } - - if (className != null) { - try { - if (null != (browserControlCanvasClass = Class.forName(className))) { - result = (BrowserControlCanvas) browserControlCanvasClass.newInstance(); + if (null == platformCanvasClassName) { + Class motifDrawingSurfaceInfoClass = + Class.forName("sun.awt.motif.MDrawingSurfaceInfo"); + + if (motifDrawingSurfaceInfoClass != null) { + platformCanvasClassName = "org.mozilla.webclient.motif.MotifBrowserControlCanvas"; } - } catch (Exception e) { - System.out.println("Got Exception: " + e.getMessage()); - e.printStackTrace(); } - } else { - System.out.println("Could not determine WebShellCanvas class to load\n"); + if (platformCanvasClassName != null) { + browserControlCanvasClass = Class.forName(platformCanvasClassName); + } + else { + throw new ClassNotFoundException("Could not determine WebShellCanvas class to load\n"); + } + + BrowserControlCanvas.initialize(absolutePathToNativeBrowserBinDir); + appDataHasBeenSet = true; } - +} + +public static BrowserControlCanvas newBrowserControlCanvas() throws InstantiationException, IllegalAccessException, IllegalStateException +{ + if (!appDataHasBeenSet) { + throw new IllegalStateException("Can't create BrowserControlCanvasInstance: setAppData() has not been called."); + } + Assert.assert(null != browserControlCanvasClass); + + BrowserControlCanvas result = null; + result = (BrowserControlCanvas) browserControlCanvasClass.newInstance(); + return result; } @@ -135,9 +161,16 @@ public static void main(String [] args) Assert.setEnabled(true); Log.setApplicationName("BrowserControlCanvasFactory"); Log.setApplicationVersion("0.0"); - Log.setApplicationVersionDate("$Id: BrowserControlCanvasFactory.java,v 1.3 1999-08-12 21:29:15 mark.lin%eng.sun.com Exp $"); + Log.setApplicationVersionDate("$Id: BrowserControlCanvasFactory.java,v 1.4 1999-10-08 00:48:01 edburns%acm.org Exp $"); - BrowserControlCanvas canvas = BrowserControlCanvasFactory.newBrowserControlCanvas(); + BrowserControlCanvas canvas = null; + try { + BrowserControlCanvasFactory.setAppData(args[0]); + canvas = BrowserControlCanvasFactory.newBrowserControlCanvas(); + } + catch (Exception e) { + System.out.println(e.getMessage()); + } Assert.assert(null != canvas); }