changeset 298:eec6ddb07873

More xpcom/mozilla port
author John Reimer<terminal.node@gmail.com>
date Sun, 10 Aug 2008 22:25:43 -0700
parents 2f204a4aebc6
children 2c50647275de
files dwt/browser/AppFileLocProvider.d dwt/browser/Browser.d dwt/browser/CloseWindowListener.d dwt/browser/Download.d dwt/browser/DownloadFactory.d dwt/browser/DownloadFactory_1_8.d dwt/browser/Download_1_8.d dwt/browser/FilePicker.d dwt/browser/FilePickerFactory.d dwt/browser/FilePickerFactory_1_8.d dwt/browser/FilePicker_1_8.d dwt/browser/HelperAppLauncherDialog.d dwt/browser/HelperAppLauncherDialogFactory.d dwt/browser/InputStream.d dwt/browser/LocationAdapter.d dwt/browser/LocationEvent.d dwt/browser/LocationListener.d dwt/browser/Mozilla.d dwt/browser/MozillaDelegate.d dwt/browser/OpenWindowListener.d dwt/browser/ProgressAdapter.d dwt/browser/ProgressEvent.d dwt/browser/ProgressListener.d dwt/browser/PromptDialog.d dwt/browser/PromptService2.d dwt/browser/PromptService2Factory.d dwt/browser/SimpleEnumerator.d dwt/browser/StatusTextEvent.d dwt/browser/StatusTextListener.d dwt/browser/TitleEvent.d dwt/browser/TitleListener.d dwt/browser/VisibilityWindowAdapter.d dwt/browser/VisibilityWindowListener.d dwt/browser/WebBrowser.d dwt/browser/WindowCreator2.d dwt/browser/WindowEvent.d dwt/internal/mozilla/Common.d dwt/internal/mozilla/XPCOM.d dwt/internal/mozilla/gfxIImageFrame.d dwt/internal/mozilla/imgIContainer.d dwt/internal/mozilla/imgIContainerObserver.d dwt/internal/mozilla/nsEmbedString.d dwt/internal/mozilla/nsEmbedString2.d dwt/internal/mozilla/nsError.d dwt/internal/mozilla/nsIAppShell.d dwt/internal/mozilla/nsIAtom.d dwt/internal/mozilla/nsIAuthInformation.d dwt/internal/mozilla/nsIAuthPrompt.d dwt/internal/mozilla/nsIAuthPromptCallback.d dwt/internal/mozilla/nsIBaseWindow.d dwt/internal/mozilla/nsIBinaryInputStream.d dwt/internal/mozilla/nsIBinaryOutputStream.d dwt/internal/mozilla/nsICancelable.d dwt/internal/mozilla/nsICategoryManager.d dwt/internal/mozilla/nsIChannel.d dwt/internal/mozilla/nsIChromeEventHandler.d dwt/internal/mozilla/nsICollection.d dwt/internal/mozilla/nsIComponentManager.d dwt/internal/mozilla/nsIComponentRegistrar.d dwt/internal/mozilla/nsIContentViewer.d dwt/internal/mozilla/nsIContextMenuListener.d dwt/internal/mozilla/nsIContextMenuListener2.d dwt/internal/mozilla/nsICookie.d dwt/internal/mozilla/nsICookie2.d dwt/internal/mozilla/nsICookieManager.d dwt/internal/mozilla/nsICookieManager2.d dwt/internal/mozilla/nsID.d dwt/internal/mozilla/nsIDOMAbstractView.d dwt/internal/mozilla/nsIDOMAttr.d dwt/internal/mozilla/nsIDOMBarProp.d dwt/internal/mozilla/nsIDOMCDATASection.d dwt/internal/mozilla/nsIDOMCharacterData.d dwt/internal/mozilla/nsIDOMComment.d dwt/internal/mozilla/nsIDOMDOMImplementation.d dwt/internal/mozilla/nsIDOMDocument.d dwt/internal/mozilla/nsIDOMDocumentFragment.d dwt/internal/mozilla/nsIDOMDocumentType.d dwt/internal/mozilla/nsIDOMDocumentView.d dwt/internal/mozilla/nsIDOMElement.d dwt/internal/mozilla/nsIDOMEntityReference.d dwt/internal/mozilla/nsIDOMEvent.d dwt/internal/mozilla/nsIDOMEventGroup.d dwt/internal/mozilla/nsIDOMEventListener.d dwt/internal/mozilla/nsIDOMEventTarget.d dwt/internal/mozilla/nsIDOMKeyEvent.d dwt/internal/mozilla/nsIDOMMouseEvent.d dwt/internal/mozilla/nsIDOMNamedNodeMap.d dwt/internal/mozilla/nsIDOMNode.d dwt/internal/mozilla/nsIDOMNodeList.d dwt/internal/mozilla/nsIDOMProcessingInstruction.d dwt/internal/mozilla/nsIDOMRange.d dwt/internal/mozilla/nsIDOMSerializer.d dwt/internal/mozilla/nsIDOMStorage.d dwt/internal/mozilla/nsIDOMStorageItem.d dwt/internal/mozilla/nsIDOMText.d dwt/internal/mozilla/nsIDOMUIEvent.d dwt/internal/mozilla/nsIDOMWindow.d dwt/internal/mozilla/nsIDOMWindow2.d dwt/internal/mozilla/nsIDOMWindowCollection.d dwt/internal/mozilla/nsIDebug.d dwt/internal/mozilla/nsIDirectoryService.d dwt/internal/mozilla/nsIDocShell.d dwt/internal/mozilla/nsIDocShellLoadInfo.d dwt/internal/mozilla/nsIDocShellTreeItem.d dwt/internal/mozilla/nsIDocShellTreeOwner.d dwt/internal/mozilla/nsIDocumentCharsetInfo.d dwt/internal/mozilla/nsIDownload.d dwt/internal/mozilla/nsIDownload_1_8.d dwt/internal/mozilla/nsIEmbeddingSiteWindow.d dwt/internal/mozilla/nsIEmbeddingSiteWindow2.d dwt/internal/mozilla/nsIEnumerator.d dwt/internal/mozilla/nsIEventQueue.d dwt/internal/mozilla/nsIEventTarget.d dwt/internal/mozilla/nsIExternalHelperAppService.d dwt/internal/mozilla/nsIFactory.d dwt/internal/mozilla/nsIFile.d dwt/internal/mozilla/nsIFilePicker.d dwt/internal/mozilla/nsIFileURL.d dwt/internal/mozilla/nsIHelperAppLauncher.d dwt/internal/mozilla/nsIHelperAppLauncherDialog.d dwt/internal/mozilla/nsIHelperAppLauncher_1_8.d dwt/internal/mozilla/nsIHelperAppLauncher_1_9.d dwt/internal/mozilla/nsIHistoryEntry.d dwt/internal/mozilla/nsIIOService.d dwt/internal/mozilla/nsIIOService2.d dwt/internal/mozilla/nsIInputStream.d dwt/internal/mozilla/nsIInterfaceRequestor.d dwt/internal/mozilla/nsIJSContextStack.d dwt/internal/mozilla/nsILoadGroup.d dwt/internal/mozilla/nsILocalFile.d dwt/internal/mozilla/nsIMIMEInfo.d dwt/internal/mozilla/nsIMemory.d dwt/internal/mozilla/nsIModule.d dwt/internal/mozilla/nsIObjectInputStream.d dwt/internal/mozilla/nsIObjectOutputStream.d dwt/internal/mozilla/nsIObserver.d dwt/internal/mozilla/nsIObserverService.d dwt/internal/mozilla/nsIOutputStream.d dwt/internal/mozilla/nsIPrefBranch.d dwt/internal/mozilla/nsIPrefBranch2.d dwt/internal/mozilla/nsIPrefLocalizedString.d dwt/internal/mozilla/nsIPrefService.d dwt/internal/mozilla/nsIProgressDialog.d dwt/internal/mozilla/nsIProgressDialog_1_8.d dwt/internal/mozilla/nsIPrompt.d dwt/internal/mozilla/nsIPromptService.d dwt/internal/mozilla/nsIPromptService2.d dwt/internal/mozilla/nsIProperties.d dwt/internal/mozilla/nsIProtocolHandler.d dwt/internal/mozilla/nsIRequest.d dwt/internal/mozilla/nsIRequestObserver.d dwt/internal/mozilla/nsISHEntry.d dwt/internal/mozilla/nsISHistory.d dwt/internal/mozilla/nsISHistoryListener.d dwt/internal/mozilla/nsISecureBrowserUI.d dwt/internal/mozilla/nsISelection.d dwt/internal/mozilla/nsISerializable.d dwt/internal/mozilla/nsIServiceManager.d dwt/internal/mozilla/nsISimpleEnumerator.d dwt/internal/mozilla/nsIStreamListener.d dwt/internal/mozilla/nsIStringEnumerator.d dwt/internal/mozilla/nsISupports.d dwt/internal/mozilla/nsISupportsArray.d dwt/internal/mozilla/nsITooltipListener.d dwt/internal/mozilla/nsITraceRefcnt.d dwt/internal/mozilla/nsITransfer.d dwt/internal/mozilla/nsIURI.d dwt/internal/mozilla/nsIURIContentListener.d dwt/internal/mozilla/nsIURL.d dwt/internal/mozilla/nsIWeakReference.d dwt/internal/mozilla/nsIWebBrowser.d dwt/internal/mozilla/nsIWebBrowserChrome.d dwt/internal/mozilla/nsIWebBrowserChromeFocus.d dwt/internal/mozilla/nsIWebBrowserFocus.d dwt/internal/mozilla/nsIWebNavigation.d dwt/internal/mozilla/nsIWebNavigationInfo.d dwt/internal/mozilla/nsIWebProgress.d dwt/internal/mozilla/nsIWebProgressListener.d dwt/internal/mozilla/nsIWebProgressListener2.d dwt/internal/mozilla/nsIWindowCreator.d dwt/internal/mozilla/nsIWindowCreator2.d dwt/internal/mozilla/nsIWindowWatcher.d dwt/internal/mozilla/nsStringAPI.d dwt/internal/mozilla/nsXPCOM.d dwt/internal/mozilla/nsXPCOMGlue.d dwt/internal/mozilla/prinrval.d dwt/internal/mozilla/prio.d dwt/internal/mozilla/prlink.d dwt/internal/mozilla/prtime.d
diffstat 29 files changed, 981 insertions(+), 561 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/browser/AppFileLocProvider.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/AppFileLocProvider.d	Sun Aug 10 22:25:43 2008 -0700
@@ -108,7 +108,7 @@
             int index = 0;
             /* set the first value(s) to the MOZ_PLUGIN_PATH environment variable value if it's defined */
             String value = Environment.get (XPCOM.MOZILLA_PLUGIN_PATH);
-            if (ptr !is null) {
+            if (value !is null) {
                 if (value.length > 0) {
                     String separator = System.getProperty ("path.separator"); // $NON-NLS-1$
                     foreach (segment; delimiter(value, separator))
--- a/dwt/browser/Download.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/Download.d	Sun Aug 10 22:25:43 2008 -0700
@@ -12,11 +12,13 @@
  *******************************************************************************/
 module dwt.browser.Download;
 
+import Util = tango.text.Util;
+import tango.text.convert.Format;
 import dwt.dwthelper.utils;
 
 import dwt.DWT;
 
-import dwt.internal.Compatibility;
+//import dwt.internal.Compatibility;
 import dwt.internal.mozilla.XPCOM;
 import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsID;
@@ -46,12 +48,12 @@
 this () {
 }
 
-int AddRef () {
+nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
 
-int QueryInterface (nsID* riid, void** ppvObject) {
+nsresult QueryInterface (nsID* riid, void** ppvObject) {
     if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
  
     if (*riid == nsISupports.IID)) {
@@ -78,9 +80,9 @@
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
             
-int Release () {
+nsrefcnt Release () {
     refCount--;
-    if (refCount is 0) return 0;
+    if (refCount is 0) return 0; // nonsensical condition: will fix later -JJR
     return refCount;
 }
 
@@ -88,16 +90,16 @@
 
 /* Note. The argument startTime is defined as a PRInt64. This translates into two java ints. */
 int Init (nsIURI aSource, nsIURI aTarget, nsAString* aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, PRBool aPersist) {
-    nsIURI source = new nsIURI (aSource);
+    //nsIURI source = new nsIURI (aSource);
     scope auto aSpec = new nsEmbedString;
-    int rc = source.GetHost (cast(nsAString*)aSpec);
+    int rc = aSource.GetHost (cast(nsAString*)aSpec);
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    int length = XPCOM.nsEmbedCString_Length (aSpec);
-    int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
-    byte[] dest = new byte[length];
-    XPCOM.memmove (dest, buffer, length);
-    XPCOM.nsEmbedCString_delete (aSpec);
-    String url = new String (dest);
+    //int length = XPCOM.nsEmbedCString_Length (aSpec);
+    //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
+    //byte[] dest = new byte[length];
+    //XPCOM.memmove (dest, buffer, length);
+    //XPCOM.nsEmbedCString_delete (aSpec);
+    String url = aSpec.toString;
 
     /*
     * As of mozilla 1.7 the second argument of the nsIDownload interface's 
@@ -105,35 +107,35 @@
     * these interfaces the second argument implements and act accordingly.  
     */
     String filename = null;
-    nsISupports supports = new nsISupports (aTarget);
-    int /*long*/[] result = new int /*long*/[1];
-    rc = supports.QueryInterface (nsIURI.NS_IURI_IID, result);
+    //nsISupports supports = new nsISupports (aTarget);
+    nsIURI target = null;
+    rc = aTarget.QueryInterface (nsIURI.IID, cast(void**)&target);
     if (rc is 0) {  /* >= 1.7 */
-        nsIURI target = new nsIURI (result[0]);
-        result[0] = 0;
-        int /*long*/ aPath = XPCOM.nsEmbedCString_new ();
-        rc = target.GetPath (aPath);
+        //result[0] = 0;
+        //int /*long*/ aPath = XPCOM.nsEmbedCString_new ();
+        scope auto aPath = new nsEmbedCString;
+        rc = target.GetPath (cast(nsACString*)aPath);
         if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-        length = XPCOM.nsEmbedCString_Length (aPath);
-        buffer = XPCOM.nsEmbedCString_get (aPath);
-        dest = new byte[length];
-        XPCOM.memmove (dest, buffer, length);
-        XPCOM.nsEmbedCString_delete (aPath);
-        filename = new String (dest);
-        int separator = filename.lastIndexOf (System.getProperty ("file.separator"));   //$NON-NLS-1$
-        filename = filename.substring (separator + 1);
+        //length = XPCOM.nsEmbedCString_Length (aPath);
+        //buffer = XPCOM.nsEmbedCString_get (aPath);
+        //dest = new byte[length];
+        //XPCOM.memmove (dest, buffer, length);
+        //XPCOM.nsEmbedCString_delete (aPath);
+        filename = aPath.toString;
+        int separator = Util.locatePrior(filename, System.getProperty ("file.separator"));   //$NON-NLS-1$
+        filename = filename[separator + 1 .. $];
         target.Release ();
     } else {    /* < 1.7 */
-        nsILocalFile target = new nsILocalFile (aTarget);
-        int /*long*/ aNativeTarget = XPCOM.nsEmbedCString_new ();
-        rc = target.GetNativeLeafName (aNativeTarget);
+        //nsILocalFile target = new nsILocalFile (aTarget);
+        scope auto aNativeTarget = new nsEmbedCString;
+        rc = aTarget.GetNativeLeafName (cast(nsACString*)aNativeTarget);
         if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-        length = XPCOM.nsEmbedCString_Length (aNativeTarget);
-        buffer = XPCOM.nsEmbedCString_get (aNativeTarget);
-        dest = new byte[length];
-        XPCOM.memmove (dest, buffer, length);
-        XPCOM.nsEmbedCString_delete (aNativeTarget);
-        filename = new String (dest);
+        //length = XPCOM.nsEmbedCString_Length (aNativeTarget);
+        //buffer = XPCOM.nsEmbedCString_get (aNativeTarget);
+        //dest = new byte[length];
+        //XPCOM.memmove (dest, buffer, length);
+        //XPCOM.nsEmbedCString_delete (aNativeTarget);
+        filename = aNativeTarget.toString;
     }
 
     Listener listener = new Listener () {
@@ -150,25 +152,25 @@
         }
     };
     shell = new Shell (DWT.DIALOG_TRIM);
-    String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
-    shell.setText (msg);
+    //String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
+    shell.setText ("Download: " ~ filename);
     GridLayout gridLayout = new GridLayout ();
     gridLayout.marginHeight = 15;
     gridLayout.marginWidth = 15;
     gridLayout.verticalSpacing = 20;
     shell.setLayout(gridLayout);
-    msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
-    new Label (shell, DWT.SIMPLE).setText (msg);
+    //msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
+    new Label (shell, DWT.SIMPLE).setText ("Saving " ~ filename ~ " from " ~ url);
     status = new Label (shell, DWT.SIMPLE);
-    msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$
-    status.setText (msg);
+    //msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$
+    status.setText ("Downloading...");
     GridData data = new GridData ();
     data.grabExcessHorizontalSpace = true;
     data.grabExcessVerticalSpace = true;
     status.setLayoutData (data);
 
     cancel = new Button (shell, DWT.PUSH);
-    cancel.setText (DWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$
+    cancel.setText ("Cancel"); //$NON-NLS-1$
     data = new GridData ();
     data.horizontalAlignment = GridData.CENTER;
     cancel.setLayoutData (data);
@@ -179,43 +181,43 @@
     return XPCOM.NS_OK;
 }
 
-int GetSource (int /*long*/ aSource) {
+nsresult GetSource (nsIURI* aSource) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetTarget (int /*long*/ aTarget) {
+nsresult GetTarget (nsIURI* aTarget) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetPersist (PRBool* aPersist) {
+nsresult GetPersist (PRBool* aPersist) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetPercentComplete (int /*long*/ aPercentComplete) {
+nsresult GetPercentComplete (PRInt32* aPercentComplete) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetDisplayName (int /*long*/ aDisplayName) {
+nsresult GetDisplayName (PRUnichar** aDisplayName) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int SetDisplayName (int /*long*/ aDisplayName) {
+nsresult SetDisplayName (PRUNichar* aDisplayName) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetStartTime (int /*long*/ aStartTime) {
+nsresult GetStartTime (PRInt64 aStartTime) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetMIMEInfo (int /*long*/ aMIMEInfo) {
+nsresult GetMIMEInfo (nsIMIMEInfo* aMIMEInfo) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetListener (int /*long*/ aListener) {
+nsresult GetListener (nsIWebProgressListener* aListener) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int SetListener (int /*long*/ aListener) {
+nsresult SetListener (nsIWebProgressListener aListener) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -224,41 +226,41 @@
 }
 
 nsresult SetObserver (nsIOBserver aObserver) {
-    if (aObserver !is 0) {
-        nsISupports supports = new nsISupports (aObserver);
-        int /*long*/[] result = new int /*long*/[1];
-        int rc = supports.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
+    if (aObserver !is null) {
+        // nsISupports supports = new nsISupports (aObserver);
+        nsIHelperAppLauncher result;
+        int rc = aObserver.QueryInterface (nsIHelperAppLauncher.IID, cast(void**)&result);
         if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-        if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
-        helperAppLauncher = new nsIHelperAppLauncher (result[0]);
+        if (result is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
+        helperAppLauncher = result;
     }
     return XPCOM.NS_OK;
 }
 
 /* nsIProgressDialog */
-nsresult Open (int /*long*/ aParent) {
+nsresult Open (nsIDOMWindow aParent) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) {
+nsresult GetCancelDownloadOnClose (PRBool* aCancelDownloadOnClose) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int SetCancelDownloadOnClose (int aCancelDownloadOnClose) {
+nsresult SetCancelDownloadOnClose (PRBool aCancelDownloadOnClose) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetDialog (int /*long*/ aDialog) {
+nsresult GetDialog (nsIDOMWindow* aDialog) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int SetDialog (int /*long*/ aDialog) {
+nsresult SetDialog (nsIDOMWindow aDialog) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* nsIWebProgressListener */
 
-int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateFlags, int aStatus) {
+nsresult OnStateChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 aStateFlags, nsresult aStatus) {
     if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) {
         if (helperAppLauncher !is null) helperAppLauncher.Release ();
         helperAppLauncher = null;
@@ -268,28 +270,28 @@
     return XPCOM.NS_OK;
 }
 
-int OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) {
+nsresult OnProgressChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) {
     int currentKBytes = aCurTotalProgress / 1024;
     int totalKBytes = aMaxTotalProgress / 1024;
     if (shell !is null && !shell.isDisposed ()) {
-        Object[] arguments = {new Integer (currentKBytes), new Integer (totalKBytes)};
-        String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$
-        status.setText (statusMsg);
+        //Object[] arguments = {new Integer (currentKBytes), new Integer (totalKBytes)};
+        //String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$
+        status.setText (Format("Download: {0} KB of {1} KB", currentKBytes, totalKBytes));
         shell.layout (true);
         shell.getDisplay ().update ();
     }
     return XPCOM.NS_OK;
 }
 
-int OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
+nsresult OnLocationChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation) {
     return XPCOM.NS_OK;
 }
 
-int OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStatus, int /*long*/ aMessage) {
+nsresult OnStatusChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar* aMessage) {
     return XPCOM.NS_OK;
 }
 
-int OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int state) {
+nsresult OnSecurityChange (nsIWebProgresss aWebProgress, nsIRequest aRequest, PRUint32 state) {
     return XPCOM.NS_OK;
 }
 }
--- a/dwt/browser/DownloadFactory_1_8.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/DownloadFactory_1_8.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,32 +7,34 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.DownloadFactory_1_8;
 
 import dwt.dwthelper.utils;
 
-import dwt.internal.C;
+//import dwt.internal.C;
 import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+//import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsID;
 import dwt.internal.mozilla.nsIFactory;
 import dwt.internal.mozilla.nsISupports;
 
-class DownloadFactory_1_8 {
-    XPCOMObject supports;
-    XPCOMObject factory;
+class DownloadFactory_1_8 : nsIFactory {
+    //XPCOMObject supports;
+    //XPCOMObject factory;
     int refCount = 0;
 
-DownloadFactory_1_8 () {
-    createCOMInterfaces ();
+this () {
+    //createCOMInterfaces ();
 }
 
-int AddRef () {
+nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
-
+/+
 void createCOMInterfaces () {
     /* Create each of the interfaces that this object implements */
     supports = new XPCOMObject (new int[] {2, 0, 0}) {
@@ -64,43 +66,48 @@
 int /*long*/ getAddress () {
     return factory.getAddress ();
 }
-
-int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
-    if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE;
-    nsID guid = new nsID ();
-    XPCOM.memmove (guid, riid, nsID.sizeof);
++/
+nsresult QueryInterface (nsIID* riid, void** ppvObject) {
+    if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
+    //nsID guid = new nsID ();
+    //XPCOM.memmove (guid, riid, nsID.sizeof);
     
-    if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsISupports.IID) {
+        *ppvObject = cast(void*)cast(nsISupports)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsIFactory.IID) {
+        *ppvObject = cast(void*)cast(nsIFactory)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
     
-    XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+    *ppvObject = null;
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
             
 int Release () {
     refCount--;
-    if (refCount is 0) disposeCOMInterfaces ();
+    //if (refCount is 0) disposeCOMInterfaces ();
     return refCount;
 }
 
 /* nsIFactory */
 
-int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
-    Download_1_8 download = new Download_1_8 ();
-    download.AddRef ();
-    XPCOM.memmove (result, new int /*long*/[] {download.getAddress ()}, C.PTR_SIZEOF);
-    return XPCOM.NS_OK;
+nsresult CreateInstance (nsISupports aOuter, nsIID* iid, void** result) {
+    if (result is null) 
+        return XPCOM.NS_ERROR_INVALID_ARG;
+    auto download = new Download_1_8;
+    nsresult rv = download.QueryInterface( iid, result );
+    if (XPCOM.NS_FAILED(rv)) {
+        *result = null;
+        delete download;
+    }
+    return rv;
 }
 
-int LockFactory (int lock) {
+nsresult LockFactory (PRBool lock) {
     return XPCOM.NS_OK;
 }
 }
--- a/dwt/browser/Download_1_8.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/Download_1_8.d	Sun Aug 10 22:25:43 2008 -0700
@@ -16,7 +16,7 @@
 
 import dwt.DWT;
 
-import dwt.internal.Compatibility;
+// import dwt.internal.Compatibility;
 import dwt.internal.mozilla.XPCOM;
 import dwt.internal.mozilla.nsICancelable;
 import dwt.internal.mozilla.nsID;
@@ -92,31 +92,36 @@
     return Init (aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aTempFile, aCancelable);
 }
 
+// FIXME: I've hardcoded the string values in place of Compatibility.getMessage calls in 
+// the Init method; this will need fixing in future releases. -JJR
+
 int Init (nsIURI aSource, nsIURI aTarget, nsAstring* aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, nsILocalFile aTempFile, nsICancelable aCancelable) {
-    // cancelable = new nsICancelable (aCancelable);
+    cancelable = aCancelable;
     // nsIURI source = new nsIURI (aSource);
     scope auto aSpec = new nsEmbedCString;
-    int rc = source.GetHost (cast(nsaSpec);
+    int rc = aSource.GetHost (cast(nsACString*)aSpec);
     if (rc !is XPCOM.NS_OK) Mozilla.error(rc);
-    int length = XPCOM.nsEmbedCString_Length (aSpec);
-    int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
-    byte[] dest = new byte[length];
-    XPCOM.memmove (dest, buffer, length);
-    XPCOM.nsEmbedCString_delete (aSpec);
-    String url = new String (dest);
+    //int length = XPCOM.nsEmbedCString_Length (aSpec);
+    //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
+    //byte[] dest = new byte[length];
+    //XPCOM.memmove (dest, buffer, length);
+    //XPCOM.nsEmbedCString_delete (aSpec);
+    String url = aSpec.toString;
 
-    nsIURI target = new nsIURI (aTarget);
-    int /*long*/ aPath = XPCOM.nsEmbedCString_new ();
-    rc = target.GetPath (aPath);
+    //nsIURI target = new nsIURI (aTarget);
+    scope auto aPath = new nsEmbedCString;
+    rc = aTarget.GetPath (aPath);
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    length = XPCOM.nsEmbedCString_Length (aPath);
-    buffer = XPCOM.nsEmbedCString_get (aPath);
-    dest = new byte[length];
-    XPCOM.memmove (dest, buffer, length);
-    XPCOM.nsEmbedCString_delete (aPath);
-    String filename = new String (dest);
-    int separator = filename.lastIndexOf (System.getProperty ("file.separator"));   //$NON-NLS-1$
-    filename = filename.substring (separator + 1);
+    //length = XPCOM.nsEmbedCString_Length (aPath);
+    //buffer = XPCOM.nsEmbedCString_get (aPath);
+    //dest = new byte[length];
+    //XPCOM.memmove (dest, buffer, length);
+    //XPCOM.nsEmbedCString_delete (aPath);
+    String filename = aPath.toString;
+    int separator = locatePrior(filename, System.getProperty ("file.separator"));
+    //int separator = filename.lastIndexOf (System.getProperty ("file.separator"));   //$NON-NLS-1$
+    // NOTE: Not sure if this is correct; watch out for bugs here. -JJR
+    filename = filename[separator + 1 .. $];
 
     Listener listener = new Listener() {
         public void handleEvent (Event event) {
@@ -132,25 +137,28 @@
         }
     };
     shell = new Shell (DWT.DIALOG_TRIM);
-    String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
-    shell.setText (msg);
+// FIXME: A working Compatibility.getMessage has not been ported yet
+// Strings hardcoded for now.
+    //String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
+    shell.setText ("Download: " ~ filename);
     GridLayout gridLayout = new GridLayout ();
     gridLayout.marginHeight = 15;
     gridLayout.marginWidth = 15;
     gridLayout.verticalSpacing = 20;
     shell.setLayout (gridLayout);
-    msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
-    new Label (shell, DWT.SIMPLE).setText (msg);
+    //msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
+    new Label (shell, DWT.SIMPLE).setText ("Saving " ~ filename ~ " from " ~ url );
     status = new Label (shell, DWT.SIMPLE);
-    msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$
-    status.setText (msg);
+    //msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$
+    status.setText ("Downloading...");
     GridData data = new GridData ();
     data.grabExcessHorizontalSpace = true;
     data.grabExcessVerticalSpace = true;
     status.setLayoutData (data);
     
     cancel = new Button (shell, DWT.PUSH);
-    cancel.setText (DWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$
+    cancel.setText( "Cancel" ); 
+    //cancel.setText (DWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$
     data = new GridData ();
     data.horizontalAlignment = GridData.CENTER;
     cancel.setLayoutData (data);
@@ -161,100 +169,101 @@
     return XPCOM.NS_OK;
 }
 
-int GetAmountTransferred (int /*long*/ arg0) {
+nsresult GetAmountTransferred (PRUInt64* arg0) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetCancelable (int /*long*/ arg0) {
+nsresult GetCancelable (nsICancelable* arg0) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetDisplayName (int /*long*/ aDisplayName) {
+nsresult GetDisplayName (PRUnichar** aDisplayName) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetMIMEInfo (int /*long*/ aMIMEInfo) {
+nsresult GetMIMEInfo (nsIMIMEInfo* aMIMEInfo) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetPercentComplete (int /*long*/ aPercentComplete) {
+nsresult GetPercentComplete (PRInt32* aPercentComplete) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetSize (int /*long*/ arg0) {
+nsresult GetSize (PRUInt64* arg0) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetSource (int /*long*/ aSource) {
+nsresult GetSource (nsIURI* aSource) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetStartTime (int /*long*/ aStartTime) {
+nsresult GetStartTime (PRInt64* aStartTime) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetTarget (int /*long*/ aTarget) {
+nsresult GetTarget (nsIURI* aTarget) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetTargetFile (int /*long*/ arg0) {
+nsresult GetTargetFile (nsILocalFile* arg0) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* nsIProgressDialog */
-int GetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) {
+nsresult GetCancelDownloadOnClose (PRBool* aCancelDownloadOnClose) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetDialog (int /*long*/ aDialog) {
+nsresult GetDialog (nsIDOMWindow* aDialog) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int GetObserver (int /*long*/ aObserver) {
+nsresult GetObserver (nsIOBserver* aObserver) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int Open (int /*long*/ aParent) {
+nsresult Open (nsIDOMWindow aParent) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int SetCancelDownloadOnClose (int aCancelDownloadOnClose) {
+nsresult SetCancelDownloadOnClose (PRBool aCancelDownloadOnClose) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int SetDialog (int /*long*/ aDialog) {
+nsresult SetDialog (nsIDOMWindow aDialog) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int SetObserver (int /*long*/ aObserver) {
+nsresult SetObserver (nsIOBserver aObserver) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* nsIWebProgressListener */
 
-int OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
+nsresult OnLocationChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation) {
     return XPCOM.NS_OK;
 }
 
-int OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) {
+nsresult OnProgressChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) {
     return OnProgressChange64 (aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
 }
-
+/++
 /* Note. The last 4 args in the original interface are defined as PRInt64. These each translate into two java ints. */
-int OnProgressChange64_32 (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress1, int /*long*/ aCurSelfProgress2, int /*long*/ aMaxSelfProgress1, int /*long*/ aMaxSelfProgress2, int /*long*/ aCurTotalProgress1, int /*long*/ aCurTotalProgress2, int /*long*/ aMaxTotalProgress1, int /*long*/ aMaxTotalProgress2) {
+nsresult OnProgressChange64_32 (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress1, int /*long*/ aCurSelfProgress2, int /*long*/ aMaxSelfProgress1, int /*long*/ aMaxSelfProgress2, int /*long*/ aCurTotalProgress1, int /*long*/ aCurTotalProgress2, int /*long*/ aMaxTotalProgress1, int /*long*/ aMaxTotalProgress2) {
     long aCurSelfProgress = (aCurSelfProgress2 << 32) + aCurSelfProgress1;
     long aMaxSelfProgress = (aMaxSelfProgress2 << 32) + aMaxSelfProgress1;
     long aCurTotalProgress = (aCurTotalProgress2 << 32) + aCurTotalProgress1;
     long aMaxTotalProgress = (aMaxTotalProgress2 << 32) + aMaxTotalProgress1;
     return OnProgressChange64 (aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
 }
-
-int OnProgressChange64 (int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) {
+++/
+nsresult OnProgressChange64 (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt64 aCurSelfProgress, PRInt64 aMaxSelfProgress, PRInt64 aCurTotalProgress, PRInt64 aMaxTotalProgress) {
     long currentKBytes = aCurTotalProgress / 1024;
     long totalKBytes = aMaxTotalProgress / 1024;
     if (shell !is null && !shell.isDisposed ()) {
-        Object[] arguments = {new Long (currentKBytes), new Long (totalKBytes)};
-        String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$
+        //Object[] arguments = {new Long (currentKBytes), new Long (totalKBytes)};
+        //String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$
+        String statusMsg = format("Download:  {0} KB of {1} KB", currentKBytes, totalKBytes); 
         status.setText (statusMsg);
         shell.layout (true);
         shell.getDisplay ().update ();
@@ -262,11 +271,11 @@
     return XPCOM.NS_OK;
 }
 
-int OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int state) {
+nsresult OnSecurityChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUInt32 state) {
     return XPCOM.NS_OK;
 }
 
-int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateFlags, int aStatus) {
+nsresult OnStateChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUInt32 aStateFlags, nsresult aStatus) {
     if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) {
         cancelable = null;
         if (shell !is null && !shell.isDisposed ()) shell.dispose ();
@@ -275,7 +284,7 @@
     return XPCOM.NS_OK;
 }   
 
-int OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStatus, int /*long*/ aMessage) {
+nsresult OnStatusChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar* aMessage) {
     return XPCOM.NS_OK;
 }       
 }
--- a/dwt/browser/FilePickerFactory.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/FilePickerFactory.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,32 +7,34 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.FilePickerFactory;
 
 import dwt.dwthelper.utils;
 
-import dwt.internal.C;
+//import dwt.internal.C;
 import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+//import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsID;
 import dwt.internal.mozilla.nsIFactory;
 import dwt.internal.mozilla.nsISupports;
 
-class FilePickerFactory {
-    XPCOMObject supports;
-    XPCOMObject factory;
+class FilePickerFactory : IFactory {
+    //XPCOMObject supports;
+    //XPCOMObject factory;
     int refCount = 0;
 
-FilePickerFactory () {
-    createCOMInterfaces ();
+this () {
+//   createCOMInterfaces ();
 }
 
-int AddRef () {
+nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
-
+/+
 void createCOMInterfaces () {
     /* Create each of the interfaces that this object implements */
     supports = new XPCOMObject (new int[] {2, 0, 0}) {
@@ -64,43 +66,48 @@
 int /*long*/ getAddress () {
     return factory.getAddress ();
 }
-
-int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
-    if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE;
-    nsID guid = new nsID ();
-    XPCOM.memmove (guid, riid, nsID.sizeof);
++/
+nsresult QueryInterface (nsID* riid, void** ppvObject) {
+    if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
+    //nsID guid = new nsID ();
+    //XPCOM.memmove (guid, riid, nsID.sizeof);
     
-    if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsISupports.IID) {
+        *ppvObject = cast(void*)cast(nsISupports)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsIFactory.IID) {
+        *ppvObject = cast(void*)cast(nsIFactory)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
     
-    XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+    *ppvObject = null;
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
 
-int Release () {
+nsrefcnt Release () {
     refCount--;
-    if (refCount is 0) disposeCOMInterfaces ();
+    //if (refCount is 0) disposeCOMInterfaces ();
     return refCount;
 }
     
 /* nsIFactory */
 
-int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
-    FilePicker picker = new FilePicker ();
-    picker.AddRef ();
-    XPCOM.memmove (result, new int /*long*/[] {picker.getAddress ()}, C.PTR_SIZEOF);
-    return XPCOM.NS_OK;
+nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { 
+     if (result is null) 
+        return XPCOM.NS_ERROR_INVALID_ARG;
+    auto picker = new FilePicker;
+    nsresult rv = picker.QueryInterface( iid, result );
+    if (XPCOM.NS_FAILED(rv)) {
+        *result = null;
+        delete picker;
+    }
+    return rv;
 }
 
-int LockFactory (int lock) {
+nsresult LockFactory (PRBool lock) {
     return XPCOM.NS_OK;
 }
 }
--- a/dwt/browser/FilePickerFactory_1_8.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/FilePickerFactory_1_8.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,17 +7,21 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.FilePickerFactory_1_8;
 
 import dwt.dwthelper.utils;
 
-import dwt.internal.C;
+//import dwt.internal.C;
 import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+import dwt.browser.FilePickerFactory;
+//import dwt.internal.mozilla.XPCOMObject;
 
-class FilePickerFactory_1_8 extends FilePickerFactory {
+class FilePickerFactory_1_8 : FilePickerFactory {
 
+/+
 void createCOMInterfaces () {
     /* Create each of the interfaces that this object implements */
     supports = new XPCOMObject (new int[] {2, 0, 0}) {
@@ -34,14 +38,19 @@
         public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);}
     };
 }
-
++/
 /* nsIFactory */
 
-int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
-    FilePicker_1_8 picker = new FilePicker_1_8 ();
-    picker.AddRef ();
-    XPCOM.memmove (result, new int /*long*/[] {picker.getAddress ()}, C.PTR_SIZEOF);
-    return XPCOM.NS_OK;
+nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { 
+     if (result is null) 
+        return XPCOM.NS_ERROR_INVALID_ARG;
+    auto picker = new FilePicker_1_8;
+    nsresult rv = picker.QueryInterface( iid, result );
+    if (XPCOM.NS_FAILED(rv)) {
+        *result = null;
+        delete picker;
+    }
+    return rv;
 }
 
 }
--- a/dwt/browser/FilePicker_1_8.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/FilePicker_1_8.d	Sun Aug 10 22:25:43 2008 -0700
@@ -22,6 +22,6 @@
 
 String parseAString (nsAString* string) {
     if (string is null) return null;
-    return Utf.toString(nsAString.getString16(string));
+    return nsAString.toString(string));
 }
 }
--- a/dwt/browser/HelperAppLauncherDialog.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/HelperAppLauncherDialog.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,15 +7,19 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.HelperAppLauncherDialog;
 
 import dwt.dwthelper.utils;
 
+import Utf = tango.text.convert.Utf;
+
 import dwt.DWT;
-import dwt.internal.C;
+//import dwt.internal.C;
 import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+//import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsEmbedString;
 import dwt.internal.mozilla.nsID;
 import dwt.internal.mozilla.nsIHelperAppLauncher;
@@ -26,20 +30,20 @@
 import dwt.widgets.FileDialog;
 import dwt.widgets.Shell;
 
-class HelperAppLauncherDialog {
-    XPCOMObject supports;
-    XPCOMObject helperAppLauncherDialog;
+class HelperAppLauncherDialog : nsHelperAppLauncherDialog {
+    //XPCOMObject supports;
+    //XPCOMObject helperAppLauncherDialog;
     int refCount = 0;
 
-HelperAppLauncherDialog () {
-    createCOMInterfaces ();
+this() {
+    //createCOMInterfaces ();
 }
 
-int AddRef () {
+nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
-
+/+
 void createCOMInterfaces () {
     /* Create each of the interfaces that this object implements */
     supports = new XPCOMObject (new int[] {2, 0, 0}) {
@@ -71,28 +75,28 @@
 int /*long*/ getAddress () {
     return helperAppLauncherDialog.getAddress ();
 }
-
-int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
-    if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE;
-    nsID guid = new nsID ();
-    XPCOM.memmove (guid, riid, nsID.sizeof);
++/
+nsresult QueryInterface (nsID* riid, void** ppvObject) {
+    if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
+    //nsID guid = new nsID ();
+    //XPCOM.memmove (guid, riid, nsID.sizeof);
     
-    if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsISupports.IID) {
+        *ppvObject = cast(void*)cast(nsISupports)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (guid.Equals (nsIHelperAppLauncherDialog.NS_IHELPERAPPLAUNCHERDIALOG_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsIHelperAppLauncherDialog.IID) {
+        *ppvObject = cast(void*)cast(nsIHelperAppLauncherDialog)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
     
-    XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+    *ppvObject = null;
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
             
-int Release () {
+nsrefcnt Release () {
     refCount--;
     /*
     * Note.  This instance lives as long as the download it is binded to.
@@ -101,42 +105,46 @@
     * cancels the File Dialog, cancels or closes the Download Dialog
     * and when the Download Dialog goes away after the download is completed.
     */
-    if (refCount is 0) disposeCOMInterfaces ();
+    //if (refCount is 0) disposeCOMInterfaces ();
     return refCount;
 }
 
 /* nsIHelperAppLauncherDialog */
 
-int Show (int /*long*/ aLauncher, int /*long*/ aContext, int aReason) {
+nsresult Show (nsIHelperAppLauncher aLauncher, nsISupports aContext, PRUint32 aReason) {
     /*
     * The interface for nsIHelperAppLauncher changed in GRE versions 1.8 and 1.9.  Query for
     * each of these interfaces in turn until one is found.
     */
-    nsISupports supports = new nsISupports (aLauncher);
-    int /*long*/[] result = new int /*long*/[1];
-    int rc = supports.QueryInterface (nsIHelperAppLauncher_1_9.NS_IHELPERAPPLAUNCHER_IID, result);
+    // FIXME: Not sure if this will work because of different versions of 
+    // nsIHelperAppLauncher.  Remember to check. -JJR
+    nsIHelperAppLauncher_1_9 helperAppLauncher1;
+    int rc = aLauncher.QueryInterface (nsIHelperAppLauncher_1_9.IID, cast(void*)&helperAppLauncher1);
     if (rc is 0) {
-        nsIHelperAppLauncher_1_9 helperAppLauncher = new nsIHelperAppLauncher_1_9 (aLauncher);
-        rc = helperAppLauncher.SaveToDisk (0, 0);
-        helperAppLauncher.Release ();
+       // nsIHelperAppLauncher_1_9 helperAppLauncher = new nsIHelperAppLauncher_1_9 (aLauncher);
+        rc = helperAppLauncher1.SaveToDisk (0, 0);
+        helperAppLauncher1.Release ();
         return rc;
     }
 
-    result[0] = 0;
-    rc = supports.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
+    //result[0] = 0;
+    nsIHelperAppLauncher_1_8 helperAppLauncher2;
+    rc = aLauncher.QueryInterface (nsIHelperAppLauncher_1_8.IID, cast(void*)&helperAppLauncher2);
     if (rc is 0) {
-        nsIHelperAppLauncher_1_8 helperAppLauncher = new nsIHelperAppLauncher_1_8 (aLauncher);
-        rc = helperAppLauncher.SaveToDisk (0, 0);
-        helperAppLauncher.Release ();
+        //nsIHelperAppLauncher_1_8 helperAppLauncher = new nsIHelperAppLauncher_1_8 (aLauncher);
+        rc = helperAppLauncher2.SaveToDisk (0, 0);
+        helperAppLauncher2.Release ();
         return rc;
     }
 
-    nsIHelperAppLauncher helperAppLauncher = new nsIHelperAppLauncher (aLauncher);  /* < 1.8 */
-    return helperAppLauncher.SaveToDisk (0, 0);
+    //nsIHelperAppLauncher helperAppLauncher = new nsIHelperAppLauncher (aLauncher);  /* < 1.8 */
+    return aLauncher.SaveToDisk (0, 0);
 }
 
-int PromptForSaveToFile (int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4) {
-    int /*long*/ aDefaultFile, aSuggestedFileExtension, _retval;
+int PromptForSaveToFile (nsIHelperAppLauncher arg0, nsISupports arg1, PRUnichar* arg2, PRUnichar* arg3, nsILocalFile* arg4) {
+    PRUnichar* aDefaultFile;
+    PRUnichar* aSuggestedFileExtension;
+    nsILocalFile* _retval;
     bool hasLauncher = false;
 
     /*
@@ -153,81 +161,91 @@
      * argument must be queried for both the old and new nsIHelperAppLauncher interfaces. 
      */
     bool using_1_8 = false, using_1_9 = false;
-    nsISupports support = new nsISupports (arg0);
-    int /*long*/[] result = new int /*long*/[1];
-    int rc = support.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
+    // technically this should have an AddRef? -JJR
+    nsISupports support = cast(nsISupports)arg0; 
+    //int /*long*/[] result = new int /*long*/[1];
+    if (arg0 is null)
+        assert(0);
+        
+    nsIHelperAppLauncher_1_8 helperAppLauncher1;
+    int rc = support.QueryInterface (nsIHelperAppLauncher_1_8.IID, cast(void*)&helperAppLauncher1);
     if (rc is 0) {
         using_1_8 = true;
         hasLauncher = true;
-        new nsISupports (result[0]).Release ();
+        helperAppLauncher1.Release ();
     } else {
-        result[0] = 0;
-        rc = support.QueryInterface (nsIHelperAppLauncher_1_9.NS_IHELPERAPPLAUNCHER_IID, result);
+        nsIHelperAppLauncher_1_9 helperAppLauncher2;
+        rc = support.QueryInterface (nsIHelperAppLauncher_1_9.IID, cast(void*)&helperAppLauncher2);
         if (rc is 0) {
             using_1_9 = true;
             hasLauncher = true;
-            new nsISupports (result[0]).Release ();
+            helperAppLauncher2.Release;
         } else {
-            result[0] = 0;
-            rc = support.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
+            nsIHelperAppLauncher helperAppLauncher;
+            rc = support.QueryInterface (nsIHelperAppLauncher.IID, cast(void*)&helperAppLauncher);
             if (rc is 0) {
                 hasLauncher = true;
-                new nsISupports (result[0]).Release ();
+                helperAppLauncher.Release;
             }
         }
     }
-    result[0] = 0;
+    //result[0] = 0;
 
     if (hasLauncher) {  /* >= 1.5 */
         aDefaultFile = arg2;
         aSuggestedFileExtension = arg3;
         _retval = arg4;
-    } else {            /* 1.4 */
+    } else {            /* 1.4 */  
+    // This call conversion probablywon't work for non-Java
+    // and shouldn't get called; fix it later. -JJR
         aDefaultFile = arg1;
         aSuggestedFileExtension = arg2;
         _retval = arg3;
     }
 
-    int length = XPCOM.strlen_PRUnichar (aDefaultFile);
-    char[] dest = new char[length];
-    XPCOM.memmove (dest, aDefaultFile, length * 2);
-    String defaultFile = new String (dest);
+    int span = XPCOM.strlen_PRUnichar (aDefaultFile);
+    // XPCOM.memmove (dest, aDefaultFile, length * 2);
+    String defaultFile = Utf.toString (aDefaultFile[0 .. span]));
 
-    length = XPCOM.strlen_PRUnichar (aSuggestedFileExtension);
-    dest = new char[length];
-    XPCOM.memmove (dest, aSuggestedFileExtension, length * 2);
-    String suggestedFileExtension = new String (dest);
+    span = XPCOM.strlen_PRUnichar (aSuggestedFileExtension);
+    //dest = new char[length];
+    //XPCOM.memmove (dest, aSuggestedFileExtension, length * 2);
+    String suggestedFileExtension =  Utf.toString (aSuggestedFileExtension[0 .. span]);
 
     Shell shell = new Shell ();
     FileDialog fileDialog = new FileDialog (shell, DWT.SAVE);
     fileDialog.setFileName (defaultFile);
-    fileDialog.setFilterExtensions (new String[] {suggestedFileExtension});
+    String[] tmp ~= suggestedFileExtension; 
+    fileDialog.setFilterExtensions (tmp);
     String name = fileDialog.open ();
     shell.close ();
     if (name is null) {
         if (hasLauncher) {
+            // not sure if these produce correct interface alignment. Check. -JJR
             if (using_1_8) {
-                nsIHelperAppLauncher_1_8 launcher = new nsIHelperAppLauncher_1_8 (arg0);
+                auto launcher = cast(nsIHelperAppLauncher_1_8)cast(void*)arg0;
                 rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED);
             } else if (using_1_9) {
-                nsIHelperAppLauncher_1_9 launcher = new nsIHelperAppLauncher_1_9 (arg0);
+                auto launcher = cast(nsIHelperAppLauncher_1_9)cast(void*)arg0;
                 rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED);
             } else {
-                nsIHelperAppLauncher launcher = new nsIHelperAppLauncher (arg0);
-                rc = launcher.Cancel ();
+                //nsIHelperAppLauncher launcher = new nsIHelperAppLauncher (arg0);
+                rc = arg0.Cancel ();
             }
             if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
             return XPCOM.NS_OK;
         }
         return XPCOM.NS_ERROR_FAILURE;
     }
-    nsEmbedString path = new nsEmbedString (name);
-    rc = XPCOM.NS_NewLocalFile (path.getAddress (), 1, result);
-    path.dispose ();
+    scope auto path = new nsEmbedString (name);
+    nsILocalFile localFile;
+    rc = XPCOM.NS_NewLocalFile (cast(nsAString*)path, 1, cast(void*)&localFile);
+    //path.dispose ();
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
+    if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
     /* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */
-    XPCOM.memmove (_retval, result, C.PTR_SIZEOF);  
+    *_retval = cast(void*)&localFile; 
+    //XPCOM.memmove (_retval, result, C.PTR_SIZEOF);  
     return XPCOM.NS_OK;
 }
 }
--- a/dwt/browser/HelperAppLauncherDialogFactory.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/HelperAppLauncherDialogFactory.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,32 +7,34 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.HelperAppLauncherDialogFactory;
 
 import dwt.dwthelper.utils;
 
-import dwt.internal.C;
+//import dwt.internal.C;
 import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+//import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsID;
 import dwt.internal.mozilla.nsIFactory;
 import dwt.internal.mozilla.nsISupports;
 
-class HelperAppLauncherDialogFactory {
-    XPCOMObject supports;
-    XPCOMObject factory;
+class HelperAppLauncherDialogFactory : nsIFactory {
+    //XPCOMObject supports;
+    //XPCOMObject factory;
     int refCount = 0;
 
-HelperAppLauncherDialogFactory () {
-    createCOMInterfaces ();
+this () {
+//    createCOMInterfaces ();
 }
 
-int AddRef () {
+nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
-
+/+
 void createCOMInterfaces () {
     /* Create each of the interfaces that this object implements */
     supports = new XPCOMObject (new int[] {2, 0, 0}) {
@@ -64,43 +66,47 @@
 int /*long*/ getAddress () {
     return factory.getAddress ();
 }
-
-int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
-    if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE;
-    nsID guid = new nsID ();
-    XPCOM.memmove (guid, riid, nsID.sizeof);
++/
+nsresult QueryInterface (nsID* riid, void** ppvObject) {
+    if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
+    //nsID guid = new nsID ();
+    //XPCOM.memmove (guid, riid, nsID.sizeof);
     
-    if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsISupports.IID) {
+        *ppvObject = cast(void*)cast(nsISupports)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsIFactory.IID) {
+        *ppvObject = cast(void*)cast(nsIFactory)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
     
-    XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+    *ppvObject = null;
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
             
-int Release () {
+nsrefcnt Release () {
     refCount--;
-    if (refCount is 0) disposeCOMInterfaces ();
+    //if (refCount is 0) disposeCOMInterfaces ();
     return refCount;
 }
     
 /* nsIFactory */
 
-int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
-    HelperAppLauncherDialog helperAppLauncherDialog = new HelperAppLauncherDialog ();
-    helperAppLauncherDialog.AddRef ();
-    XPCOM.memmove (result, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF);
-    return XPCOM.NS_OK;
+nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { 
+     if (result is null) 
+        return XPCOM.NS_ERROR_INVALID_ARG;
+    auto helperAppLauncherDialog = new HelperAppLauncherDialog;
+    nsresult rv = helperAppLauncherDialog.QueryInterface( iid, result );
+    if (XPCOM.NS_FAILED(rv)) {
+        *result = null;
+        delete helperAppLauncherDialog;
+    }
+    return rv;
 }
-
-int LockFactory (int lock) {
+nsresult LockFactory (PRBool lock) {
     return XPCOM.NS_OK;
 }
 }
--- a/dwt/browser/InputStream.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/InputStream.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,36 +7,39 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.InputStream;
 
+import Math = tango.math.Math;
 import dwt.dwthelper.utils;
 
-import dwt.internal.C;
+//import dwt.internal.C;
 import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+//import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsID;
 import dwt.internal.mozilla.nsIInputStream;
 import dwt.internal.mozilla.nsISupports;
 
-class InputStream {
-    XPCOMObject inputStream;
+class InputStream : nsIInputStream {
+    //XPCOMObject inputStream;
     int refCount = 0;
 
     byte[] buffer;
     int index = 0;
     
-InputStream (byte[] buffer) {
+this (byte[] buffer) {
     this.buffer = buffer;
     index = 0;
-    createCOMInterfaces ();
+    //createCOMInterfaces ();
 }
 
-int AddRef () {
+nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
-
+/+
 void createCOMInterfaces () {
     /* Create each of the interfaces that this object implements */
     inputStream = new XPCOMObject (new int[] {2, 0, 0, 0, 1, 3, 4, 1}) {
@@ -61,75 +64,80 @@
 int /*long*/ getAddress () {
     return inputStream.getAddress ();
 }
-
-int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
-    if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE;
-    nsID guid = new nsID ();
-    XPCOM.memmove (guid, riid, nsID.sizeof);
++/
+nsresult QueryInterface (nsID* riid, void** ppvObject) {
+    if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
+    //nsID guid = new nsID ();
+    //XPCOM.memmove (guid, riid, nsID.sizeof);
     
-    if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {inputStream.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsISupports.IID) {
+        *ppvObject = cast(void*)cast(nsISupports)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (guid.Equals (nsIInputStream.NS_IINPUTSTREAM_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {inputStream.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsIInputStream.IID) {
+        *ppvObject = cast(void*)cast(nsIInputStream)this;
         AddRef ();
         return XPCOM.NS_OK;
     }   
-    XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+    *ppvObject = null;
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
             
-int Release () {
+nsrefcnt Release () {
     refCount--;
-    if (refCount is 0) disposeCOMInterfaces ();
+    //if (refCount is 0) disposeCOMInterfaces ();
     return refCount;
 }
     
 /* nsIInputStream implementation */
 
-int Close () {
+nsresult Close () {
     buffer = null;
     index = 0;
     return XPCOM.NS_OK;
 }
 
-int Available (int /*long*/ _retval) {
-    int available = buffer is null ? 0 : buffer.length - index;
-    XPCOM.memmove (_retval, new int[] {available}, 4);
+nsresult Available (PRUint32* _retval) {
+    PRUint32 available = buffer is null ? 0 : buffer.length - index;
+    *_retval = available;
+    //XPCOM.memmove (_retval, new int[] {available}, 4);
     return XPCOM.NS_OK;
 }
 
-int Read(int /*long*/ aBuf, int aCount, int /*long*/ _retval) {
+nsresult Read(byte* aBuf, PRUint32 aCount, PRUint32* _retval) {
     int max = Math.min (aCount, buffer is null ? 0 : buffer.length - index);
+    if (aBuf is null)
+        assert(0);
     if (max > 0) {
-        byte[] src = new byte[max];
-        System.arraycopy (buffer, index, src, 0, max);
-        XPCOM.memmove (aBuf, src, max);
+        //byte[] src = new byte[max];
+        //System.arraycopy (buffer, index, src, 0, max);
+        //XPCOM.memmove (aBuf, src, max);
+        aBuf[0..max] = buffer[index..$];
         index += max;
     }
-    XPCOM.memmove(_retval, new int[] {max}, 4);
+    *_retval = max;
     return XPCOM.NS_OK;
 }
 
-int ReadSegments (int /*long*/ aWriter, int /*long*/ aClosure, int aCount, int /*long*/ _retval) {
+nsresult ReadSegments (nsWriteSegFun aWriter, void* aClosure, PRUint32 aCount, PRUint32* _retval) {
     int max = Math.min (aCount, buffer is null ? 0 : buffer.length - index);
-    int cnt = max;
+    PRUint32 cnt = max;
     while (cnt > 0) {
-        int[] aWriteCount = new int[1];
-        int /*long*/ rc = XPCOM.Call (aWriter, getAddress (), aClosure, buffer, index, cnt, aWriteCount);
+        PRUint32 aWriteCount;
+        nsresult rc = aWrite (cast(nsIInputStream)this, aClosure, buffer.ptr, index, cnt, &aWriteCount);
         if (rc !is XPCOM.NS_OK) break;
-        index += aWriteCount[0];
-        cnt -= aWriteCount[0];
+        index += aWriteCount;
+        cnt -= aWriteCount;
     }
-    XPCOM.memmove (_retval, new int[] {max - cnt}, 4);
+    //XPCOM.memmove (_retval, new int[] {max - cnt}, 4);
+    *_retval = (max - cnt);
     return XPCOM.NS_OK;
 }
 
-int IsNonBlocking (int /*long*/ _retval) {
+nsresult IsNonBlocking (PRUint32* _retval) {
     /* blocking */
-    XPCOM.memmove (_retval, new int[] {0}, 4);
+    *_retval = 0;
     return XPCOM.NS_OK;
 }       
 }
--- a/dwt/browser/LocationAdapter.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/LocationAdapter.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,10 +7,13 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.LocationAdapter;
 
-import dwt.dwthelper.utils;
+import dwt.browser.LocationListener;
+import dwt.browser.LocationEvent;
 
 /**
  * This adapter class provides default implementations for the
@@ -23,7 +26,7 @@
  * 
  * @since 3.0
  */
-public abstract class LocationAdapter implements LocationListener {
+public abstract class LocationAdapter : LocationListener {
 
 public void changing(LocationEvent event) {
 }
--- a/dwt/browser/LocationEvent.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/LocationEvent.d	Sun Aug 10 22:25:43 2008 -0700
@@ -12,7 +12,7 @@
  *******************************************************************************/
 module dwt.browser.LocationEvent;
 
-import dwt.dwthelper.utils;
+import tango.text.convert.Format;
 
 import dwt.events.TypedEvent;
 import dwt.widgets.Widget;
@@ -45,7 +45,7 @@
 
     static final long serialVersionUID = 3906644198244299574L;
     
-LocationEvent(Widget w) {
+this(Widget w) {
     super(w);
 }
 
--- a/dwt/browser/LocationListener.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/LocationListener.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,12 +7,13 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.LocationListener;
 
-import dwt.dwthelper.utils;
-
 import dwt.internal.DWTEventListener;
+import dwt.browser.LocationEvent;
 
 /**
  * This listener interface may be implemented in order to receive
@@ -24,7 +25,7 @@
  * 
  * @since 3.0
  */
-public interface LocationListener extends DWTEventListener {
+public interface LocationListener : DWTEventListener {
 
 /**
  * This method is called when the current location is about to be changed.
--- a/dwt/browser/Mozilla.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/Mozilla.d	Sun Aug 10 22:25:43 2008 -0700
@@ -1485,8 +1485,8 @@
     return rc is XPCOM.NS_OK;
 }
 
-static Browser findBrowser (int /*long*/ handle) {
-    return MozillaDelegate.findBrowser (handle);
+static Browser findBrowser (void* handle) {
+    return MozillaDelegate.findBrowser (cast(GtkWidget*)handle);
 }
 
 public bool forward () {
--- a/dwt/browser/OpenWindowListener.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/OpenWindowListener.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,12 +7,13 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.OpenWindowListener;
 
-import dwt.dwthelper.utils;
-
 import dwt.internal.DWTEventListener;
+import dwt.browser.WindowEvent;
 
 /** 
  * This listener interface may be implemented in order to receive
@@ -26,7 +27,7 @@
  * 
  * @since 3.0
  */
-public interface OpenWindowListener extends DWTEventListener {
+public interface OpenWindowListener : DWTEventListener {
 
 /**
  * This method is called when a new window needs to be created.
--- a/dwt/browser/ProgressAdapter.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/ProgressAdapter.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,10 +7,13 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.ProgressAdapter;
 
-import dwt.dwthelper.utils;
+import dwt.browser.ProgressEvent;
+import dwt.browser.ProgressListener;
 
 /**
  * This adapter class provides default implementations for the
@@ -23,7 +26,7 @@
  * 
  * @since 3.0
  */
-public abstract class ProgressAdapter implements ProgressListener {
+public abstract class ProgressAdapter : ProgressListener {
  
 public void changed(ProgressEvent event) {
 }
--- a/dwt/browser/ProgressEvent.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/ProgressEvent.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,10 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.ProgressEvent;
 
-import dwt.dwthelper.utils;
+import tango.text.convert.Format;
 
 import dwt.events.TypedEvent;
 import dwt.widgets.Widget;
@@ -23,7 +25,7 @@
  * 
  * @since 3.0
  */
-public class ProgressEvent extends TypedEvent {
+public class ProgressEvent : TypedEvent {
     /** current value */
     public int current;
     /** total value */
@@ -31,7 +33,7 @@
     
     static final long serialVersionUID = 3977018427045393972L;
 
-ProgressEvent(Widget w) {
+this(Widget w) {
     super(w);
 }
 
@@ -41,11 +43,8 @@
  *
  * @return a string representation of the event
  */
-public String toString() {
-    String string = super.toString ();
-    return string.substring (0, string.length() - 1) // remove trailing '}'
-        + " current=" + current
-        + " total=" + total
-        + "}";
+public override String toString() {
+    return Format( "{} {current = {}, total = {}}", 
+        super.toString[1 .. $-2], current, total );  
 }
 }
--- a/dwt/browser/ProgressListener.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/ProgressListener.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,11 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.ProgressListener;
 
-import dwt.dwthelper.utils;
-
+import dwt.browser.ProgressEvent;
 import dwt.internal.DWTEventListener;
 
 /**
@@ -26,7 +27,7 @@
  * 
  * @since 3.0
  */
-public interface ProgressListener extends DWTEventListener {
+public interface ProgressListener : DWTEventListener {
     
 /**
  * This method is called when a progress is made during the loading of the 
--- a/dwt/browser/PromptDialog.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/PromptDialog.d	Sun Aug 10 22:25:43 2008 -0700
@@ -12,7 +12,8 @@
  *******************************************************************************/
 module dwt.browser.PromptDialog;
 
-import dwt.dwthelper.utils;
+import Math = tango.math.Math; 
+//import dwt.dwthelper.utils;
 
 import dwt.DWT;
 import dwt.layout.GridData;
@@ -39,7 +40,7 @@
         this(parent, 0);
     }
     
-    void alertCheck(String title, String text, String check, /* final */ int[] checkValue) {
+    void alertCheck(String title, String text, String check, ref int checkValue) {
         Shell parent = getParent();
         /* final */ Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL);
         if (title !is null) shell.setText(title);
@@ -59,19 +60,20 @@
         final Button checkButton = check !is null ? new Button(shell, DWT.CHECK) : null;
         if (checkButton !is null) {
             checkButton.setText(check);
-            checkButton.setSelection(checkValue[0] !is 0);
+            checkButton.setSelection(checkValue !is 0);
             data = new GridData ();
             data.horizontalAlignment = GridData.BEGINNING;
             checkButton.setLayoutData (data);
         }
         Button okButton = new Button(shell, DWT.PUSH);
-        okButton.setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$
+        okButton.setText("OK");  // TODO: Need to do this through Resource Bundle
+        //okButton.setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$
         data = new GridData ();
         data.horizontalAlignment = GridData.CENTER;
         okButton.setLayoutData (data);
         okButton.addListener(DWT.Selection, new Listener() {
             public void handleEvent(Event event) {
-                if (checkButton !is null) checkValue[0] = checkButton.getSelection() ? 1 : 0;
+                if (checkButton !is null) checkValue = checkButton.getSelection() ? 1 : 0;
                 shell.close();
             }
         });
@@ -84,7 +86,7 @@
         }
     }
 
-    void confirmEx(String title, String text, String check, String button0, String button1, String button2, int defaultIndex, /* final */ int[] checkValue, /* final */ int[] result) {
+    void confirmEx(String title, String text, String check, String button0, String button1, String button2, int defaultIndex, ref int checkValue, ref int result) {
         Shell parent = getParent();
         /* final */ Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL);
         shell.setText(title);
@@ -104,11 +106,11 @@
         final Button[] buttons = new Button[4];
         Listener listener = new Listener() {
             public void handleEvent(Event event) {
-                if (buttons[0] !is null) checkValue[0] = buttons[0].getSelection() ? 1 : 0;
+                if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0;
                 Widget widget = event.widget;
                 for (int i = 1; i < buttons.length; i++) {
                     if (widget is buttons[i]) {
-                        result[0] = i - 1;
+                        result = i - 1;
                         break;
                     }
                 }
@@ -118,7 +120,7 @@
         if (check !is null) {
             buttons[0] = new Button(shell, DWT.CHECK);
             buttons[0].setText(check);
-            buttons[0].setSelection(checkValue[0] !is 0);
+            buttons[0].setSelection(checkValue !is 0);
             data = new GridData ();
             data.horizontalAlignment = GridData.BEGINNING;
             buttons[0].setLayoutData (data);
@@ -164,7 +166,7 @@
         }
     }
     
-    void prompt(String title, String text, String check, /* final */ String[] value, /* final */ int[] checkValue, /* final */ int[] result) {
+    void prompt(String title, String text, String check, /* final */ref String value, /* final */ ref int checkValue, /* final */ref int result) {
         Shell parent = getParent();
         /* final */ Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL);
         if (title !is null) shell.setText(title);
@@ -182,7 +184,7 @@
         label.setLayoutData (data);
                 
         final Text valueText = new Text(shell, DWT.BORDER);
-        if (value[0] !is null) valueText.setText(value[0]);
+        if (value !is null) valueText.setText(value);
         data = new GridData();
         width = valueText.computeSize(DWT.DEFAULT, DWT.DEFAULT).x;
         if (width > maxWidth) data.widthHint = maxWidth;
@@ -193,16 +195,16 @@
         final Button[] buttons = new Button[3];
         Listener listener = new Listener() {
             public void handleEvent(Event event) {
-                if (buttons[0] !is null) checkValue[0] = buttons[0].getSelection() ? 1 : 0;
-                value[0] = valueText.getText();
-                result[0] = event.widget is buttons[1] ? 1 : 0;
+                if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0;
+                value = valueText.getText();
+                result = event.widget is buttons[1] ? 1 : 0;
                 shell.close();
             }   
         };
         if (check !is null) {
             buttons[0] = new Button(shell, DWT.CHECK);
             buttons[0].setText(check);
-            buttons[0].setSelection(checkValue[0] !is 0);
+            buttons[0].setSelection(checkValue !is 0);
             data = new GridData ();
             data.horizontalAlignment = GridData.BEGINNING;
             buttons[0].setLayoutData (data);
@@ -213,11 +215,13 @@
         composite.setLayoutData (data);
         composite.setLayout(new GridLayout(2, true));
         buttons[1] = new Button(composite, DWT.PUSH);
-        buttons[1].setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$
+        //buttons[1].setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$
+        buttons[1].setText("OK");
         buttons[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         buttons[1].addListener(DWT.Selection, listener);
         buttons[2] = new Button(composite, DWT.PUSH);
-        buttons[2].setText(DWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+        //buttons[2].setText(DWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+        buttons[2].setText("Cancel");
         buttons[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         buttons[2].addListener(DWT.Selection, listener);
 
@@ -247,8 +251,8 @@
         label.setLayoutData (data);
         
         Label userLabel = new Label(shell, DWT.NONE);
-        userLabel.setText(DWT.getMessage("SWT_Username")); //$NON-NLS-1$
-        
+        //userLabel.setText(DWT.getMessage("SWT_Username")); //$NON-NLS-1$
+        userLabel.setText("Username:");
         final Text userText = new Text(shell, DWT.BORDER);
         if (user[0] !is null) userText.setText(user[0]);
         data = new GridData();
@@ -257,8 +261,8 @@
         userText.setLayoutData(data);
         
         Label passwordLabel = new Label(shell, DWT.NONE);
-        passwordLabel.setText(DWT.getMessage("SWT_Password")); //$NON-NLS-1$
-        
+        //passwordLabel.setText(DWT.getMessage("SWT_Password")); //$NON-NLS-1$
+        passwordLabel.setText("Password:");
         final Text passwordText = new Text(shell, DWT.PASSWORD | DWT.BORDER);
         if (pass[0] !is null) passwordText.setText(pass[0]);
         data = new GridData();
@@ -290,11 +294,13 @@
         composite.setLayoutData (data);
         composite.setLayout(new GridLayout(2, true));
         buttons[1] = new Button(composite, DWT.PUSH);
-        buttons[1].setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$
+        //buttons[1].setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$
+        buttons[1].setText("OK");
         buttons[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         buttons[1].addListener(DWT.Selection, listener);
         buttons[2] = new Button(composite, DWT.PUSH);
-        buttons[2].setText(DWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+        //buttons[2].setText(DWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+        buttons[2].setText("Cancel");
         buttons[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         buttons[2].addListener(DWT.Selection, listener);
 
--- a/dwt/browser/PromptService2.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/browser/PromptService2.d	Sun Aug 10 22:25:43 2008 -0700
@@ -7,16 +7,18 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *      John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
 module dwt.browser.PromptService2;
 
 import dwt.dwthelper.utils;
 
 import dwt.DWT;
-import dwt.internal.C;
+//import dwt.internal.C;
 import dwt.internal.Compatibility;
 import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+//import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsEmbedString;
 import dwt.internal.mozilla.nsIAuthInformation;
 import dwt.internal.mozilla.nsIChannel;
@@ -34,21 +36,21 @@
 import dwt.widgets.MessageBox;
 import dwt.widgets.Shell;
 
-class PromptService2 {
-    XPCOMObject supports;
-    XPCOMObject promptService;
-    XPCOMObject promptService2;
+class PromptService2 : nsIPromptService2 {
+    //XPCOMObject supports;
+    //XPCOMObject promptService;
+    //XPCOMObject promptService2;
     int refCount = 0;
 
-PromptService2 () {
-    createCOMInterfaces ();
+this () {
+   // createCOMInterfaces ();
 }
 
-int AddRef () {
+nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
-
+/+
 void createCOMInterfaces () {
     /* Create each of the interfaces that this object implements */
     supports = new XPCOMObject (new int[] {2, 0, 0}) {
@@ -108,99 +110,107 @@
 int /*long*/ getAddress () {
     return promptService2.getAddress ();
 }
-
-int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
-    if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE;
-    nsID guid = new nsID ();
-    XPCOM.memmove (guid, riid, nsID.sizeof);
++/
+nsresult QueryInterface (nsID* riid, void** ppvObject) {
+    if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
+    //nsID guid = new nsID ();
+    //XPCOM.memmove (guid, riid, nsID.sizeof);
     
-    if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsISupports.IID) {
+        *ppvObject = cast(void*)cast(nsISupports)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (guid.Equals (nsIPromptService.NS_IPROMPTSERVICE_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsIPromptService.IID) {
+        *ppvObject = cast(void*)cast(nsIPromptService)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (guid.Equals (nsIPromptService2.NS_IPROMPTSERVICE2_IID)) {
-        XPCOM.memmove (ppvObject, new int /*long*/[] {promptService2.getAddress ()}, C.PTR_SIZEOF);
+    if (*riid == nsIPromptService2.IID) {
+        *ppvObject = cast(void*)cast(nsIPromptService2)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
 
-    XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+    *ppvObject = null;
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
             
-int Release () {
+nsrefcnt Release () {
     refCount--;
-    if (refCount is 0) disposeCOMInterfaces ();
+    //if (refCount is 0) disposeCOMInterfaces ();
     return refCount;
 }
 
-Browser getBrowser (int /*long*/ aDOMWindow) {
-    if (aDOMWindow is 0) return null;
+Browser getBrowser (nsIDOMWindow aDOMWindow) {
+    if (aDOMWindow is null) return null;
 
-    int /*long*/[] result = new int /*long*/[1];
-    int rc = XPCOM.NS_GetServiceManager (result);
+    //int /*long*/[] result = new int /*long*/[1];
+    nsIServiceManager serviceManager;
+    auto rc = XPCOM.NS_GetServiceManager (&serviceManager);
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
+    if (serviceManager is null) Mozilla.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) Mozilla.error(rc);
-    if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE);       
+    if (windowWatcher is null) Mozilla.error (XPCOM.NS_NOINTERFACE);       
     serviceManager.Release ();
     
-    nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]);
-    result[0] = 0;
+    //nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]);
+    //result[0] = 0;
     /* the chrome will only be answered for the top-level nsIDOMWindow */
-    nsIDOMWindow window = new nsIDOMWindow (aDOMWindow);
-    rc = window.GetTop (result);
+    //nsIDOMWindow window = new nsIDOMWindow (aDOMWindow);
+    nsIDOMWindow top;
+    rc = aDOMWindow.GetTop (&top);
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
-    aDOMWindow = result[0];
-    result[0] = 0;
-    rc = windowWatcher.GetChromeForWindow (aDOMWindow, result);
+    if (top is null) Mozilla.error (XPCOM.NS_NOINTERFACE);
+    //aDOMWindow = result[0];
+    //result[0] = 0;
+    nsIWebBrowserChrome webBrowserChrome;
+    rc = windowWatcher.GetChromeForWindow (top, &webBrowserChrome);
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE);       
+    if (webBrowserChrome is null) Mozilla.error (XPCOM.NS_NOINTERFACE);       
     windowWatcher.Release ();   
     
-    nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (result[0]);
-    result[0] = 0;
-    rc = webBrowserChrome.QueryInterface (nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID, result);
+    //nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (result[0]);
+    //result[0] = 0;
+    nsIEmbeddingSiteWindow embeddingSiteWindow;
+    rc = webBrowserChrome.QueryInterface (nsIEmbeddingSiteWindow.IID, cast(void*)&embeddingSiteWindow);
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE);       
+    if (embeddingSiteWindow is null) Mozilla.error (XPCOM.NS_NOINTERFACE);       
     webBrowserChrome.Release ();
     
-    nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]);
-    result[0] = 0;
-    rc = embeddingSiteWindow.GetSiteWindow (result);
+    //nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]);
+    //result[0] = 0;
+    
+    void* result;
+    rc = embeddingSiteWindow.GetSiteWindow (&result);
     if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
-    if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE);       
+    if (result is null) Mozilla.error (XPCOM.NS_NOINTERFACE);       
     embeddingSiteWindow.Release ();
     
-    return Mozilla.findBrowser (result[0]); 
+    return Mozilla.findBrowser (result); 
 }
 
-String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) {
+String getLabel (int buttonFlag, int index, PRUnichar* buttonTitle) {
     String label = null;
     int flag = (buttonFlag & (0xff * index)) / index;
     switch (flag) {
-        case nsIPromptService.BUTTON_TITLE_CANCEL : label = DWT.getMessage ("SWT_Cancel"); break; //$NON-NLS-1$
-        case nsIPromptService.BUTTON_TITLE_NO : label = DWT.getMessage ("SWT_No"); break; //$NON-NLS-1$
-        case nsIPromptService.BUTTON_TITLE_OK : label = DWT.getMessage ("SWT_OK"); break; //$NON-NLS-1$
-        case nsIPromptService.BUTTON_TITLE_SAVE : label = DWT.getMessage ("SWT_Save"); break; //$NON-NLS-1$
-        case nsIPromptService.BUTTON_TITLE_YES : label = DWT.getMessage ("SWT_Yes"); break; //$NON-NLS-1$
+        // TODO: implement with DWT.getMessage - JJR
+        case nsIPromptService.BUTTON_TITLE_CANCEL : label = "Cancel"; break; //$NON-NLS-1$
+        case nsIPromptService.BUTTON_TITLE_NO : label = "No"; break; //$NON-NLS-1$
+        case nsIPromptService.BUTTON_TITLE_OK : label = "OK"; break; //$NON-NLS-1$
+        case nsIPromptService.BUTTON_TITLE_SAVE : label = "Save"; break; //$NON-NLS-1$
+        case nsIPromptService.BUTTON_TITLE_YES : label = "Yes"; break; //$NON-NLS-1$
         case nsIPromptService.BUTTON_TITLE_IS_STRING : {
-            int length = XPCOM.strlen_PRUnichar (buttonTitle);
-            char[] dest = new char[length];
-            XPCOM.memmove (dest, buttonTitle, length * 2);
-            label = new String (dest);
+            auto span = XPCOM.strlen_PRUnichar (buttonTitle);
+            //char[] dest = new char[length];
+            //XPCOM.memmove (dest, buttonTitle, length * 2);
+            label = UTf.toString (buttonTitle[0 .. span]);
         }
     }
     return label;
@@ -208,18 +218,18 @@
 
 /* nsIPromptService */
 
-int Alert (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText) {
+nsresult Alert (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText) {
     Browser browser = getBrowser (aParent);
     
-    int length = XPCOM.strlen_PRUnichar (aDialogTitle);
-    char[] dest = new char[length];
-    XPCOM.memmove (dest, aDialogTitle, length * 2);
-    String titleLabel = new String (dest);
+    int span = XPCOM.strlen_PRUnichar (aDialogTitle);
+    //char[] dest = new char[length];
+    //XPCOM.memmove (dest, aDialogTitle, length * 2);
+    String titleLabel = Utf.toString (aDialogTitle[0 .. span]));
 
-    length = XPCOM.strlen_PRUnichar (aText);
-    dest = new char[length];
-    XPCOM.memmove (dest, aText, length * 2);
-    String textLabel = new String (dest);
+    span = XPCOM.strlen_PRUnichar (aText);
+    //dest = new char[length];
+    //XPCOM.memmove (dest, aText, length * 2);
+    String textLabel = Utf.toString (aText[0 .. span]);
 
     Shell shell = browser is null ? new Shell () : browser.getShell (); 
     MessageBox messageBox = new MessageBox (shell, DWT.OK | DWT.ICON_WARNING);
@@ -229,83 +239,83 @@
     return XPCOM.NS_OK;
 }
 
-int AlertCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState) {
+nsresult AlertCheck (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar* aCheckMsg, PRBool* aCheckState) {
     Browser browser = getBrowser (aParent);
     
-    int length = XPCOM.strlen_PRUnichar (aDialogTitle);
-    char[] dest = new char[length];
-    XPCOM.memmove (dest, aDialogTitle, length * 2);
-    String titleLabel = new String (dest);
+    int span = XPCOM.strlen_PRUnichar (aDialogTitle);
+    //char[] dest = new char[length];
+    //XPCOM.memmove (dest, aDialogTitle, length * 2);
+    String titleLabel = Utf.toString (aDialogTitle[0 .. span]);
 
-    length = XPCOM.strlen_PRUnichar (aText);
-    dest = new char[length];
-    XPCOM.memmove (dest, aText, length * 2);
-    String textLabel = new String (dest);
+    span = XPCOM.strlen_PRUnichar (aText);
+    //dest = new char[length];
+    //XPCOM.memmove (dest, aText, length * 2);
+    String textLabel = Utf.toString (aText[0 .. span]);
 
-    length = XPCOM.strlen_PRUnichar (aCheckMsg);
-    dest = new char[length];
-    XPCOM.memmove (dest, aCheckMsg, length * 2);
-    String checkLabel = new String (dest);
+    span = XPCOM.strlen_PRUnichar (aCheckMsg);
+    //dest = new char[length];
+    //XPCOM.memmove (dest, aCheckMsg, length * 2);
+    String checkLabel = Utf.toString (aCheckMsg[0..span]);
 
     Shell shell = browser is null ? new Shell () : browser.getShell ();
     PromptDialog dialog = new PromptDialog (shell);
-    int[] check = new int[1];
-    if (aCheckState !is 0) XPCOM.memmove (check, aCheckState, 4); /* PRBool */
-    dialog.alertCheck (titleLabel, textLabel, checkLabel, check);
-    if (aCheckState !is 0) XPCOM.memmove (aCheckState, check, 4); /* PRBool */
+    int check;
+    if (aCheckState !is null) check = *aCheckState; /* PRBool */
+    dialog.alertCheck (titleLabel, textLabel, checkLabel, /*ref*/ check);
+    if (aCheckState !is null) *aCheckState = check; /* PRBool */
     return XPCOM.NS_OK;
 }
 
-int AsyncPromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int /*long*/ aCallback, int /*long*/ aContext, int level, int /*long*/ authInfo, int /*long*/ checkboxLabel, int /*long*/ checkValue, int /*long*/ _retval) {
+nsresult AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, PRUint32 level, nsIAuthInformation authInfo, PRUnichar* checkboxLabel, PRBool* checkValue, nsICancelable* _retval) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int Confirm (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ _retval) {
+nsresult Confirm (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRBool* _retval) {
     Browser browser = getBrowser (aParent);
     
-    int length = XPCOM.strlen_PRUnichar (aDialogTitle);
-    char[] dest = new char[length];
-    XPCOM.memmove (dest, aDialogTitle, length * 2);
-    String titleLabel = new String (dest);
+    int span = XPCOM.strlen_PRUnichar (aDialogTitle);
+    //char[] dest = new char[length];
+    //XPCOM.memmove (dest, aDialogTitle, length * 2);
+    String titleLabel = Utf.toString (aDialogTitle[0 .. span]);
 
-    length = XPCOM.strlen_PRUnichar (aText);
-    dest = new char[length];
-    XPCOM.memmove (dest, aText, length * 2);
-    String textLabel = new String (dest);
+    span = XPCOM.strlen_PRUnichar (aText);
+    //dest = new char[length];
+    //XPCOM.memmove (dest, aText, length * 2);
+    String textLabel = Utf.toString (aText[0 .. span]);
 
     Shell shell = browser is null ? new Shell () : browser.getShell ();
     MessageBox messageBox = new MessageBox (shell, DWT.OK | DWT.CANCEL | DWT.ICON_QUESTION);
     messageBox.setText (titleLabel);
     messageBox.setMessage (textLabel);
     int id = messageBox.open ();
-    int[] result = {id is DWT.OK ? 1 : 0};
-    XPCOM.memmove (_retval, result, 4);
+    int result = id is DWT.OK ? 1 : 0;
+    *_retval = result;
     return XPCOM.NS_OK;
 }
 
-int ConfirmCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) {
+nsresult ConfirmCheck (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar* aCheckMsg, PRBool* aCheckState, PRBool* _retval) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int ConfirmEx (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aButtonFlags, int /*long*/ aButton0Title, int /*long*/ aButton1Title, int /*long*/ aButton2Title, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) {
+nsresult ConfirmEx (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUint32 aButtonFlags, PRUnichar* aButton0Title, PRUnichar* aButton1Title, PRUnichar* aButton2Title, PRUnichar* aCheckMsg, PRBool* aCheckState, PRInt32* _retval) {
     Browser browser = getBrowser (aParent);
     
-    int length = XPCOM.strlen_PRUnichar (aDialogTitle);
-    char[] dest = new char[length];
-    XPCOM.memmove (dest, aDialogTitle, length * 2);
-    String titleLabel = new String (dest);
+    int span = XPCOM.strlen_PRUnichar (aDialogTitle);
+    //char[] dest = new char[length];
+    //XPCOM.memmove (dest, aDialogTitle, length * 2);
+    String titleLabel = Utf.toString (aDialogTitle[0 .. span]);
 
-    length = XPCOM.strlen_PRUnichar (aText);
-    dest = new char[length];
-    XPCOM.memmove (dest, aText, length * 2);
-    String textLabel = new String (dest);
+    span = XPCOM.strlen_PRUnichar (aText);
+    //dest = new char[length];
+    //XPCOM.memmove (dest, aText, length * 2);
+    String textLabel = Utf.toString (aText[0 .. span]);
     
     String checkLabel = null;
-    if (aCheckMsg !is 0) {
-        length = XPCOM.strlen_PRUnichar (aCheckMsg);
-        dest = new char[length];
-        XPCOM.memmove (dest, aCheckMsg, length * 2);
-        checkLabel = new String (dest);
+    if (aCheckMsg !is null) {
+        span = XPCOM.strlen_PRUnichar (aCheckMsg);
+        //dest = new char[length];
+        //XPCOM.memmove (dest, aCheckMsg, length * 2);
+        checkLabel = Utf.toString (aCheckMsg[0 .. span]);
     }
     
     String button0Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_0, aButton0Title);
@@ -321,58 +331,60 @@
     
     Shell shell = browser is null ? new Shell () : browser.getShell ();
     PromptDialog dialog = new PromptDialog (shell);
-    int[] check = new int[1], result = new int[1];
-    if (aCheckState !is 0) XPCOM.memmove (check, aCheckState, 4);
-    dialog.confirmEx (titleLabel, textLabel, checkLabel, button0Label, button1Label, button2Label, defaultIndex, check, result);
-    if (aCheckState !is 0) XPCOM.memmove (aCheckState, check, 4);
-    XPCOM.memmove (_retval, result, 4);
+    int check, result;
+    if (aCheckState !is null) check = *aCheckState;
+    dialog.confirmEx (titleLabel, textLabel, checkLabel, button0Label, button1Label, button2Label, defaultIndex, /*ref*/check, /*ref*/result);
+    if (aCheckState !is null) *aCheckState = check;
+    *_retval = result;
     return XPCOM.NS_OK;
 }
 
-int Prompt (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aValue, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) {
+nsresult Prompt (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar** aValue, PRUnichar* aCheckMsg, PRBool* aCheckState, PRBool* _retval) {
     Browser browser = getBrowser (aParent);
-    String titleLabel = null, textLabel, checkLabel = null;
-    String[] valueLabel = new String[1];
-    char[] dest;
-    int length;
-    if (aDialogTitle !is 0) {
-        length = XPCOM.strlen_PRUnichar (aDialogTitle);
-        dest = new char[length];
-        XPCOM.memmove (dest, aDialogTitle, length * 2);
-        titleLabel = new String (dest);
+    String titleLabel = null;
+    String textLabel = null, checkLabel = null;
+    String valueLabel;
+    //char[] dest;
+    int span;
+    if (aDialogTitle !is null) {
+        span = XPCOM.strlen_PRUnichar (aDialogTitle);
+        //dest = new char[length];
+        //XPCOM.memmove (dest, aDialogTitle, length * 2);
+        titleLabel = Utf.toString (aDialogTitle[0 .. span]);
     }
     
-    length = XPCOM.strlen_PRUnichar (aText);
-    dest = new char[length];
-    XPCOM.memmove (dest, aText, length * 2);
-    textLabel = new String (dest);
+    span = XPCOM.strlen_PRUnichar (aText);
+    //dest = new char[length];
+    //XPCOM.memmove (dest, aText, length * 2);
+    textLabel = Utf.toString (aText[0 .. span]);
     
-    int /*long*/[] valueAddr = new int /*long*/[1];
-    XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF);
-    if (valueAddr[0] !is 0) {
-        length = XPCOM.strlen_PRUnichar (valueAddr[0]);
-        dest = new char[length];
-        XPCOM.memmove (dest, valueAddr[0], length * 2);
-        valueLabel[0] = new String (dest);      
+    //int /*long*/[] valueAddr = new int /*long*/[1];
+    //XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF);
+    if (aValue !is null) {
+        if(*aValue !is null) {
+            span = XPCOM.strlen_PRUnichar (*aValue);
+            //dest = new char[length];
+            //XPCOM.memmove (dest, valueAddr[0], length * 2);
+            valueLabel = Utf.toString ((*aValue)[0 .. span]);
+        }
     }
     
-    if (aCheckMsg !is 0) {
-        length = XPCOM.strlen_PRUnichar (aCheckMsg);
-        if (length > 0) {
-            dest = new char[length];
-            XPCOM.memmove (dest, aCheckMsg, length * 2);
-            checkLabel = new String (dest);
+    if (aCheckMsg !is null) {
+        span = XPCOM.strlen_PRUnichar (aCheckMsg);
+        if (span > 0) {
+            //dest = new char[length];
+            //XPCOM.memmove (dest, aCheckMsg, length * 2);
+            checkLabel = Utf.toString (aCheckMsg[0 .. span]);
         }
     }
 
     Shell shell = browser is null ? new Shell () : browser.getShell ();
     PromptDialog dialog = new PromptDialog (shell);
-    int[] check = new int[1], result = new int[1];
-    if (aCheckState !is 0) XPCOM.memmove (check, aCheckState, 4);
-    dialog.prompt (titleLabel, textLabel, checkLabel, valueLabel, check, result);
-
-    XPCOM.memmove (_retval, result, 4);
-    if (result[0] is 1) {
+    int check, result;
+    if (aCheckState !is null) check = *aCheckState;
+    dialog.prompt (titleLabel, textLabel, checkLabel, /*ref*/valueLabel,/*ref*/ check,/*ref*/ result);
+    *_retval = result;
+    if (result is 1) {
         /* 
         * User selected OK. User name and password are returned as PRUnichar values. Any default
         * value that we override must be freed using the nsIMemory service.
@@ -381,10 +393,10 @@
         int /*long*/ ptr;
         char[] buffer;
         int /*long*/[] result2 = new int /*long*/[1];
-        if (valueLabel[0] !is null) {
-            cnt = valueLabel[0].length ();
+        if (valueLabel !is null) {
+            cnt = valueLabel.length;
             buffer = new char[cnt + 1];
-            valueLabel[0].getChars (0, cnt, buffer, 0);
+            valueLabel.getChars (0, cnt, buffer, 0);
             size = buffer.length * 2;
             ptr = C.malloc (size);
             XPCOM.memmove (ptr, buffer, size);
@@ -414,7 +426,7 @@
     return XPCOM.NS_OK;
 }
 
-int PromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int level, int /*long*/ authInfo, int /*long*/ checkboxLabel, int /*long*/ checkboxValue, int /*long*/ _retval) {
+nsresult PromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int level, int /*long*/ authInfo, int /*long*/ checkboxLabel, int /*long*/ checkboxValue, int /*long*/ _retval) {
     Browser browser = getBrowser (aParent);
     String checkLabel = null;
     int[] checkValue = new int[1];
@@ -514,7 +526,7 @@
     return XPCOM.NS_OK;
 }
 
-int PromptUsernameAndPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aUsername, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) {
+nsresult PromptUsernameAndPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aUsername, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) {
     Browser browser = getBrowser (aParent);
     String titleLabel, textLabel, checkLabel = null;
     String[] userLabel = new String[1], passLabel = new String[1];
@@ -638,11 +650,11 @@
     return XPCOM.NS_OK;
 }
 
-int PromptPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) {
+nsresult PromptPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
-int Select (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aCount, int /*long*/ aSelectList, int /*long*/ aOutSelection, int /*long*/ _retval) {
+nsresult Select (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aCount, int /*long*/ aSelectList, int /*long*/ aOutSelection, int /*long*/ _retval) {
     return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/mozilla/XPCOM.d	Sun Aug 10 22:25:43 2008 -0700
@@ -0,0 +1,169 @@
+/* ***** 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.XPCOM;
+
+import dwt.dwthelper.utils;
+
+//import dwt.internal.C;
+
+public class XPCOM {
+    public static final String MOZILLA_FIVE_HOME = "MOZILLA_FIVE_HOME"; //$NON-NLS-1$
+    public static final String MOZILLA_PLUGIN_PATH = "MOZ_PLUGIN_PATH"; //$NON-NLS-1$
+    public static final String CONTENT_MAYBETEXT = "application/x-vnd.mozilla.maybe-text"; //$NON-NLS-1$
+    public static final String CONTENT_MULTIPART = "multipart/x-mixed-replace"; //$NON-NLS-1$
+    public static final String DOMEVENT_FOCUS = "focus"; //$NON-NLS-1$
+    public static final String DOMEVENT_UNLOAD = "unload"; //$NON-NLS-1$
+    public static final String DOMEVENT_MOUSEDOWN = "mousedown"; //$NON-NLS-1$
+    public static final String DOMEVENT_MOUSEUP = "mouseup"; //$NON-NLS-1$
+    public static final String DOMEVENT_MOUSEMOVE = "mousemove"; //$NON-NLS-1$
+    public static final String DOMEVENT_MOUSEDRAG = "draggesture"; //$NON-NLS-1$
+    public static final String DOMEVENT_MOUSEWHEEL = "DOMMouseScroll"; //$NON-NLS-1$
+    public static final String DOMEVENT_MOUSEOVER = "mouseover"; //$NON-NLS-1$
+    public static final String DOMEVENT_MOUSEOUT = "mouseout"; //$NON-NLS-1$
+    public static final String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$
+    public static final String DOMEVENT_KEYDOWN = "keydown"; //$NON-NLS-1$
+    public static final String DOMEVENT_KEYPRESS = "keypress"; //$NON-NLS-1$
+    
+    /* CID constants */
+    public static final nsID NS_APPSHELL_CID =  new nsID("2d96b3df-c051-11d1-a827-0040959a28c9"); //$NON-NLS-1$
+    public static final nsID NS_CATEGORYMANAGER_CID = new nsID("16d222a6-1dd2-11b2-b693-f38b02c021b2"); //$NON-NLS-1$
+    public static final nsID NS_DOWNLOAD_CID = new nsID("e3fa9D0a-1dd1-11b2-bdef-8c720b597445"); //$NON-NLS-1$
+    public static final nsID NS_FILEPICKER_CID = new nsID("54ae32f8-1dd2-11b2-a209-df7c505370f8"); //$NON-NLS-1$
+    public static final nsID NS_HELPERAPPLAUNCHERDIALOG_CID = new nsID("f68578eb-6ec2-4169-ae19-8c6243f0abe1"); //$NON-NLS-1$
+    public static final nsID NS_INPUTSTREAMCHANNEL_CID = new nsID("6ddb050c-0d04-11d4-986e-00c04fa0cf4a"); //$NON-NLS-1$
+    public static final nsID NS_IOSERVICE_CID = new nsID("9ac9e770-18bc-11d3-9337-00104ba0fd40"); //$NON-NLS-1$
+    public static final nsID NS_LOADGROUP_CID = new nsID("e1c61582-2a84-11d3-8cce-0060b0fc14a3"); //$NON-NLS-1$
+    public static final nsID NS_PROMPTSERVICE_CID = new nsID("a2112d6a-0e28-421f-b46a-25c0b308cbd0"); //$NON-NLS-1$
+
+    public static final String NS_CONTEXTSTACK_CONTRACTID = "@mozilla.org/js/xpc/ContextStack;1"; //$NON-NLS-1$
+    public static final String NS_COOKIEMANAGER_CONTRACTID = "@mozilla.org/cookiemanager;1"; //$NON-NLS-1$
+    public static final String NS_DIRECTORYSERVICE_CONTRACTID = "@mozilla.org/file/directory_service;1"; //$NON-NLS-1$
+    public static final String NS_DOMSERIALIZER_CONTRACTID = "@mozilla.org/xmlextras/xmlserializer;1"; //$NON-NLS-1$
+    public static final String NS_DOWNLOAD_CONTRACTID = "@mozilla.org/download;1"; //$NON-NLS-1$
+    public static final String NS_FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1"; //$NON-NLS-1$
+    public static final String NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID = "@mozilla.org/helperapplauncherdialog;1"; //$NON-NLS-1$
+    public static final String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1"; //$NON-NLS-1$
+    public static final String NS_OBSERVER_CONTRACTID = "@mozilla.org/observer-service;1"; //$NON-NLS-1$
+    public static final String NS_PREFLOCALIZEDSTRING_CONTRACTID = "@mozilla.org/pref-localizedstring;1"; //$NON-NLS-1$
+    public static final String NS_PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1"; //$NON-NLS-1$
+    public static final String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; //$NON-NLS-1$
+    public static final String NS_TRANSFER_CONTRACTID = "@mozilla.org/transfer;1"; //$NON-NLS-1$
+    public static final String NS_WEBNAVIGATIONINFO_CONTRACTID = "@mozilla.org/webnavigation-info;1"; //$NON-NLS-1$
+    public static final String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$NON-NLS-1$
+
+    /* directory service constants */
+    public static final String NS_APP_APPLICATION_REGISTRY_DIR = "AppRegD"; //$NON-NLS-1$
+    public static final String NS_APP_CACHE_PARENT_DIR = "cachePDir"; //$NON-NLS-1$
+    public static final String NS_APP_HISTORY_50_FILE = "UHist"; //$NON-NLS-1$
+    public static final String NS_APP_LOCALSTORE_50_FILE = "LclSt"; //$NON-NLS-1$
+    public static final String NS_APP_PLUGINS_DIR_LIST = "APluginsDL"; //$NON-NLS-1$
+    public static final String NS_APP_PREF_DEFAULTS_50_DIR = "PrfDef"; //$NON-NLS-1$
+    public static final String NS_APP_PREFS_50_DIR = "PrefD"; //$NON-NLS-1$
+    public static final String NS_APP_PREFS_50_FILE = "PrefF"; //$NON-NLS-1$
+    public static final String NS_APP_USER_CHROME_DIR = "UChrm"; //$NON-NLS-1$
+    public static final String NS_APP_USER_MIMETYPES_50_FILE = "UMimTyp"; //$NON-NLS-1$
+    public static final String NS_APP_USER_PROFILE_50_DIR = "ProfD"; //$NON-NLS-1$
+    public static final String NS_GRE_COMPONENT_DIR = "GreComsD"; //$NON-NLS-1$
+    public static final String NS_GRE_DIR = "GreD"; //$NON-NLS-1$
+    public static final String NS_OS_CURRENT_PROCESS_DIR = "CurProcD"; //$NON-NLS-1$
+    public static final String NS_OS_HOME_DIR = "Home"; //$NON-NLS-1$
+    public static final String NS_OS_TEMP_DIR = "TmpD"; //$NON-NLS-1$
+    public static final String NS_XPCOM_COMPONENT_DIR = "ComsD"; //$NON-NLS-1$
+    public static final String NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD"; //$NON-NLS-1$
+    public static final String NS_XPCOM_INIT_CURRENT_PROCESS_DIR = "MozBinD"; //$NON-NLS-1$
+
+    /* XPCOM constants */
+    public static final int NS_OK =  0;
+    public static final int NS_COMFALSE = 1;
+    public static final int NS_BINDING_ABORTED = 0x804B0002;
+    public static final int NS_ERROR_BASE = 0xc1f30000;
+    public static final int NS_ERROR_NOT_INITIALIZED =  NS_ERROR_BASE + 1;
+    public static final int NS_ERROR_ALREADY_INITIALIZED = NS_ERROR_BASE + 2;
+    public static final int NS_ERROR_NOT_IMPLEMENTED =  0x80004001;
+    public static final int NS_NOINTERFACE =  0x80004002;
+    public static final int NS_ERROR_NO_INTERFACE =  NS_NOINTERFACE;
+    public static final int NS_ERROR_INVALID_POINTER =  0x80004003;
+    public static final int NS_ERROR_NULL_POINTER = NS_ERROR_INVALID_POINTER;
+    public static final int NS_ERROR_ABORT = 0x80004004;
+    public static final int NS_ERROR_FAILURE = 0x80004005;
+    public static final int NS_ERROR_UNEXPECTED = 0x8000ffff;
+    public static final int NS_ERROR_OUT_OF_MEMORY = 0x8007000e;
+    public static final int NS_ERROR_ILLEGAL_VALUE = 0x80070057;
+    public static final int NS_ERROR_INVALID_ARG = NS_ERROR_ILLEGAL_VALUE;
+    public static final int NS_ERROR_NO_AGGREGATION = 0x80040110;
+    public static final int NS_ERROR_NOT_AVAILABLE = 0x80040111;
+    public static final int NS_ERROR_FACTORY_NOT_REGISTERED = 0x80040154;
+    public static final int NS_ERROR_FACTORY_REGISTER_AGAIN = 0x80040155;
+    public static final int NS_ERROR_FACTORY_NOT_LOADED = 0x800401f8;
+    public static final int NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT = NS_ERROR_BASE + 0x101;
+    public static final int NS_ERROR_FACTORY_EXISTS = NS_ERROR_BASE + 0x100;
+    public static final int NS_ERROR_HTMLPARSER_UNRESOLVEDDTD = 0x804e03f3;
+    public static final int NS_ERROR_FILE_NOT_FOUND = 0x80520012;
+    public static final int NS_ERROR_FILE_UNRECOGNIZED_PATH = 0x80520001;
+
+    public static final nsresult NS_FAILED( nsresult result ) {
+        return result & 0x80000000;
+    }
+
+    public static final nsresult NS_SUCCEEDED( nsresult result ) {
+        return !(result & 0x80000000);
+    }
+
+    public static final PRUint32 strlen_PRUnichar ( PRUnichar* str )
+    {
+        PRUint32 len = 0;
+        if (str !is null) 
+            while (*(str++) != 0) len++;
+        ret len;
+    }
+
+//public static final native void memmove(nsID dest, int /*long*/ src, int nbytes);
+//public static final native void memmove(int /*long*/ dest, nsID src, int nbytes);
+public static final native int NS_GetComponentManager(int /*long*/[] result);
+public static final native int NS_GetServiceManager(int /*long*/[] result);
+public static final native int NS_InitXPCOM2(int /*long*/ result, int /*long*/ binDirectory, int /*long*/ appFileLocationProvider);
+public static final native int NS_NewLocalFile(int /*long*/ path, int followLinks, int /*long*/[] result);
+//public static final native int strlen_PRUnichar(int /*long*/ s);
+//public static final native int /*long*/ nsEmbedCString_new();
+//public static final native int /*long*/ nsEmbedCString_new(byte[] aString, int length);
+//public static final native int /*long*/ nsEmbedCString_new(int aString, int length);
+//public static final native void nsEmbedCString_delete(int /*long*/ ptr);
+//public static final native int nsEmbedCString_Length(int /*long*/ ptr);
+//public static final native int /*long*/ nsEmbedCString_get(int /*long*/ ptr);
+//public static final native void nsID_delete(int /*long*/ ptr);
+//public static final native int /*long*/ nsID_new();
+//public static final native int nsID_Equals(int /*long*/ ptr, int /*long*/ other);
+//public static final native int /*long*/ nsEmbedString_new();
+//public static final native int /*long*/ nsEmbedString_new(char[] aString);
+//public static final native void nsEmbedString_delete(int /*long*/ ptr);
+//public static final native int nsEmbedString_Length(int /*long*/ ptr);
+//public static final native int /*long*/ nsEmbedString_get(int /*long*/ ptr);
+public static final native int XPCOMGlueStartup(byte[] place);
+public static final native int XPCOMGlueShutdown();
+}
--- a/dwt/internal/mozilla/nsEmbedString2.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/internal/mozilla/nsEmbedString2.d	Sun Aug 10 22:25:43 2008 -0700
@@ -1,5 +1,7 @@
 module dwt.internal.mozilla.nsEmbedString;
 
+import Utf = tango.text.convert.Utf;
+
 import dwt.internal.mozilla.Common;
 import dwt.internal.mozilla.nsStringAPI;
 
@@ -34,6 +36,10 @@
 		return buffer[0 .. len].dup;
 	}
     
+    char[] toString()
+    {
+        return Utf.toString(this.toString16());
+    }
     ~this()
 	{
 		NS_StringContainerFinish(&str);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/mozilla/nsIAuthPromptCallback.d	Sun Aug 10 22:25:43 2008 -0700
@@ -0,0 +1,23 @@
+module dwt.internal.mozilla.nsIAuthPromptCallback;
+
+import dwt.internal.mozilla.Common;
+import dwt.internal.mozilla.nsID;
+import dwt.internal.mozilla.nsISupports;
+import dwt.internal.mozilla.nsIAuthInformation;
+
+const char[] NS_IAUTHPROMPTCALLBACK_IID_STR = "bdc387d7-2d29-4cac-92f1-dd75d786631d";
+
+const nsIID NS_IAUTHPROMPTCALLBACK_IID= 
+  {0xbdc387d7, 0x2d29, 0x4cac, 
+    [ 0x92, 0xf1, 0xdd, 0x75, 0xd7, 0x86, 0x63, 0x1d ]};
+
+extern(System)
+
+interface nsIAuthPromptCallback : nsISupports {
+
+  static const char[] IID_STR = NS_IAUTHPROMPTCALLBACK_IID_STR;
+  static const nsIID IID = NS_IAUTHPROMPTCALLBACK_IID;
+
+  nsresult OnAuthAvailable(nsISupports aContext, nsIAuthInformation aAuthInfo);
+  nsresult OnAuthCancelled(nsISupports aContext, PRBool userCancel);
+}
--- a/dwt/internal/mozilla/nsIDownload.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/internal/mozilla/nsIDownload.d	Sun Aug 10 22:25:43 2008 -0700
@@ -3,6 +3,7 @@
 import dwt.internal.mozilla.Common;
 import dwt.internal.mozilla.nsID;
 import dwt.internal.mozilla.nsITransfer;
+import dwt.internal.mozilla.nsIWebProgressListener;
 import dwt.internal.mozilla.nsIURI; 
 import dwt.internal.mozilla.nsILocalFile;
 import dwt.internal.mozilla.nsIObserver; 
@@ -22,17 +23,17 @@
   static const char[] IID_STR = NS_IDOWNLOAD_IID_STR;
   static const nsIID IID = NS_IDOWNLOAD_IID;
     
-  nsresult Init(nsIURI aSource, nsIURI aTarget, nsAString* aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, int /*long*/ aPersist);
+  nsresult Init(nsIURI aSource, nsIURI aTarget, nsAString* aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, PRBool aPersist);
   nsresult GetSource(nsIURI  *aSource);
   nsresult GetTarget(nsIURI  *aTarget);
-  nsresult GetPersist(int *aPersist);
+  nsresult GetPersist(PRBool *aPersist);
   nsresult GetPercentComplete(PRInt32 *aPercentComplete);
   nsresult GetDisplayName(PRUnichar * *aDisplayName);
-  nsresult SetDisplayName(char[] aDisplayName);
+  nsresult SetDisplayName(PRUnichar* aDisplayName);
   nsresult GetStartTime(PRInt64 *aStartTime);
   nsresult GetMIMEInfo(nsIMIMEInfo  *aMIMEInfo);
-  nsresult GetListener(int * aListener);
-  nsresult SetListener(int aListener);
-  nsresult GetObserver(int * aObserver);
-  nsresult SetObserver(int aObserver);
+  nsresult GetListener(nsIWebProgressListener* aListener);
+  nsresult SetListener(nsIWebProgressListener aListener);
+  nsresult GetObserver(nsIObserver * aObserver);
+  nsresult SetObserver(nsIObserver aObserver);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/mozilla/nsIHelperAppLauncher.d	Sun Aug 10 22:25:43 2008 -0700
@@ -0,0 +1,36 @@
+module dwt.internal.mozilla.nsIHelperAppLauncher;
+
+private import dwt.internal.mozilla.Common;
+private import dwt.internal.mozilla.nsID;
+private import dwt.internal.mozilla.nsISupports;
+private import dwt.internal.mozilla.nsIURI;
+private import dwt.internal.mozilla.nsIMIMEInfo;
+private import dwt.internal.mozilla.nsIFile;
+private import dwt.internal.mozilla.nsIWebProgressListener;
+private import dwt.internal.mozilla.nsStringAPI;
+private import dwt.internal.mozilla.prtime;
+
+const char[] NS_IHELPERAPPLAUNCHER_IID_STR = "9503d0fe-4c9d-11d4-98d0-001083010e9b";
+
+const nsIID NS_IHELPERAPPLAUNCHER_IID= 
+  {0x9503d0fe, 0x4c9d, 0x11d4, 
+    [ 0x98, 0xd0, 0x00, 0x10, 0x83, 0x01, 0x0e, 0x9b ]};
+
+extern(System)
+
+interface nsIHelperAppLauncher : nsISupports {
+
+  static const char[] IID_STR = NS_IHELPERAPPLAUNCHER_IID_STR;
+  static const nsIID IID = NS_IHELPERAPPLAUNCHER_IID;
+
+  nsresult GetMIMEInfo(nsIMIMEInfo  *aMIMEInfo);
+  nsresult GetSource(nsIURI  *aSource);
+  nsresult GetSuggestedFileName(nsAString * aSuggestedFileName);
+  nsresult SaveToDisk(nsIFile aNewFileLocation, PRBool aRememberThisPreference);
+  nsresult LaunchWithApplication(nsIFile aApplication, PRBool aRememberThisPreference);
+  nsresult Cancel();
+  nsresult SetWebProgressListener(nsIWebProgressListener aWebProgressListener);
+  nsresult CloseProgressWindow();
+  nsresult GetDownloadInfo( nsIURI* aSourceUrl, PRTime* aTimeDownloadStarted, nsIFile* result)
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/mozilla/nsIHelperAppLauncher_1_8.d	Sun Aug 10 22:25:43 2008 -0700
@@ -0,0 +1,36 @@
+module dwt.internal.mozilla.nsIHelperAppLauncher_1_8;
+
+private import dwt.internal.mozilla.Common;
+private import dwt.internal.mozilla.nsID;
+private import dwt.internal.mozilla.nsICancelable;
+private import dwt.internal.mozilla.nsIURI;
+private import dwt.internal.mozilla.nsIMIMEInfo;
+private import dwt.internal.mozilla.nsIFile;
+private import dwt.internal.mozilla.nsIWebProgressListener2;
+private import dwt.internal.mozilla.nsStringAPI;
+private import dwt.internal.mozilla.prtime;
+
+const char[] NS_IHELPERAPPLAUNCHER_1_8_IID_STR = "99a0882d-2ff9-4659-9952-9ac531ba5592";
+
+const nsIID NS_IHELPERAPPLAUNCHER_1_8_IID= 
+  {0x99a0882d, 0x2ff9, 0x4659, 
+    [ 0x99, 0x52, 0x9a, 0xc5, 0x31, 0xba, 0x55, 0x92 ]};
+
+extern(System)
+
+interface nsIHelperAppLauncher_1_8 : nsICancelable {
+
+  static const char[] IID_STR = NS_IHELPERAPPLAUNCHER_1_8_IID_STR;
+  static const nsIID IID = NS_IHELPERAPPLAUNCHER_1_8_IID;
+
+  nsresult GetMIMEInfo(nsIMIMEInfo  *aMIMEInfo);
+  nsresult GetSource(nsIURI  *aSource);
+  nsresult GetSuggestedFileName(nsAString * aSuggestedFileName);
+  nsresult SaveToDisk(nsIFile aNewFileLocation, PRBool aRememberThisPreference);
+  nsresult LaunchWithApplication(nsIFile aApplication, PRBool aRememberThisPreference);
+  nsresult SetWebProgressListener(nsIWebProgressListener2 aWebProgressListener);
+  nsresult CloseProgressWindow();
+  nsresult GetTargetFile(nsIFile  *aTargetFile);
+  nsresult GetTimeDownloadStarted(PRTime *aTimeDownloadStarted);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/mozilla/nsIHelperAppLauncher_1_9.d	Sun Aug 10 22:25:43 2008 -0700
@@ -0,0 +1,36 @@
+module dwt.internal.mozilla.nsIHelperAppLauncher_1_9;
+
+private import dwt.internal.mozilla.Common;
+private import dwt.internal.mozilla.nsID;
+private import dwt.internal.mozilla.nsICancelable;
+private import dwt.internal.mozilla.nsIURI;
+private import dwt.internal.mozilla.nsIMIMEInfo;
+private import dwt.internal.mozilla.nsIFile;
+private import dwt.internal.mozilla.nsIWebProgressListener2;
+private import dwt.internal.mozilla.nsStringAPI;
+private import dwt.internal.mozilla.prtime;
+
+const char[] NS_IHELPERAPPLAUNCHER_1_9_IID_STR = "cc75c21a-0a79-4f68-90e1-563253d0c555";
+
+const nsIID NS_IHELPERAPPLAUNCHER_1_9_IID= 
+  {0xcc75c21a, 0x0a79, 0x4f68, 
+    [ 0x90, 0xe1, 0x56, 0x32, 0x53, 0xd0, 0xc5, 0x55 ]};
+
+extern(System)
+
+interface nsIHelperAppLauncher_1_9 : nsICancelable {
+
+  static const char[] IID_STR = NS_IHELPERAPPLAUNCHER_1_9_IID_STR;
+  static const nsIID IID = NS_IHELPERAPPLAUNCHER_1_9_IID;
+
+  nsresult GetMIMEInfo(nsIMIMEInfo  *aMIMEInfo);
+  nsresult GetSource(nsIURI *aSource);
+  nsresult GetSuggestedFileName(nsAString * aSuggestedFileName);
+  nsresult SaveToDisk(nsIFile aNewFileLocation, PRBool aRememberThisPreference);
+  nsresult LaunchWithApplication(nsIFile aApplication, PRBool aRememberThisPreference);
+  nsresult SetWebProgressListener(nsIWebProgressListener2 aWebProgressListener);
+  nsresult CloseProgressWindow();
+  nsresult GetTargetFile(nsIFile *aTargetFile);
+  nsresult GetTargetFileIsExecutable(PRBool* aTargetFileIsExecutable)
+  nsresult GetTimeDownloadStarted(PRTime *aTimeDownloadStarted);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/mozilla/nsIPromptService2.d	Sun Aug 10 22:25:43 2008 -0700
@@ -0,0 +1,28 @@
+module dwt.internal.mozilla.nsIPromptService2;
+
+import dwt.internal.mozilla.Common;
+import dwt.internal.mozilla.nsID;
+import dwt.internal.mozilla.nsISupports;
+import dwt.internal.mozilla.nsIChannel;
+import dwt.internal.mozilla.nsIAuthInformation;
+
+import dwt.internal.mozilla.nsIDOMWindow;
+
+const char[] NS_IPROMPTSERVICE2_IID_STR = "cf86d196-dbee-4482-9dfa-3477aa128319";
+
+const nsIID NS_IPROMPTSERVICE2_IID= 
+  {0xcf86d196, 0xdbee, 0x4482, 
+    [ 0x9d, 0xfa, 0x34, 0x77, 0xaa, 0x12, 0x83, 0x19 ]};
+
+extern(System)
+
+interface nsIPromptService2 : nsIPromptService {
+
+  static const char[] IID_STR = NS_IPROMPTSERVICE2_IID_STR;
+  static const nsIID IID = NS_IPROMPTSERVICE2_IID;
+
+    public int PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, PRUint32 level, nsIAuthInformation authInfo, PRUnichar* checkboxLabel, PRBool* checkValue, PRBool* _retval);
+
+    public int AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, PRUint32 level, nsIAuthInformation authInfo, PRUnichar* checkboxLabel, PRBool* checkValue, nsICancelable* _retval);
+
+}
--- a/dwt/internal/mozilla/nsStringAPI.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/internal/mozilla/nsStringAPI.d	Sun Aug 10 22:25:43 2008 -0700
@@ -73,14 +73,14 @@
 
 struct nsAString
 {
-  static nsAString opCall(wchar[] s)
-  {
-    nsAString result;
-    NS_StringSetData(&result, cast(PRUnichar*)s, uint.max);
-    return result;
-  }
+    static nsAString opCall(wchar[] s)
+    {
+        nsAString result;
+        NS_StringSetData(&result, cast(PRUnichar*)s, uint.max);
+        return result;
+    }
 
-  static wchar[] getString16( nsAString* str )
+    static wchar[] toString16( nsAString* str )
     {
         wchar* buffer = null;
 		PRBool terminated;
@@ -88,7 +88,12 @@
 		return buffer[0 .. len].dup;
     }
     
-  private:
+    static char[] toString( nsAString* str )
+    {
+        return Utf.toString( nsAString.toString16( str ) );
+    }
+  
+    private:
     void *v;
 }
 
@@ -181,15 +186,3 @@
 
 struct nsDependentSubstring_external{}
 struct nsDependentCSubstring_external{}
-
-/******************************************************************************
-
-******************************************************************************/
-
-PRUint32 strlen_PRUnichar ( PRUnichar* str )
-{
-    PRUint32 len = 0;
-    if (str !is null) 
-        while (*(lparg0++) != 0) len++;
-    ret len;
-}
\ No newline at end of file