changeset 305:c7c696cdfec2

Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
author John Reimer<terminal.node@gmail.com>
date Sat, 16 Aug 2008 22:53:35 -0700
parents 16ba3d9cb209
children 9764f08379f2
files dwt/browser/AppFileLocProvider.d dwt/browser/Mozilla.d dwt/browser/WindowCreator2.d dwt/dwthelper/System.d dwt/internal/mozilla/XPCOMInit.d dwt/internal/mozilla/nsEmbedString2.d dwt/internal/mozilla/nsXPCOM.d dwt/internal/mozilla/nsXPCOMGlue.d
diffstat 8 files changed, 221 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/browser/AppFileLocProvider.d	Thu Aug 14 20:25:29 2008 -0700
+++ b/dwt/browser/AppFileLocProvider.d	Sat Aug 16 22:53:35 2008 -0700
@@ -28,7 +28,7 @@
 import dwt.internal.mozilla.nsILocalFile;
 import dwt.internal.mozilla.nsISupports;
 
-class AppFileLocProvider : directoryServiceProvider2 { 
+class AppFileLocProvider : nsIDirectoryServiceProvider2 { 
     int refCount = 0;
     String mozillaPath, profilePath;
     String[] pluginDirs;
--- a/dwt/browser/Mozilla.d	Thu Aug 14 20:25:29 2008 -0700
+++ b/dwt/browser/Mozilla.d	Sat Aug 16 22:53:35 2008 -0700
@@ -166,7 +166,7 @@
     static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$
     static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
     static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
-    static final String PROFILE_DIR = SEPARATOR_OS + "eclipse" ~ SEPARATOR_OS; //$NON-NLS-1$
+    static final String PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; //$NON-NLS-1$
     static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$
     static final String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$
     static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$
@@ -257,7 +257,11 @@
             Initialized = true;
         }
         String mozillaPath = System.getProperty (XULRUNNER_PATH);
-        /+ if (mozillaPath is null) {
+        if (mozillaPath is null) {
+            // we don't have to load an initial library in DWT, so set to "true"
+            initLoaded = true;
+/+
+        if (mozillaPath is null) {
             try {
                 String libName = mozDelegate.getSWTInitLibraryName ();
                 Library.loadLibrary (libName);
@@ -269,54 +273,57 @@
                 * points at a GRE. 
                 */
             }
-        } else { +/
++/
+        } else {
             mozillaPath ~= SEPARATOR_OS ~ mozDelegate.getLibraryName ();
             IsXULRunner = true;
-        // }
-
+        }
+         
         if (initLoaded) {
             /* attempt to discover a XULRunner to use as the GRE */
             GREVersionRange range;
             //byte[] bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER, true);
-            int /*long*/ lower = C.malloc (bytes.length);
-            C.memmove (lower, bytes, bytes.length);
-            range.lower = lower;
+            //int /*long*/ lower = C.malloc (bytes.length);
+            //C.memmove (lower, bytes, bytes.length);
+            range.lower = GRERANGE_LOWER;
             range.lowerInclusive = LowerRangeInclusive;
 
-            bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_UPPER, true);
-            int /*long*/ upper = C.malloc (bytes.length);
-            C.memmove (upper, bytes, bytes.length);
-            range.upper = upper;
+            //bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_UPPER, true);
+            //int /*long*/ upper = C.malloc (bytes.length);
+            //C.memmove (upper, bytes, bytes.length);
+            range.upper = GRERANGE_UPPER;
             range.upperInclusive = UpperRangeInclusive;
 
-            int length = XPCOMInit.PATH_MAX;
-            int /*long*/ greBuffer = C.malloc (length);
-            int /*long*/ propertiesPtr = C.malloc (2 * C.PTR_SIZEOF);
-            int rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, propertiesPtr, 0, greBuffer, length);
+            //int length = XPCOMInit.PATH_MAX;
+            //int /*long*/ greBuffer = C.malloc (length);
+            char[] greBuffer = new char[XPCOMInit.PATH_MAX];
+            //int /*long*/ propertiesPtr = C.malloc (2 * C.PTR_SIZEOF);
+            int rc = XPCOMInit.GRE_GetGREPathWithProperties (&range, 1, null, 0, greBuffer.ptr, greBuffer.length);
 
             /*
              * A XULRunner was not found that supports wrapping of XPCOM handles as JavaXPCOM objects.
              * Drop the lower version bound and try to detect an earlier XULRunner installation.
              */
             if (rc !is XPCOM.NS_OK) {
-                C.free (lower);
-                bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER_FALLBACK, true);
-                lower = C.malloc (bytes.length);
-                C.memmove (lower, bytes, bytes.length);
-                range.lower = lower;
-                rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, propertiesPtr, 0, greBuffer, length);
+                //C.free (lower);
+                //bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER_FALLBACK, true);
+                //lower = C.malloc (bytes.length);
+                //C.memmove (lower, bytes, bytes.length);
+                range.lower = GRERANGE_LOWER_FALLBACK;
+                rc = XPCOMInit.GRE_GetGREPathWithProperties (&range, 1, null, 0, greBuffer.ptr, greBuffer.length);
             }
 
-            C.free (lower);
-            C.free (upper);
-            C.free (propertiesPtr);
+            //C.free (lower);
+            //C.free (upper);
+            //C.free (propertiesPtr);
             if (rc is XPCOM.NS_OK) {
                 /* indicates that a XULRunner was found */
-                length = C.strlen (greBuffer);
-                bytes = new byte[length];
-                C.memmove (bytes, greBuffer, length);
-                mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes));
-                IsXULRunner = mozillaPath.length () > 0;
+                //length = C.strlen (greBuffer);
+                //bytes = new byte[length];
+                //C.memmove (bytes, greBuffer, length);
+                //mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes));
+                mozillaPath = greBuffer;
+                IsXULRunner = mozillaPath.length > 0;
 
                 /*
                  * Test whether the detected XULRunner can be used as the GRE before loading swt's
@@ -327,61 +334,67 @@
                  * is running in 32-bit mode, or vice versa.
                  */
                 if (IsXULRunner) {
-                    byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true);
-                    rc = XPCOMInit.XPCOMGlueStartup (path);
+                    // byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true);
+                    rc = XPCOMInit.XPCOMGlueStartup (mozillaPath.ptr);
                     if (rc !is XPCOM.NS_OK) {
                         IsXULRunner = false;    /* failed */
-                        mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
-                        if (Device.DEBUG) System.out.println ("cannot use detected XULRunner: " + mozillaPath); //$NON-NLS-1$
+                        mozillaPath = mozillaPath[0 .. locatePrior( mozillaPath, SEPARATOR_OS )];
+                        //mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
+                        if (Device.DEBUG) Stdout ("cannot use detected XULRunner: ") (mozillaPath).newline; //$NON-NLS-1$
                     } else {
                         XPCOMInitWasGlued = true;
                     }
                 }
             }
-            C.free (greBuffer);
+            //C.free (greBuffer);
         }
 
         if (IsXULRunner) {
-            if (Device.DEBUG) System.out.println ("XULRunner path: " + mozillaPath); //$NON-NLS-1$
+            if (Device.DEBUG) Stdout ("XULRunner path: ") (mozillaPath).newline; //$NON-NLS-1$
+/+
             try {
                 Library.loadLibrary ("swt-xulrunner"); //$NON-NLS-1$
             } catch (UnsatisfiedLinkError e) {
                 DWT.error (DWT.ERROR_NO_HANDLES, e);
             }
+            
             byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true);
-            int rc = XPCOM.XPCOMGlueStartup (path);
+            int rc = XPCOM.XPCOMGlueStartup (path);  
+
             if (rc !is XPCOM.NS_OK) {
                 browser.dispose ();
                 error (rc);
             }
++/          // No need for double layer initialization in DWT; glue is initialized -JJR
             XPCOMWasGlued = true;
 
             /*
              * Remove the trailing xpcom lib name from mozillaPath because the
              * Mozilla.initialize and NS_InitXPCOM2 invocations require a directory name only.
-             */ 
-            mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
+             */
+            mozillaPath = mozillaPath[0 .. locatePrior( mozillaPath, SEPARATOR_OS )];
+            //mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
         } else {
             if ((style & DWT.MOZILLA) !is 0) {
                 browser.dispose ();
-                String errorString = (mozillaPath !is null && mozillaPath.length () > 0) ?
-                    " [Failed to use detected XULRunner: " + mozillaPath + "]" :
+                String errorString = (mozillaPath !is null && mozillaPath.length > 0) ?
+                    " [Failed to use detected XULRunner: " ~ mozillaPath ~ "]" :
                     " [Could not detect registered XULRunner to use]";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                 DWT.error (DWT.ERROR_NO_HANDLES, null, errorString);
             }
 
             /* attempt to use the GRE pointed at by MOZILLA_FIVE_HOME */
-            int /*long*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true));
-            if (ptr !is 0) {
-                int length = C.strlen (ptr);
-                byte[] buffer = new byte[length];
-                C.memmove (buffer, ptr, length);
-                mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, buffer));
+            auto mozFiveHome = tango.sys.Environment.get(XPCOM.MOZILLA_FIVE_HOME);
+            if (mozFiveHome !is null) {
+                //int length = C.strlen (ptr);
+                //byte[] buffer = new byte[length];
+                //C.memmove (buffer, ptr, length);
+                mozillaPath = mozFiveHome;
             } else {
                 browser.dispose ();
                 DWT.error (DWT.ERROR_NO_HANDLES, null, " [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]"); //$NON-NLS-1$
             }
-            if (Device.DEBUG) System.out.println ("Mozilla path: " + mozillaPath); //$NON-NLS-1$
+            if (Device.DEBUG) Stdout ("Mozilla path: ") (mozillaPath).newline; //$NON-NLS-1$
 
             /*
             * Note.  Embedding a Mozilla GTK1.2 causes a crash.  The workaround
@@ -393,7 +406,7 @@
                 browser.dispose ();
                 DWT.error (DWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$                         
             }
-
+/+
             try {
                 Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$
             } catch (UnsatisfiedLinkError e) {
@@ -412,19 +425,20 @@
                      */
                     DWT.error (DWT.ERROR_NO_HANDLES, e, " [MOZILLA_FIVE_HOME='" + mozillaPath + "']"); //$NON-NLS-1$ //$NON-NLS-2$
                 }
-            }
+            } 
++/
         }
 
         if (!Initialized) {
-            int /*long*/[] retVal = new int /*long*/[1];
-            nsEmbedString pathString = new nsEmbedString (mozillaPath);
-            int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, retVal);
-            pathString.dispose ();
+            nsILocalFile file;
+            scope auto pathString = new nsEmbedString (mozillaPath);
+            nsresult rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile);
+            //pathString.dispose ();
             if (rc !is XPCOM.NS_OK) {
                 browser.dispose ();
                 error (rc);
             }
-            if (retVal[0] is 0) {
+            if (localFile is null) {
                 browser.dispose ();
                 error (XPCOM.NS_ERROR_NULL_POINTER);
             }
@@ -432,19 +446,37 @@
             LocationProvider = new AppFileLocProvider (mozillaPath);
             LocationProvider.AddRef ();
 
-            nsIFile localFile = new nsILocalFile (retVal[0]);
-            rc = XPCOM.NS_InitXPCOM2 (0, localFile.getAddress(), LocationProvider.getAddress ());
+            //nsIFile localFile = new nsILocalFile (retVal[0]);
+            nsIDirectoryServiceProvider directoryServiceProvider;
+            nsIServiceManager serviceManager;
+            rc = LocationProvider.QueryInterface( &nsIDirectoryServiceProvider.IID, cast(void**)&directoryServiceProvider);
+            if (rc !is XPCOM.NS_OK) {
+                browser.dispose();
+                error(rc);
+            }
+            rc = XPCOM.NS_GetServiceManager(&serviceManager);
+            if (rc !is XPCOM.NS_OK) {
+                browser.dispose();
+                error(rc);
+            }
+            if (serviceManager is null || directoryServiceProvider is null) {
+                browser.dispose;
+                error (XPCOM.NS_ERROR_NULL_POINTER);
+            }
+            rc = XPCOM.NS_InitXPCOM2 (&serviceManager, 0, cast(IFile*)&localFile, &directoryServiceProvider);
             localFile.Release ();
+            serviceManager.Release();
+            //LocationProvider.Release();
             if (rc !is XPCOM.NS_OK) {
                 browser.dispose ();
-                DWT.error (DWT.ERROR_NO_HANDLES, null, " [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding " + mozillaPath + " error " + rc + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                DWT.error (DWT.ERROR_NO_HANDLES, null, Format(" [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding {0} error {1} ] ", mozillaPath, rc ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             }
             System.setProperty (GRE_INITIALIZED, "true"); //$NON-NLS-1$
             if (IsXULRunner) {
                 System.setProperty (XULRUNNER_PATH, mozillaPath);
             }
         }
-
+/+
         /* If JavaXPCOM is detected then attempt to initialize it with the XULRunner being used */
         if (IsXULRunner) {
             try {
@@ -472,33 +504,34 @@
             } catch (InstantiationException e) {
             }
         }
-
-        int rc = XPCOM.NS_GetComponentManager (result);
++/
+        nsIComponentManager componentManager;
+        int rc = XPCOM.NS_GetComponentManager (&componentManager);
         if (rc !is XPCOM.NS_OK) {
             browser.dispose ();
             error (rc);
         }
-        if (result[0] is 0) {
+        if (componentManager is null) {
             browser.dispose ();
             error (XPCOM.NS_NOINTERFACE);
         }
         
-        nsIComponentManager componentManager = new nsIComponentManager (result[0]);
-        result[0] = 0;
+        //nsIComponentManager componentManager = new nsIComponentManager (result[0]);
+        //result[0] = 0;
         if (mozDelegate.needsSpinup ()) {
             /* nsIAppShell is discontinued as of xulrunner 1.9, so do not fail if it is not found */
-            rc = componentManager.CreateInstance (XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.NS_IAPPSHELL_IID, result);
+            rc = componentManager.CreateInstance (XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.IID, cast(void**)&AppShell);
             if (rc !is XPCOM.NS_ERROR_NO_INTERFACE) {
                 if (rc !is XPCOM.NS_OK) {
                     browser.dispose ();
                     error (rc);
                 }
-                if (result[0] is 0) {
+                if (AppShell is null) {
                     browser.dispose ();
                     error (XPCOM.NS_NOINTERFACE);
                 }
     
-                AppShell = new nsIAppShell (result[0]);
+                //AppShell = new nsIAppShell (result[0]);
                 rc = AppShell.Create (0, null);
                 if (rc !is XPCOM.NS_OK) {
                     browser.dispose ();
@@ -510,38 +543,40 @@
                     error (rc);
                 }
             }
-            result[0] = 0;
+            //result[0] = 0;
         }
 
-        WindowCreator = new WindowCreator2 ();
+        WindowCreator = new WindowCreator2;
         WindowCreator.AddRef ();
         
-        rc = XPCOM.NS_GetServiceManager (result);
+        nsIServiceManager serviceManager;
+        rc = XPCOM.NS_GetServiceManager (&serviceManager);
         if (rc !is XPCOM.NS_OK) {
             browser.dispose ();
             error (rc);
         }
-        if (result[0] is 0) {
+        if (serviceManager is null) {
             browser.dispose ();
             error (XPCOM.NS_NOINTERFACE);
         }
         
-        nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
-        result[0] = 0;      
-        byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
-        rc = serviceManager.GetServiceByContractID (aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);
+        //nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+        //result[0] = 0;      
+        //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
+        nsIWindowWatcher windowWatcher;
+        rc = serviceManager.GetServiceByContractID (XPCOM.NS_WINDOWWATCHER_CONTRACTID, nsIWindowWatcher.IID, cast(void**)&windowWatcher);
         if (rc !is XPCOM.NS_OK) {
             browser.dispose ();
             error (rc);
         }
-        if (result[0] is 0) {
+        if (windowWatcher is null) {
             browser.dispose ();
             error (XPCOM.NS_NOINTERFACE);       
         }
 
-        nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]);
-        result[0] = 0;
-        rc = windowWatcher.SetWindowCreator (WindowCreator.getAddress());
+        //nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]);
+        //result[0] = 0;
+        rc = windowWatcher.SetWindowCreator (&WindowCreator);
         if (rc !is XPCOM.NS_OK) {
             browser.dispose ();
             error (rc);
--- a/dwt/browser/WindowCreator2.d	Thu Aug 14 20:25:29 2008 -0700
+++ b/dwt/browser/WindowCreator2.d	Sat Aug 16 22:53:35 2008 -0700
@@ -114,7 +114,7 @@
 
         src = Mozilla.findBrowser (aParentNativeWindow);
     }
-    final Browser browser;
+    Browser browser;
     bool doit = true;
     if ((chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) !is 0) {
         /*
@@ -124,26 +124,30 @@
         */
         int style = DWT.DIALOG_TRIM;
         if ((chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) !is 0) style |= DWT.APPLICATION_MODAL; 
-        final Shell shell = src is null ?
+        Shell shell = src is null ?
             new Shell (style) :
             new Shell (src.getShell(), style);
         shell.setLayout (new FillLayout ());
         browser = new Browser (shell, src is null ? DWT.MOZILLA : src.getStyle () & DWT.MOZILLA);
-        browser.addVisibilityWindowListener (new VisibilityWindowListener () {
+        browser.addVisibilityWindowListener (new class(shell) VisibilityWindowListener {
+            Shell sh;
+            this (Shell shell) { this.sh = shell; }
             public void hide (WindowEvent event) {
             }
             public void show (WindowEvent event) {
-                if (event.location !is null) shell.setLocation (event.location);
+                if (event.location !is null) sh.setLocation (event.location);
                 if (event.size !is null) {
                     Point size = event.size;
-                    shell.setSize (shell.computeSize (size.x, size.y));
+                    sh.setSize (sh.computeSize (size.x, size.y));
                 }
                 shell.open ();
             }
         });
-        browser.addCloseWindowListener (new CloseWindowListener () {
+        browser.addCloseWindowListener (new class(shell) CloseWindowListener {
+            Shell sh;
+            this (Shell shell) { this.shell = shell; }
             public void close (WindowEvent event) {
-                shell.close ();
+                sh.close ();
             }
         });
         if (uri !is null) {
--- a/dwt/dwthelper/System.d	Thu Aug 14 20:25:29 2008 -0700
+++ b/dwt/dwthelper/System.d	Sat Aug 16 22:53:35 2008 -0700
@@ -5,7 +5,9 @@
 
 import dwt.dwthelper.utils;
 
+import tango.sys.Environment;
 import tango.core.Exception;
+import tango.io.model.IFile;
 import tango.time.Clock;
 import tango.stdc.stdlib : exit;
 
@@ -145,11 +147,36 @@
     }
 
     public static String getProperty( String key ){
-        switch( key ){
-        case "os.name": return "linux";
-        case "file.separator" : return ".";
-        default: return null;
+        /* Get values for local dwt specific keys */
+        String* p;
+        if (key[0..3] == "dwt") {
+            return ((p = key in localProperties) != null) ? *p : null;
+        }
+        /* else get values for global system keys (environment) */
+        } else {
+            switch( key ){
+                case "os.name": return "linux";
+                case "user.name" return "";
+                case "user.home" return "";
+                case "user.dir" : return "";
+                case "file.separator" : return FileConst.PathSeparatorString ;
+                default: return null;
+            }
         }
     }
+
+    public static void setProperty ( String key, String value ) {
+        /* set property for local dwt keys */
+        if (key[0..3] == "dwt") {
+            if (key !is null && value !is null) 
+                localProperties[ key ] = value;
+        /* else set properties for global system keys (environment) */
+        } else {
+        
+        }
+
+    }
+
+    private static String[String] localProperties;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/mozilla/XPCOMInit.d	Sat Aug 16 22:53:35 2008 -0700
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation.  All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * -  Binding to permit interfacing between Mozilla and DWT
+ * -  Copyright (C) 2003, 2006 IBM Corp.  All Rights Reserved.
+ *
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
+ *******************************************************************************/
+module dwt.internal.mozilla.XPCOMInit;
+
+import dwt.internal.Platform;
+
+extern(System) {
+
+    align(4):
+
+    struct GREVersionRange {
+        char    *lower;
+        int     lowerInclusive;
+        char    *upper;
+        int     upperInclusive;
+    }
+
+    struct GREProperty {
+        char *property;
+        char *value;
+    } 
+}
+  
+public class XPCOMInit : Platform {
+    public static final int PATH_MAX = 4096;
+
+extern(System):
+
+    public static uint GRE_GetGREPathWithProperties(GREVersionRange *versions, int versionsLength, GREProperty *properties, uint propertiesLength, char *buffer, uint  buflen);
+    public static uint XPCOMGlueStartup(char* xpcomFile);
+    public static int XPCOMGlueShutdown ();
+}
--- a/dwt/internal/mozilla/nsEmbedString2.d	Thu Aug 14 20:25:29 2008 -0700
+++ b/dwt/internal/mozilla/nsEmbedString2.d	Sat Aug 16 22:53:35 2008 -0700
@@ -5,7 +5,7 @@
 import dwt.internal.mozilla.Common;
 import dwt.internal.mozilla.nsStringAPI;
 
-class nsEmbedString
+scope class nsEmbedString
 {    
 	this(wchar[] s)
 	{
@@ -49,7 +49,7 @@
 }
 
 
-class nsEmbedCString
+scope class nsEmbedCString
 {
 	this(char[] s)
 	{
--- a/dwt/internal/mozilla/nsXPCOM.d	Thu Aug 14 20:25:29 2008 -0700
+++ b/dwt/internal/mozilla/nsXPCOM.d	Sat Aug 16 22:53:35 2008 -0700
@@ -44,8 +44,8 @@
 nsresult  NS_GetComponentManager(nsIComponentManager *result);
 nsresult  NS_GetComponentRegistrar(nsIComponentRegistrar *result);
 nsresult  NS_GetMemoryManager(nsIMemory *result);
-nsresult  NS_NewLocalFile(inout nsAString path, PRBool followLinks, nsILocalFile* result);
-nsresult  NS_NewNativeLocalFile(inout nsACString path, PRBool followLinks, nsILocalFile* result);
+nsresult  NS_NewLocalFile(nsAString* path, PRBool followLinks, nsILocalFile* result);
+nsresult  NS_NewNativeLocalFile(nsACString* path, PRBool followLinks, nsILocalFile* result);
 void *    NS_Alloc(PRSize size);
 void *    NS_Realloc(void *ptr, PRSize size);
 void      NS_Free(void *ptr);
--- a/dwt/internal/mozilla/nsXPCOMGlue.d	Thu Aug 14 20:25:29 2008 -0700
+++ b/dwt/internal/mozilla/nsXPCOMGlue.d	Sat Aug 16 22:53:35 2008 -0700
@@ -1,6 +1,6 @@
 module dwt.internal.mozilla.nsXPCOMGlue;
 
-extern(C):
+extern(System):
 
 align(4):