changeset 340:3f4a5c7d138f

Fixes
author John Reimer <terminal.node@gmail.com>
date Sun, 26 Oct 2008 08:09:00 -0700
parents c317081df76f
children 942da4b6558a
files dwt/browser/AppFileLocProvider.d dwt/browser/Browser.d dwt/browser/CloseWindowListener.d dwt/browser/LocationEvent.d dwt/browser/Mozilla.d dwt/browser/MozillaDelegate.d dwt/browser/ProgressEvent.d dwt/browser/StatusTextEvent.d dwt/browser/TitleEvent.d dwt/browser/WebBrowser.d dwt/browser/WindowCreator2.d dwt/browser/WindowEvent.d dwt/internal/mozilla/XPCOM.d dwt/internal/mozilla/XPCOMInit.d dwt/internal/mozilla/nsEmbedString.d dwt/internal/mozilla/nsEmbedString2.d dwt/internal/mozilla/nsID.d dwt/internal/mozilla/nsIDOMSerializer_1_7.d dwt/internal/mozilla/nsIDocShell.d dwt/internal/mozilla/nsStringAPI.d dwt/internal/mozilla/nsXPCOM.d
diffstat 21 files changed, 560 insertions(+), 615 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/browser/AppFileLocProvider.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/AppFileLocProvider.d	Sun Oct 26 08:09:00 2008 -0700
@@ -16,17 +16,21 @@
 import tango.text.Util;
 
 import dwt.dwthelper.utils;
+import dwt.browser.Mozilla;
 
 import dwt.internal.Compatibility;
-import dwt.internal.mozilla.XPCOM;
-import dwt.internal.mozilla.XPCOMObject;
+
+import XPCOM = dwt.internal.mozilla.XPCOM;
+
+import dwt.internal.mozilla.Common;
+import dwt.internal.mozilla.nsISimpleEnumerator;
 import dwt.internal.mozilla.nsEmbedString;
 import dwt.internal.mozilla.nsID;
-import dwt.internal.mozilla.nsIDirectoryServiceProvider;
-import dwt.internal.mozilla.nsIDirectoryServiceProvider2;
+import dwt.internal.mozilla.nsIDirectoryService;
 import dwt.internal.mozilla.nsIFile;
 import dwt.internal.mozilla.nsILocalFile;
 import dwt.internal.mozilla.nsISupports;
+import dwt.internal.mozilla.nsStringAPI;
 
 class AppFileLocProvider : nsIDirectoryServiceProvider2 { 
     int refCount = 0;
@@ -53,10 +57,10 @@
     return refCount;
 }
 
-nsresult QueryInterface (nsID* riid, int 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)) {
+    if (*riid == nsISupports.IID) {
         *ppvObject = cast(void*)cast(nsISupports)this;
         AddRef ();
         return XPCOM.NS_OK;
@@ -86,7 +90,7 @@
     profilePath = path;
     if (!Compatibility.fileExists (path, "")) { //$NON-NLS-1$
         nsILocalFile result;
-        scope auto nsEmbedString pathString = new nsEmbedString (path);
+        scope auto nsEmbedString pathString = new nsEmbedString (toString16(path));
         int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &result);
         if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
         if (result is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
@@ -100,7 +104,7 @@
 /* nsIDirectoryServiceProvider2 */
 
 nsresult GetFiles (char* prop, nsISimpleEnumerator* _retval) {
-    String propertyName = tango.stdc.stringz.fromStringz( prop );
+    String propertyName = prop.fromStringz;
     String[] propertyValues = null;
 
     if (propertyName == XPCOM.NS_APP_PLUGINS_DIR_LIST) {
@@ -230,7 +234,7 @@
         if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
         
         nsIFile file;
-        rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&file)); 
+        rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&file); 
         if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
         if (file is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
 
--- a/dwt/browser/Browser.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/Browser.d	Sun Oct 26 08:09:00 2008 -0700
@@ -21,6 +21,15 @@
 import dwt.widgets.Display;
 import dwt.widgets.Widget;
 
+import dwt.browser.Mozilla;
+import dwt.browser.WebBrowser;
+import dwt.browser.CloseWindowListener;
+import dwt.browser.LocationListener;
+import dwt.browser.OpenWindowListener;
+import dwt.browser.ProgressListener;
+import dwt.browser.StatusTextListener;
+import dwt.browser.TitleListener;
+import dwt.browser.VisibilityWindowListener;
 /**
  * Instances of this class implement the browser user interface
  * metaphor.  It allows the user to visualize and navigate through
--- a/dwt/browser/CloseWindowListener.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/CloseWindowListener.d	Sun Oct 26 08:09:00 2008 -0700
@@ -13,6 +13,7 @@
 module dwt.browser.CloseWindowListener;
 
 import dwt.internal.DWTEventListener;
+import dwt.browser.WindowEvent;
 
 /**
  * This listener interface may be implemented in order to receive
--- a/dwt/browser/LocationEvent.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/LocationEvent.d	Sun Oct 26 08:09:00 2008 -0700
@@ -16,6 +16,7 @@
 
 import dwt.events.TypedEvent;
 import dwt.widgets.Widget;
+import dwt.dwthelper.utils;
 
 /**
  * A <code>LocationEvent</code> is sent by a {@link Browser} to
--- a/dwt/browser/Mozilla.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/Mozilla.d	Sun Oct 26 08:09:00 2008 -0700
@@ -23,6 +23,7 @@
 //import java.util.Vector;
 
 import tango.text.locale.Core;  // Necessary for Region/Culture/Locale code
+import dwt.internal.c.gtk;
 
 import dwt.DWT;
 import dwt.DWTError;
@@ -30,12 +31,17 @@
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
 
+import dwt.browser.MozillaDelegate;
+import dwt.browser.AppFileLocProvider;
+import dwt.browser.WindowCreator2;
+
 import dwt.internal.Compatibility;
 import dwt.internal.LONG;
 import dwt.internal.Library;
 
 import dwt.internal.mozilla.XPCOM;
 import dwt.internal.mozilla.XPCOMInit;
+import dwt.internal.mozilla.Common;
 
 import dwt.internal.mozilla.nsEmbedString;
 import dwt.internal.mozilla.nsIAppShell;
@@ -48,6 +54,7 @@
 import dwt.internal.mozilla.nsICookieManager;
 import dwt.internal.mozilla.nsID;
 import dwt.internal.mozilla.nsIDOMEvent;
+import dwt.internal.mozilla.nsIDOMEventListener;
 import dwt.internal.mozilla.nsIDOMEventTarget;
 import dwt.internal.mozilla.nsIDOMKeyEvent;
 import dwt.internal.mozilla.nsIDOMMouseEvent;
@@ -57,8 +64,8 @@
 import dwt.internal.mozilla.nsIDOMWindowCollection;
 import dwt.internal.mozilla.nsIDirectoryService;
 import dwt.internal.mozilla.nsIDocShell;
-import dwt.internal.mozilla.nsIDocShell_1_8;
-import dwt.internal.mozilla.nsIDocShell_1_9;
+//import dwt.internal.mozilla.nsIDocShell_1_8;
+//import dwt.internal.mozilla.nsIDocShell_1_9;
 import dwt.internal.mozilla.nsIEmbeddingSiteWindow;
 import dwt.internal.mozilla.nsIFile;
 import dwt.internal.mozilla.nsIIOService;
@@ -74,7 +81,7 @@
 import dwt.internal.mozilla.nsIServiceManager;
 import dwt.internal.mozilla.nsISimpleEnumerator;
 import dwt.internal.mozilla.nsISupports;
-import dwt.internal.mozilla.nsISupportsWeakReference;
+//import dwt.internal.mozilla.nsISupportsWeakReference;
 import dwt.internal.mozilla.nsITooltipListener;
 import dwt.internal.mozilla.nsIURI;
 import dwt.internal.mozilla.nsIURIContentListener;
@@ -96,6 +103,7 @@
 import dwt.widgets.Listener;
 import dwt.widgets.Menu;
 import dwt.widgets.Shell;
+import dwt.browser.WebBrowser;
 
 class Mozilla : WebBrowser, 
                 nsIWeakReference, 
@@ -106,9 +114,9 @@
                 nsIInterfaceRequestor, 
                 nsISupportsWeakReference, 
                 nsIContextMenuListener, 
-                nsIUriContextListener,
+                nsIURIContentListener,
                 nsITooltipListener, 
-                nsIDomEventListener {
+                nsIDOMEventListener {
                     
     GtkWidget* embedHandle;
     nsIWebBrowser webBrowser;
@@ -183,7 +191,7 @@
     static final String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$
 
     static this () {
-        MozillaClearSessions = new Runnable () {
+        MozillaClearSessions = new class() Runnable {
             public void run () {
                 if (!Initialized) return;
                 nsIServiceManager serviceManager;
@@ -251,7 +259,7 @@
         bool IsXULRunner = false;
 
         String greInitialized = System.getProperty (GRE_INITIALIZED); 
-        if ("true" == greInitialized)) { //$NON-NLS-1$
+        if ("true" == greInitialized) { //$NON-NLS-1$
             /* 
              * Another browser has already initialized xulrunner in this process,
              * so just bind to it instead of trying to initialize a new one.
@@ -888,7 +896,7 @@
             //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true);
             rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString);
             if (rc !is XPCOM.NS_OK) error (rc);
-            if (localizedString] is null) error (XPCOM.NS_NOINTERFACE);
+            if (localizedString is null) error (XPCOM.NS_NOINTERFACE);
 
             //localizedString = new nsIPrefLocalizedString (result[0]);
             //result[0] = 0;
@@ -1030,7 +1038,7 @@
 
     if (display.getData (DISPOSE_LISTENER_HOOKED) is null) {
         display.setData (DISPOSE_LISTENER_HOOKED, DISPOSE_LISTENER_HOOKED);
-        display.addListener (DWT.Dispose, new Listener () {
+        display.addListener (DWT.Dispose, new class() Listener {
             public void handleEvent (Event event) {
                 if (BrowserCount > 0) return; /* another display is still active */
 
@@ -1159,7 +1167,7 @@
         browser.dispose ();
         error (rc);
     }
-    if (baseWindow] is null) {
+    if (baseWindow is null) {
         browser.dispose ();
         error (XPCOM.NS_ERROR_NO_INTERFACE);
     }
@@ -1313,9 +1321,9 @@
     this.QueryInterface(&nsIUriContentListener.IID, cast(void**)&uriContentListener);
     if (rc !is XPCOM.NS_OK) {
         browser.dispose();
-        error(rc)
+        error(rc);
     }
-    if (uriContentListener is null)
+    if (uriContentListener is null) {
         browser.dispose();
         error(XPCOM.NS_ERROR_NO_INTERFACE);
     }
@@ -1328,7 +1336,7 @@
 
     mozDelegate.init ();
 
-    listener = new Listener () {
+    listener = new class () Listener {
         public void handleEvent (Event event) {
             switch (event.type) {
                 case DWT.Dispose: {
@@ -1348,7 +1356,7 @@
                 case DWT.Activate: Activate (); break;
                 case DWT.Deactivate: {
                     Display display = event.display;
-                    if (Mozilla.this.browser is display.getFocusControl ()) Deactivate ();
+                    if (this.browser is display.getFocusControl ()) Deactivate ();
                     break;
                 }
                 case DWT.Show: {
@@ -1359,7 +1367,7 @@
                     * its size after the container has been made visible. 
                     */
                     Display display = event.display;
-                    display.asyncExec(new Runnable () {
+                    display.asyncExec(new class () Runnable {
                         public void run() {
                             if (browser.isDisposed ()) return;
                             onResize ();
@@ -1369,8 +1377,8 @@
                 }
             }
         }
-    };  
-    int[] folderEvents = new int[] {
+    };
+    int[] folderEvents = [
         DWT.Dispose,
         DWT.Resize,  
         DWT.FocusIn,
@@ -1378,7 +1386,7 @@
         DWT.Deactivate,
         DWT.Show,
         DWT.KeyDown     // needed to make browser traversable
-    };
+    ];
     for (int i = 0; i < folderEvents.length; i++) {
         browser.addListener (folderEvents[i], listener);
     }
@@ -2028,7 +2036,7 @@
     target.RemoveEventListener (cast(nsAString*)string, domEventListener, 0);
     //string.dispose ();
     string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP);
-    target.RemoveEventListener (cast(nsAString*)string, domEventListener., 0);
+    target.RemoveEventListener (cast(nsAString*)string, domEventListener, 0);
     //string.dispose ();
 }
 
@@ -2087,7 +2095,7 @@
         AddRef ();
         return XPCOM.NS_OK;
     }
-    if (*riid == nsITooltipListener.IID)) {
+    if (*riid == nsITooltipListener.IID) {
         *ppvObject = cast(void*)cast(nsITooltipListener)this;
         AddRef ();
         return XPCOM.NS_OK;
@@ -2251,9 +2259,9 @@
 
         //LONG ptrObject = new LONG (result[0]);
         //result[0] = 0;
-        int index = unhookedDOMWindows.arrayIndexOf (domWindow);
+        int index = unhookedDOMWindows.arrayIndexOf ( domWindow);
         if (index !is -1) {
-            nsIDOMWindow contentWindow
+            nsIDOMWindow contentWindow;
             rc = webBrowser.GetContentDOMWindow (&contentWindow);
             if (rc !is XPCOM.NS_OK) error (rc);
             if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE);
@@ -2274,7 +2282,7 @@
             * Remove and unreference the nsIDOMWindow from the collection of windows
             * that are waiting to have DOM listeners hooked on them. 
             */
-            unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove (domWindow);
+            unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove( domWindow);
             domWIndow.Release ();
         }
         domWindow.Release ();
@@ -2645,7 +2653,7 @@
     * with the Mozilla application TestGtkEmbed.  The workaround is to
     * send the traversal notification after this callback returns.
     */
-    browser.getDisplay ().asyncExec (new Runnable () {
+    browser.getDisplay ().asyncExec (new class() Runnable {
         public void run () {
             if (browser.isDisposed ()) return;
             browser.traverse (DWT.TRAVERSE_TAB_NEXT);
@@ -2661,7 +2669,7 @@
     * with the Mozilla application TestGtkEmbed.  The workaround is to
     * send the traversal notification after this callback returns.
     */
-    browser.getDisplay ().asyncExec (new Runnable () {
+    browser.getDisplay ().asyncExec (new class() Runnable {
         public void run () {
             if (browser.isDisposed ()) return;
             browser.traverse (DWT.TRAVERSE_TAB_PREVIOUS);
--- a/dwt/browser/MozillaDelegate.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/MozillaDelegate.d	Sun Oct 26 08:09:00 2008 -0700
@@ -15,15 +15,19 @@
 import dwt.dwthelper.utils;
 
 import dwt.DWT;
-import dwt.internal.Callback;
+//import dwt.internal.Callback;
 import dwt.internal.Converter;
-import dwt.internal.gtk.GdkEvent;
+//import dwt.internal.gtk.GdkEvent;
 import dwt.internal.gtk.OS;
 import dwt.widgets.Display;
 import dwt.widgets.Event;
 import dwt.widgets.Listener;
 import dwt.widgets.Widget;
 
+import dwt.browser.Browser;
+
+import dwt.internal.c.glib_object;
+
 class MozillaDelegate {
     Browser browser;
     gpointer mozillaHandle;
@@ -35,7 +39,7 @@
     static const gpointer STOP_PROPOGATE = cast(gpointer)1;
 
     static bool IsLinux;
-    static this {
+    static this () {
         String osName = System.getProperty ("os.name"); //$NON-NLS-1$
         IsLinux = tango.text.Util.containsPattern(osName, "linux"); //$NON-NLS-1$
     }
@@ -54,7 +58,7 @@
     parent = OS.gtk_widget_get_parent (parent);
     if (parent is null) return 0;
     Widget widget = Display.getCurrent ().findWidget (parent);
-    if (widget !is null && (cast(Browser)widget !is null) {
+    if (widget !is null && (cast(Browser)widget) !is null) {
         return (cast(Mozilla)(cast(Browser)widget).webBrowser).mozDelegate.gtk_event (handle, gdkEvent, pointer);
     }
     return 0;
@@ -121,7 +125,7 @@
 void handleFocus () {
     if (hasFocus) return;
     hasFocus = true;
-    listener = new Listener () {
+    listener = new class() Listener {
         public void handleEvent (Event event) {
             if (event.widget is browser) return;
             (cast(Mozilla)(browser.webBrowser)).Deactivate ();
@@ -138,7 +142,7 @@
 void handleMouseDown () {
     int shellStyle = browser.getShell ().getStyle (); 
     if ((shellStyle & DWT.ON_TOP) !is 0 && (((shellStyle & DWT.NO_FOCUS) is 0) || ((browser.getStyle () & DWT.NO_FOCUS) is 0))) {
-        browser.getDisplay ().asyncExec (new Runnable () {
+        browser.getDisplay ().asyncExec (new class() Runnable {
             public void run () {
                 if (browser is null || browser.isDisposed ()) return;
                 (cast(Mozilla)(browser.webBrowser)).Activate ();
--- a/dwt/browser/ProgressEvent.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/ProgressEvent.d	Sun Oct 26 08:09:00 2008 -0700
@@ -14,6 +14,8 @@
 
 import tango.text.convert.Format;
 
+import dwt.dwthelper.utils;
+
 import dwt.events.TypedEvent;
 import dwt.widgets.Widget;
 
--- a/dwt/browser/StatusTextEvent.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/StatusTextEvent.d	Sun Oct 26 08:09:00 2008 -0700
@@ -12,7 +12,7 @@
  *******************************************************************************/
 module dwt.browser.StatusTextEvent;
 
-//import dwt.dwthelper.utils;
+import dwt.dwthelper.utils;
 
 import dwt.events.TypedEvent;
 import dwt.widgets.Widget;
--- a/dwt/browser/TitleEvent.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/TitleEvent.d	Sun Oct 26 08:09:00 2008 -0700
@@ -12,7 +12,7 @@
  *******************************************************************************/
 module dwt.browser.TitleEvent;
 
-//import dwt.dwthelper.utils;
+import dwt.dwthelper.utils;
 
 import dwt.events.TypedEvent;
 import dwt.widgets.Widget;
--- a/dwt/browser/WebBrowser.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/WebBrowser.d	Sun Oct 26 08:09:00 2008 -0700
@@ -17,6 +17,15 @@
 import dwt.DWT;
 import dwt.widgets.Composite;
 
+import dwt.browser.Browser;
+import dwt.browser.CloseWindowListener;
+import dwt.browser.LocationListener;
+import dwt.browser.OpenWindowListener;
+import dwt.browser.ProgressListener;
+import dwt.browser.StatusTextListener;
+import dwt.browser.TitleListener;
+import dwt.browser.VisibilityWindowListener;
+
 abstract class WebBrowser {
     Browser browser;
     CloseWindowListener[] closeWindowListeners;
@@ -31,188 +40,188 @@
     static Runnable NativeClearSessions;
 
     /* Key Mappings */
-    static final int [][] KeyTable = {
+    static final int [][] KeyTable = [
         /* Keyboard and Mouse Masks */
-        {18,    DWT.ALT},
-        {16,    DWT.SHIFT},
-        {17,    DWT.CONTROL},
-        {224,   DWT.COMMAND},
+        [18,    DWT.ALT],
+        [16,    DWT.SHIFT],
+        [17,    DWT.CONTROL],
+        [224,   DWT.COMMAND],
 
         /* Literal Keys */
-        {65,    'a'},
-        {66,    'b'},
-        {67,    'c'},
-        {68,    'd'},
-        {69,    'e'},
-        {70,    'f'},
-        {71,    'g'},
-        {72,    'h'},
-        {73,    'i'},
-        {74,    'j'},
-        {75,    'k'},
-        {76,    'l'},
-        {77,    'm'},
-        {78,    'n'},
-        {79,    'o'},
-        {80,    'p'},
-        {81,    'q'},
-        {82,    'r'},
-        {83,    's'},
-        {84,    't'},
-        {85,    'u'},
-        {86,    'v'},
-        {87,    'w'},
-        {88,    'x'},
-        {89,    'y'},
-        {90,    'z'},
-        {48,    '0'},
-        {49,    '1'},
-        {50,    '2'},
-        {51,    '3'},
-        {52,    '4'},
-        {53,    '5'},
-        {54,    '6'},
-        {55,    '7'},
-        {56,    '8'},
-        {57,    '9'},
-        {32,    ' '},
-        {59,    ';'},
-        {61,    '='},
-        {188,   ','},
-        {190,   '.'},
-        {191,   '/'},
-        {219,   '['},
-        {221,   ']'},
-        {222,   '\''},
-        {192,   '`'},
-        {220,   '\\'},
-        {108,   '|'},
+        [65,    'a'],
+        [66,    'b'],
+        [67,    'c'],
+        [68,    'd'],
+        [69,    'e'],
+        [70,    'f'],
+        [71,    'g'],
+        [72,    'h'],
+        [73,    'i'],
+        [74,    'j'],
+        [75,    'k'],
+        [76,    'l'],
+        [77,    'm'],
+        [78,    'n'],
+        [79,    'o'],
+        [80,    'p'],
+        [81,    'q'],
+        [82,    'r'],
+        [83,    's'],
+        [84,    't'],
+        [85,    'u'],
+        [86,    'v'],
+        [87,    'w'],
+        [88,    'x'],
+        [89,    'y'],
+        [90,    'z'],
+        [48,    '0'],
+        [49,    '1'],
+        [50,    '2'],
+        [51,    '3'],
+        [52,    '4'],
+        [53,    '5'],
+        [54,    '6'],
+        [55,    '7'],
+        [56,    '8'],
+        [57,    '9'],
+        [32,    ' '],
+        [59,    ';'],
+        [61,    '='],
+        [188,   ','],
+        [190,   '.'],
+        [191,   '/'],
+        [219,   '['],
+        [221,   ']'],
+        [222,   '\''],
+        [192,   '`'],
+        [220,   '\\'],
+        [108,   '|'],
 
         /* Non-Numeric Keypad Keys */
-        {37,    DWT.ARROW_LEFT},
-        {39,    DWT.ARROW_RIGHT},
-        {38,    DWT.ARROW_UP},
-        {40,    DWT.ARROW_DOWN},
-        {45,    DWT.INSERT},
-        {36,    DWT.HOME},
-        {35,    DWT.END},
-        {46,    DWT.DEL},
-        {33,    DWT.PAGE_UP},
-        {34,    DWT.PAGE_DOWN},
+        [37,    DWT.ARROW_LEFT],
+        [39,    DWT.ARROW_RIGHT],
+        [38,    DWT.ARROW_UP],
+        [40,    DWT.ARROW_DOWN],
+        [45,    DWT.INSERT],
+        [36,    DWT.HOME],
+        [35,    DWT.END],
+        [46,    DWT.DEL],
+        [33,    DWT.PAGE_UP],
+        [34,    DWT.PAGE_DOWN],
 
         /* Virtual and Ascii Keys */
-        {8,     DWT.BS},
-        {13,    DWT.CR},
-        {9,     DWT.TAB},
-        {27,    DWT.ESC},
-        {12,    DWT.DEL},
+        [8,     DWT.BS],
+        [13,    DWT.CR],
+        [9,     DWT.TAB],
+        [27,    DWT.ESC],
+        [12,    DWT.DEL],
 
         /* Functions Keys */
-        {112,   DWT.F1},
-        {113,   DWT.F2},
-        {114,   DWT.F3},
-        {115,   DWT.F4},
-        {116,   DWT.F5},
-        {117,   DWT.F6},
-        {118,   DWT.F7},
-        {119,   DWT.F8},
-        {120,   DWT.F9},
-        {121,   DWT.F10},
-        {122,   DWT.F11},
-        {123,   DWT.F12},
-        {124,   DWT.F13},
-        {125,   DWT.F14},
-        {126,   DWT.F15},
-        {127,   0},
-        {128,   0},
-        {129,   0},
-        {130,   0},
-        {131,   0},
-        {132,   0},
-        {133,   0},
-        {134,   0},
-        {135,   0},
+        [112,   DWT.F1],
+        [113,   DWT.F2],
+        [114,   DWT.F3],
+        [115,   DWT.F4],
+        [116,   DWT.F5],
+        [117,   DWT.F6],
+        [118,   DWT.F7],
+        [119,   DWT.F8],
+        [120,   DWT.F9],
+        [121,   DWT.F10],
+        [122,   DWT.F11],
+        [123,   DWT.F12],
+        [124,   DWT.F13],
+        [125,   DWT.F14],
+        [126,   DWT.F15],
+        [127,   0],
+        [128,   0],
+        [129,   0],
+        [130,   0],
+        [131,   0],
+        [132,   0],
+        [133,   0],
+        [134,   0],
+        [135,   0],
 
         /* Numeric Keypad Keys */
-        {96,    DWT.KEYPAD_0},
-        {97,    DWT.KEYPAD_1},
-        {98,    DWT.KEYPAD_2},
-        {99,    DWT.KEYPAD_3},
-        {100,   DWT.KEYPAD_4},
-        {101,   DWT.KEYPAD_5},
-        {102,   DWT.KEYPAD_6},
-        {103,   DWT.KEYPAD_7},
-        {104,   DWT.KEYPAD_8},
-        {105,   DWT.KEYPAD_9},
-        {14,    DWT.KEYPAD_CR},
-        {107,   DWT.KEYPAD_ADD},
-        {109,   DWT.KEYPAD_SUBTRACT},
-        {106,   DWT.KEYPAD_MULTIPLY},
-        {111,   DWT.KEYPAD_DIVIDE},
-        {110,   DWT.KEYPAD_DECIMAL},
+        [96,    DWT.KEYPAD_0],
+        [97,    DWT.KEYPAD_1],
+        [98,    DWT.KEYPAD_2],
+        [99,    DWT.KEYPAD_3],
+        [100,   DWT.KEYPAD_4],
+        [101,   DWT.KEYPAD_5],
+        [102,   DWT.KEYPAD_6],
+        [103,   DWT.KEYPAD_7],
+        [104,   DWT.KEYPAD_8],
+        [105,   DWT.KEYPAD_9],
+        [14,    DWT.KEYPAD_CR],
+        [107,   DWT.KEYPAD_ADD],
+        [109,   DWT.KEYPAD_SUBTRACT],
+        [106,   DWT.KEYPAD_MULTIPLY],
+        [111,   DWT.KEYPAD_DIVIDE],
+        [110,   DWT.KEYPAD_DECIMAL],
 
         /* Other keys */
-        {20,    DWT.CAPS_LOCK},
-        {144,   DWT.NUM_LOCK},
-        {145,   DWT.SCROLL_LOCK},
-        {44,    DWT.PRINT_SCREEN},
-        {6,     DWT.HELP},
-        {19,    DWT.PAUSE},
-        {3,     DWT.BREAK},
+        [20,    DWT.CAPS_LOCK],
+        [144,   DWT.NUM_LOCK],
+        [145,   DWT.SCROLL_LOCK],
+        [44,    DWT.PRINT_SCREEN],
+        [6,     DWT.HELP],
+        [19,    DWT.PAUSE],
+        [3,     DWT.BREAK],
 
         /* Safari-specific */
-        {186,   ';'},
-        {187,   '='},
-        {189,   '-'},
-    };
+        [186,   ';'],
+        [187,   '='],
+        [189,   '-'],
+    ];
 
 public void addCloseWindowListener (CloseWindowListener listener) {
-    CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length + 1];
-    System.arraycopy(closeWindowListeners, 0, newCloseWindowListeners, 0, closeWindowListeners.length);
-    closeWindowListeners = newCloseWindowListeners;
-    closeWindowListeners[closeWindowListeners.length - 1] = listener;
+    //CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length + 1];
+    //System.arraycopy(closeWindowListeners, 0, newCloseWindowListeners, 0, closeWindowListeners.length);
+    //closeWindowListeners = newCloseWindowListeners;
+    closeWindowListeners ~= listener;
 }
 
 public void addLocationListener (LocationListener listener) {
-    LocationListener[] newLocationListeners = new LocationListener[locationListeners.length + 1];
-    System.arraycopy(locationListeners, 0, newLocationListeners, 0, locationListeners.length);
-    locationListeners = newLocationListeners;
-    locationListeners[locationListeners.length - 1] = listener;
+    //LocationListener[] newLocationListeners = new LocationListener[locationListeners.length + 1];
+    //System.arraycopy(locationListeners, 0, newLocationListeners, 0, locationListeners.length);
+    //locationListeners = newLocationListeners;
+    locationListeners ~= listener;
 }
 
 public void addOpenWindowListener (OpenWindowListener listener) {
-    OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length + 1];
-    System.arraycopy(openWindowListeners, 0, newOpenWindowListeners, 0, openWindowListeners.length);
-    openWindowListeners = newOpenWindowListeners;
-    openWindowListeners[openWindowListeners.length - 1] = listener;
+    //OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length + 1];
+    //System.arraycopy(openWindowListeners, 0, newOpenWindowListeners, 0, openWindowListeners.length);
+    //openWindowListeners = newOpenWindowListeners;
+    openWindowListeners ~= listener;
 }
 
 public void addProgressListener (ProgressListener listener) {
-    ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length + 1];
-    System.arraycopy(progressListeners, 0, newProgressListeners, 0, progressListeners.length);
-    progressListeners = newProgressListeners;
-    progressListeners[progressListeners.length - 1] = listener;
+    //ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length + 1];
+    //System.arraycopy(progressListeners, 0, newProgressListeners, 0, progressListeners.length);
+    //progressListeners = newProgressListeners;
+    progressListeners ~= listener;
 }
 
 public void addStatusTextListener (StatusTextListener listener) {
-    StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length + 1];
-    System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, statusTextListeners.length);
-    statusTextListeners = newStatusTextListeners;
-    statusTextListeners[statusTextListeners.length - 1] = listener;
+    //StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length + 1];
+    //System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, statusTextListeners.length);
+    //statusTextListeners = newStatusTextListeners;
+    statusTextListeners ~= listener;
 }
 
 public void addTitleListener (TitleListener listener) {
-    TitleListener[] newTitleListeners = new TitleListener[titleListeners.length + 1];
-    System.arraycopy(titleListeners, 0, newTitleListeners, 0, titleListeners.length);
-    titleListeners = newTitleListeners;
-    titleListeners[titleListeners.length - 1] = listener;
+    //TitleListener[] newTitleListeners = new TitleListener[titleListeners.length + 1];
+    //System.arraycopy(titleListeners, 0, newTitleListeners, 0, titleListeners.length);
+    //titleListeners = newTitleListeners;
+    titleListeners ~= listener;
 }
 
 public void addVisibilityWindowListener (VisibilityWindowListener listener) {
-    VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length + 1];
-    System.arraycopy(visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, visibilityWindowListeners.length);
-    visibilityWindowListeners = newVisibilityWindowListeners;
-    visibilityWindowListeners[visibilityWindowListeners.length - 1] = listener;
+    //VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length + 1];
+    //System.arraycopy(visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, visibilityWindowListeners.length);
+    //visibilityWindowListeners = newVisibilityWindowListeners;
+    visibilityWindowListeners ~= listener;
 }
 
 public abstract bool back ();
@@ -260,10 +269,10 @@
         closeWindowListeners = new CloseWindowListener[0];
         return;
     }
-    CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length - 1];
-    System.arraycopy (closeWindowListeners, 0, newCloseWindowListeners, 0, index);
-    System.arraycopy (closeWindowListeners, index + 1, newCloseWindowListeners, index, closeWindowListeners.length - index - 1);
-    closeWindowListeners = newCloseWindowListeners;
+    //CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length - 1];
+    //System.arraycopy (closeWindowListeners, 0, newCloseWindowListeners, 0, index);
+    //System.arraycopy (closeWindowListeners, index + 1, newCloseWindowListeners, index, closeWindowListeners.length - index - 1);
+    closeWindowListeners = closeWindowListeners[0..index] ~ closeWindowListeners[index+1..$];
 }
 
 public void removeLocationListener (LocationListener listener) {
@@ -280,10 +289,10 @@
         locationListeners = new LocationListener[0];
         return;
     }
-    LocationListener[] newLocationListeners = new LocationListener[locationListeners.length - 1];
-    System.arraycopy (locationListeners, 0, newLocationListeners, 0, index);
-    System.arraycopy (locationListeners, index + 1, newLocationListeners, index, locationListeners.length - index - 1);
-    locationListeners = newLocationListeners;
+    //LocationListener[] newLocationListeners = new LocationListener[locationListeners.length - 1];
+    //System.arraycopy (locationListeners, 0, newLocationListeners, 0, index);
+    //System.arraycopy (locationListeners, index + 1, newLocationListeners, index, locationListeners.length - index - 1);
+    locationListeners = locationListeners[0..index] ~ locationListeners[index+1..$];
 }
 
 public void removeOpenWindowListener (OpenWindowListener listener) {
@@ -300,10 +309,10 @@
         openWindowListeners = new OpenWindowListener[0];
         return;
     }
-    OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length - 1];
-    System.arraycopy (openWindowListeners, 0, newOpenWindowListeners, 0, index);
-    System.arraycopy (openWindowListeners, index + 1, newOpenWindowListeners, index, openWindowListeners.length - index - 1);
-    openWindowListeners = newOpenWindowListeners;
+    //OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length - 1];
+    //System.arraycopy (openWindowListeners, 0, newOpenWindowListeners, 0, index);
+    //System.arraycopy (openWindowListeners, index + 1, newOpenWindowListeners, index, openWindowListeners.length - index - 1);
+    openWindowListeners = openWindowListeners[0..index] ~ openWindowListeners[index+1..$];
 }
 
 public void removeProgressListener (ProgressListener listener) {
@@ -320,10 +329,10 @@
         progressListeners = new ProgressListener[0];
         return;
     }
-    ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length - 1];
-    System.arraycopy (progressListeners, 0, newProgressListeners, 0, index);
-    System.arraycopy (progressListeners, index + 1, newProgressListeners, index, progressListeners.length - index - 1);
-    progressListeners = newProgressListeners;
+    //ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length - 1];
+    //System.arraycopy (progressListeners, 0, newProgressListeners, 0, index);
+    //System.arraycopy (progressListeners, index + 1, newProgressListeners, index, progressListeners.length - index - 1);
+    progressListeners = progressListeners[0..index] ~ progressListeners[index+1..$];
 }
 
 public void removeStatusTextListener (StatusTextListener listener) {
@@ -340,10 +349,10 @@
         statusTextListeners = new StatusTextListener[0];
         return;
     }
-    StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length - 1];
-    System.arraycopy (statusTextListeners, 0, newStatusTextListeners, 0, index);
-    System.arraycopy (statusTextListeners, index + 1, newStatusTextListeners, index, statusTextListeners.length - index - 1);
-    statusTextListeners = newStatusTextListeners;
+    //StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length - 1];
+    //System.arraycopy (statusTextListeners, 0, newStatusTextListeners, 0, index);
+    //System.arraycopy (statusTextListeners, index + 1, newStatusTextListeners, index, statusTextListeners.length - index - 1);
+    statusTextListeners = statusTextListeners[0..index] ~ statusTextListeners[index+1..$];
 }
 
 public void removeTitleListener (TitleListener listener) {
@@ -361,9 +370,9 @@
         return;
     }
     TitleListener[] newTitleListeners = new TitleListener[titleListeners.length - 1];
-    System.arraycopy (titleListeners, 0, newTitleListeners, 0, index);
-    System.arraycopy (titleListeners, index + 1, newTitleListeners, index, titleListeners.length - index - 1);
-    titleListeners = newTitleListeners;
+    //System.arraycopy (titleListeners, 0, newTitleListeners, 0, index);
+    //System.arraycopy (titleListeners, index + 1, newTitleListeners, index, titleListeners.length - index - 1);
+    titleListeners = titleListeners[0..index] ~ titleListeners[index+1..$];
 }
 
 public void removeVisibilityWindowListener (VisibilityWindowListener listener) {
@@ -380,10 +389,10 @@
         visibilityWindowListeners = new VisibilityWindowListener[0];
         return;
     }
-    VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length - 1];
-    System.arraycopy (visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, index);
-    System.arraycopy (visibilityWindowListeners, index + 1, newVisibilityWindowListeners, index, visibilityWindowListeners.length - index - 1);
-    visibilityWindowListeners = newVisibilityWindowListeners;
+    //VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length - 1];
+    //System.arraycopy (visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, index);
+    //System.arraycopy (visibilityWindowListeners, index + 1, newVisibilityWindowListeners, index, visibilityWindowListeners.length - index - 1);
+    visibilityWindowListeners = visibilityWindowListeners[0..index] ~ visibilityWindowListeners[index+1..$];
 }
 
 public void setBrowser (Browser browser) {
--- a/dwt/browser/WindowCreator2.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/WindowCreator2.d	Sun Oct 26 08:09:00 2008 -0700
@@ -18,7 +18,10 @@
 import dwt.graphics.Point;
 //import dwt.internal.C;
 import dwt.internal.Platform;
-import dwt.internal.mozilla.XPCOM;
+import dwt.internal.mozilla.Common;
+
+import XPCOM = dwt.internal.mozilla.XPCOM;
+
 //import dwt.internal.mozilla.XPCOMObject;
 import dwt.internal.mozilla.nsIBaseWindow;
 import dwt.internal.mozilla.nsID;
@@ -31,7 +34,10 @@
 import dwt.layout.FillLayout;
 import dwt.widgets.Shell;
 
-class WindowCreator2 : nsIWindowCreator2{
+import dwt.browser.Browser;
+import dwt.browser.Mozilla;
+
+class WindowCreator2 : nsIWindowCreator2 {
 //    XPCOMObject supports;
 //    XPCOMObject windowCreator;
 //    XPCOMObject windowCreator2;
@@ -62,7 +68,7 @@
         return XPCOM.NS_OK;
     }
     if (*riid == nsIWindowCreator2.IID) {
-        *ppvObject == cast(void*)cast(nsIWindowCreator2)this;
+        *ppvObject = cast(void*)cast(nsIWindowCreator2)this;
         AddRef ();
         return XPCOM.NS_OK;
     }
--- a/dwt/browser/WindowEvent.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/browser/WindowEvent.d	Sun Oct 26 08:09:00 2008 -0700
@@ -12,11 +12,12 @@
  *******************************************************************************/
 module dwt.browser.WindowEvent;
 
-//import dwt.dwthelper.utils;
+import dwt.dwthelper.utils;
 
 import dwt.events.TypedEvent;
 import dwt.graphics.Point;
 import dwt.widgets.Widget;
+import dwt.browser.Browser;
 
 /**
  * A <code>WindowEvent</code> is sent by a {@link Browser} when
@@ -188,7 +189,7 @@
     
     static final long serialVersionUID = 3617851997387174969L;
     
-WindowEvent(Widget w) {
+this(Widget w) {
     super(w);
 }
 
--- a/dwt/internal/mozilla/XPCOM.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/internal/mozilla/XPCOM.d	Sun Oct 26 08:09:00 2008 -0700
@@ -26,144 +26,177 @@
  * 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;
+import dwt.internal.mozilla.Common;
+import dwt.internal.mozilla.nsID;
+import dwt.internal.mozilla.nsStringAPI;
+import dwt.internal.mozilla.nsIModule;
+import dwt.internal.mozilla.nsIComponentManager;
+import dwt.internal.mozilla.nsIComponentRegistrar;
+import dwt.internal.mozilla.nsIServiceManager;
+import dwt.internal.mozilla.nsIFile;
+import dwt.internal.mozilla.nsILocalFile;
+import dwt.internal.mozilla.nsIDirectoryService;
+import dwt.internal.mozilla.nsIMemory;
+import dwt.internal.mozilla.nsIDebug;
+import dwt.internal.mozilla.nsITraceRefcnt;
 
-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$
+private import dwt.dwthelper.utils;
+
+/******************************************************************************
+
+  Original SWT XPCOM constant declarations for XPCOM
 
-    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$
+******************************************************************************/
+   
+const String MOZILLA_FIVE_HOME = "MOZILLA_FIVE_HOME"; //$NON-NLS-1$
+const String MOZILLA_PLUGIN_PATH = "MOZ_PLUGIN_PATH"; //$NON-NLS-1$
+const String CONTENT_MAYBETEXT = "application/x-vnd.mozilla.maybe-text"; //$NON-NLS-1$
+const String CONTENT_MULTIPART = "multipart/x-mixed-replace"; //$NON-NLS-1$
+const String DOMEVENT_FOCUS = "focus"; //$NON-NLS-1$
+const String DOMEVENT_UNLOAD = "unload"; //$NON-NLS-1$
+const String DOMEVENT_MOUSEDOWN = "mousedown"; //$NON-NLS-1$
+const String DOMEVENT_MOUSEUP = "mouseup"; //$NON-NLS-1$
+const String DOMEVENT_MOUSEMOVE = "mousemove"; //$NON-NLS-1$
+const String DOMEVENT_MOUSEDRAG = "draggesture"; //$NON-NLS-1$
+const String DOMEVENT_MOUSEWHEEL = "DOMMouseScroll"; //$NON-NLS-1$
+const String DOMEVENT_MOUSEOVER = "mouseover"; //$NON-NLS-1$
+const String DOMEVENT_MOUSEOUT = "mouseout"; //$NON-NLS-1$
+const String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$
+const String DOMEVENT_KEYDOWN = "keydown"; //$NON-NLS-1$
+const String DOMEVENT_KEYPRESS = "keypress"; //$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$
+/* CID constants */
+const nsID NS_APPSHELL_CID = { 0x2d96b3df, 0xc051, 0x11d1, [0xa8,0x27,0x00,0x40,0x95,0x9a,0x28, 0xc9]}; //$NON-NLS-1$
+const nsID NS_CATEGORYMANAGER_CID = { 0x16d222a6, 0x1dd2, 0x11b2, [0xb6,0x93,0xf3,0x8b,0x02,0xc0,0x21,0xb2]}; //$NON-NLS-1$
+const nsID NS_DOWNLOAD_CID = { 0xe3fa9D0a, 0x1dd1, 0x11b2, [0xbd,0xef,0x8c,0x72,0x0b,0x59,0x74,0x45]}; //$NON-NLS-1$
+const nsID NS_FILEPICKER_CID = { 0x54ae32f8, 0x1dd2, 0x11b2, [0xa2,0x09,0xdf,0x7c,0x50,0x53,0x70,0xf8]}; //$NON-NLS-1$
+const nsID NS_HELPERAPPLAUNCHERDIALOG_CID = {0xf68578eb,0x6ec2,0x4169,[0xae,0x19,0x8c,0x62,0x43,0xf0,0xab,0xe1]}; //$NON-NLS-1$
+const nsID NS_INPUTSTREAMCHANNEL_CID = {0x6ddb050c,0x0d04,0x11d4,[0x98,0x6e,0x00,0xc0,0x4f,0xa0,0xcf,0x4a]}; //$NON-NLS-1$
+const nsID NS_IOSERVICE_CID = {0x9ac9e770,0x18bc,0x11d3,[0x93,0x37,0x00,0x10,0x4b,0xa0,0xfd,0x40]}; //$NON-NLS-1$
+const nsID NS_LOADGROUP_CID = {0xe1c61582,0x2a84,0x11d3,[0x8c,0xce,0x00,0x60,0xb0,0xfc,0x14,0xa3]}; //$NON-NLS-1$
+const nsID NS_PROMPTSERVICE_CID = {0xa2112d6a,0x0e28,0x421f,[0xb4,0x6a,0x25,0xc0,0xb3,0x08,0xcb,0xd0]}; //$NON-NLS-1$
+
+const String NS_CONTEXTSTACK_CONTRACTID = "@mozilla.org/js/xpc/ContextStack;1"; //$NON-NLS-1$
+const String NS_COOKIEMANAGER_CONTRACTID = "@mozilla.org/cookiemanager;1"; //$NON-NLS-1$
+const String NS_DIRECTORYSERVICE_CONTRACTID = "@mozilla.org/file/directory_service;1"; //$NON-NLS-1$
+const String NS_DOMSERIALIZER_CONTRACTID = "@mozilla.org/xmlextras/xmlserializer;1"; //$NON-NLS-1$
+const String NS_DOWNLOAD_CONTRACTID = "@mozilla.org/download;1"; //$NON-NLS-1$
+const String NS_FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1"; //$NON-NLS-1$
+const String NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID = "@mozilla.org/helperapplauncherdialog;1"; //$NON-NLS-1$
+const String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1"; //$NON-NLS-1$
+const String NS_OBSERVER_CONTRACTID = "@mozilla.org/observer-service;1"; //$NON-NLS-1$
+const String NS_PREFLOCALIZEDSTRING_CONTRACTID = "@mozilla.org/pref-localizedstring;1"; //$NON-NLS-1$
+const String NS_PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1"; //$NON-NLS-1$
+const String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; //$NON-NLS-1$
+const String NS_TRANSFER_CONTRACTID = "@mozilla.org/transfer;1"; //$NON-NLS-1$
+const String NS_WEBNAVIGATIONINFO_CONTRACTID = "@mozilla.org/webnavigation-info;1"; //$NON-NLS-1$
+const String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$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;
+/* directory service constants */
+const String NS_APP_APPLICATION_REGISTRY_DIR = "AppRegD"; //$NON-NLS-1$
+const String NS_APP_CACHE_PARENT_DIR = "cachePDir"; //$NON-NLS-1$
+const String NS_APP_HISTORY_50_FILE = "UHist"; //$NON-NLS-1$
+const String NS_APP_LOCALSTORE_50_FILE = "LclSt"; //$NON-NLS-1$
+const String NS_APP_PLUGINS_DIR_LIST = "APluginsDL"; //$NON-NLS-1$
+const String NS_APP_PREF_DEFAULTS_50_DIR = "PrfDef"; //$NON-NLS-1$
+const String NS_APP_PREFS_50_DIR = "PrefD"; //$NON-NLS-1$
+const String NS_APP_PREFS_50_FILE = "PrefF"; //$NON-NLS-1$
+const String NS_APP_USER_CHROME_DIR = "UChrm"; //$NON-NLS-1$
+const String NS_APP_USER_MIMETYPES_50_FILE = "UMimTyp"; //$NON-NLS-1$
+const String NS_APP_USER_PROFILE_50_DIR = "ProfD"; //$NON-NLS-1$
+const String NS_GRE_COMPONENT_DIR = "GreComsD"; //$NON-NLS-1$
+const String NS_GRE_DIR = "GreD"; //$NON-NLS-1$
+const String NS_OS_CURRENT_PROCESS_DIR = "CurProcD"; //$NON-NLS-1$
+const String NS_OS_HOME_DIR = "Home"; //$NON-NLS-1$
+const String NS_OS_TEMP_DIR = "TmpD"; //$NON-NLS-1$
+const String NS_XPCOM_COMPONENT_DIR = "ComsD"; //$NON-NLS-1$
+const String NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD"; //$NON-NLS-1$
+const String NS_XPCOM_INIT_CURRENT_PROCESS_DIR = "MozBinD"; //$NON-NLS-1$
 
-    public static final nsresult NS_FAILED( nsresult result ) {
-        return result & 0x80000000;
-    }
+/* XPCOM constants */
+const int NS_OK =  0;
+const int NS_COMFALSE = 1;
+const int NS_BINDING_ABORTED = 0x804B0002;
+const int NS_ERROR_BASE = 0xc1f30000;
+const int NS_ERROR_NOT_INITIALIZED =  NS_ERROR_BASE + 1;
+const int NS_ERROR_ALREADY_INITIALIZED = NS_ERROR_BASE + 2;
+const int NS_ERROR_NOT_IMPLEMENTED =  0x80004001;
+const int NS_NOINTERFACE =  0x80004002;
+const int NS_ERROR_NO_INTERFACE =  NS_NOINTERFACE;
+const int NS_ERROR_INVALID_POINTER =  0x80004003;
+const int NS_ERROR_NULL_POINTER = NS_ERROR_INVALID_POINTER;
+const int NS_ERROR_ABORT = 0x80004004;
+const int NS_ERROR_FAILURE = 0x80004005;
+const int NS_ERROR_UNEXPECTED = 0x8000ffff;
+const int NS_ERROR_OUT_OF_MEMORY = 0x8007000e;
+const int NS_ERROR_ILLEGAL_VALUE = 0x80070057;
+const int NS_ERROR_INVALID_ARG = NS_ERROR_ILLEGAL_VALUE;
+const int NS_ERROR_NO_AGGREGATION = 0x80040110;
+const int NS_ERROR_NOT_AVAILABLE = 0x80040111;
+const int NS_ERROR_FACTORY_NOT_REGISTERED = 0x80040154;
+const int NS_ERROR_FACTORY_REGISTER_AGAIN = 0x80040155;
+const int NS_ERROR_FACTORY_NOT_LOADED = 0x800401f8;
+const int NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT = NS_ERROR_BASE + 0x101;
+const int NS_ERROR_FACTORY_EXISTS = NS_ERROR_BASE + 0x100;
+const int NS_ERROR_HTMLPARSER_UNRESOLVEDDTD = 0x804e03f3;
+const int NS_ERROR_FILE_NOT_FOUND = 0x80520012;
+const int NS_ERROR_FILE_UNRECOGNIZED_PATH = 0x80520001;
 
-    public static final nsresult NS_SUCCEEDED( nsresult result ) {
-        return !(result & 0x80000000);
-    }
+public nsresult NS_FAILED( nsresult result ) {
+    return result & 0x80000000;
+}
+
+public 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 PRUint32 strlen_PRUnichar ( PRUnichar* str )
+{
+    PRUint32 len = 0;
+    if (str !is null) 
+        while (*(str++) != 0) len++;
+    return len;
+}
+
+/******************************************************************************
+
+    XPCOM Startup functions
+
+******************************************************************************/
+
+extern (System):
 
-//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();
+struct nsStaticModuleInfo
+{
+    char *name;
+    nsGetModuleProc getModule;
 }
+
+alias nsresult function (nsIComponentManager, nsIFile, nsIModule*) nsGetModuleProc;
+
+/******************************************************************************
+
+******************************************************************************/
+
+nsresult  NS_InitXPCOM2( nsIServiceManager *result, nsIFile binDirectory,
+	                     nsIDirectoryServiceProvider appFileLocationProvider );
+nsresult  NS_InitXPCOM3( nsIServiceManager *result, nsIFile binDirectory,
+	                     nsIDirectoryServiceProvider appFileLocationProvider,
+	                     nsStaticModuleInfo* staticComponents,
+	                     PRUint32 componentCount );
+
+nsresult  NS_ShutdownXPCOM(nsIServiceManager servMgr);
+nsresult  NS_GetServiceManager(nsIServiceManager *result);
+nsresult  NS_GetComponentManager(nsIComponentManager *result);
+nsresult  NS_GetComponentRegistrar(nsIComponentRegistrar *result);
+nsresult  NS_GetMemoryManager(nsIMemory *result);
+nsresult  NS_NewLocalFile(nsAString* path, PRBool followLinks, nsILocalFile* result);
+nsresult  NS_NewNativeLocalFile(nsACString* path, PRBool followLinks, nsILocalFile* result);
+void *    NS_Alloc(PRSize size);
+void *    NS_Realloc(void *ptr, PRSize size);
+void      NS_Free(void *ptr);
+nsresult  NS_GetDebug(nsIDebug *result);
+nsresult  NS_GetTraceRefcnt(nsITraceRefcnt *result);
--- a/dwt/internal/mozilla/XPCOMInit.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/internal/mozilla/XPCOMInit.d	Sun Oct 26 08:09:00 2008 -0700
@@ -48,12 +48,10 @@
     } 
 }
   
-public class XPCOMInit : Platform {
-    public static final int PATH_MAX = 4096;
+const int PATH_MAX = 4096;
 
 extern(System):
 
-    public static uint GRE_GetGREPathWithProperties(GREVersionRange *versions, int versionsLength, GREProperty *properties, uint propertiesLength, char *buffer, uint  buflen);
-    public static uint XPCOMGlueStartup(char* xpcomFile);
-    public static int XPCOMGlueShutdown ();
-}
+public static uint GRE_GetGREPathWithProperties(GREVersionRange *versions, int versionsLength, GREProperty *properties, uint propertiesLength, char *buffer, uint  buflen);
+public static uint XPCOMGlueStartup(char* xpcomFile);
+public static int XPCOMGlueShutdown ();
--- a/dwt/internal/mozilla/nsEmbedString.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/internal/mozilla/nsEmbedString.d	Sun Oct 26 08:09:00 2008 -0700
@@ -1,99 +1,90 @@
-/* ***** 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) 2004 IBM Corp.  All Rights Reserved.
- *
- * Port to the D programming language:
- *     John Reimer <terminal.node@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
 module dwt.internal.mozilla.nsEmbedString;
 
-import dwt.dwthelper.utils;
+import Utf = tango.text.convert.Utf;
+
+import dwt.internal.mozilla.Common;
 import dwt.internal.mozilla.nsStringAPI;
 
-public class nsEmbedString 
-{
-    int /*long*/ handle;
-        
-    /**************************************************************************
-
-    **************************************************************************/
-
-    public this() 
-    {
-        handle = XPCOM.nsEmbedString_new();
-    }
-    
-    /**************************************************************************
+scope class nsEmbedString
+{    
+	this(wchar[] s)
+	{
+		nsresult result;
+		result = NS_StringContainerInit2(&str, s.ptr, s.length, 0);
+		if (result != 0) // TODO: convert to XPCOM fail macro
+			throw new Exception("Init string container fail");
+	}
 
-    **************************************************************************/
+	this()
+	{
+		nsresult result;
+		result = NS_StringContainerInit(&str);
+		if (result != 0) // TODO: convert to XPCOM fail macro
+			throw new Exception("Init string container fail");
+	}
 
-    public nsEmbedString(String string)
-    {
-        if (string !is null) 
-        {
-            char[] aString = new char[string.length() + 1];
-            string.getChars(0, string.length(), aString, 0);
-            handle = XPCOM.nsEmbedString_new(aString);
-        }   
-    }
-    
-    /**************************************************************************
-
-    **************************************************************************/
+	nsAString* opCast()
+	{
+		return cast(nsAString*)&str;
+	}
 
-    public int /*long*/ getAddress() 
-    {
-        return handle;
-    }   
-        
-    /**************************************************************************
-
-    **************************************************************************/
-
-    public String toString() 
+	wchar[] toString16()
+	{
+		wchar* buffer = null;
+		PRBool terminated;
+		uint len = NS_StringGetData(cast(nsAString*)&str, &buffer, &terminated);
+		return buffer[0 .. len].dup;
+	}
+    
+    char[] toString()
     {
-        if (handle is 0) 
-            return null;
-        int length = XPCOM.nsEmbedString_Length(handle);
-        int /*long*/ buffer = XPCOM.nsEmbedString_get(handle);
-        char[] dest = new char[length];
-        XPCOM.memmove(dest, buffer, length * 2);
-        return new String(dest);
-    }   
-        
-    /**************************************************************************
+        return Utf.toString(this.toString16());
+    }
+    ~this()
+	{
+		NS_StringContainerFinish(&str);
+	}
+private:
+	nsStringContainer str;
+}
+
+
+scope class nsEmbedCString
+{
+	this(char[] s)
+	{
+		nsresult result;
+		result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0);
+		if (result != 0) // TODO: convert to XPCOM fail macro
+			throw new Exception("Init string container fail");
+	}
 
-    **************************************************************************/
+	this()
+	{
+		nsresult result;
+		result = NS_CStringContainerInit(&str);
+		if (result != 0) // TODO: convert to XPCOM fail macro
+			throw new Exception("Init string container fail");
+	}
+
+	nsACString* opCast()
+	{
+		return cast(nsACString*)&str;
+	}
 
-    public void dispose() 
-    {
-        if (handle is 0) 
-            return;            
-        XPCOM.nsEmbedString_delete(handle);
-        handle = 0;     
-    }   
-}
\ No newline at end of file
+	char[] toString()
+	{
+		char* buffer = null;
+		PRBool terminated;
+		uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated);
+        return buffer[0 .. len].dup;
+	}
+
+	~this()
+	{
+		NS_CStringContainerFinish(&str);
+	}
+private:
+	nsCStringContainer str;
+}
+
--- a/dwt/internal/mozilla/nsEmbedString2.d	Sat Oct 25 21:01:54 2008 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-module dwt.internal.mozilla.nsEmbedString;
-
-import Utf = tango.text.convert.Utf;
-
-import dwt.internal.mozilla.Common;
-import dwt.internal.mozilla.nsStringAPI;
-
-scope class nsEmbedString
-{    
-	this(wchar[] s)
-	{
-		nsresult result;
-		result = NS_StringContainerInit2(&str, s.ptr, s.length, 0);
-		if (result != 0) // TODO: convert to XPCOM fail macro
-			throw new Exception("Init string container fail");
-	}
-
-	this()
-	{
-		nsresult result;
-		result = NS_StringContainerInit(&str);
-		if (result != 0) // TODO: convert to XPCOM fail macro
-			throw new Exception("Init string container fail");
-	}
-
-	nsAString* opCast()
-	{
-		return cast(nsAString*)&str;
-	}
-
-	wchar[] toString16()
-	{
-		wchar* buffer = null;
-		PRBool terminated;
-		uint len = NS_StringGetData(cast(nsAString*)&str, &buffer, &terminated);
-		return buffer[0 .. len].dup;
-	}
-    
-    char[] toString()
-    {
-        return Utf.toString(this.toString16());
-    }
-    ~this()
-	{
-		NS_StringContainerFinish(&str);
-	}
-private:
-	nsStringContainer str;
-}
-
-
-scope class nsEmbedCString
-{
-	this(char[] s)
-	{
-		nsresult result;
-		result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0);
-		if (result != 0) // TODO: convert to XPCOM fail macro
-			throw new Exception("Init string container fail");
-	}
-
-	this()
-	{
-		nsresult result;
-		result = NS_CStringContainerInit(&str);
-		if (result != 0) // TODO: convert to XPCOM fail macro
-			throw new Exception("Init string container fail");
-	}
-
-	nsACString* opCast()
-	{
-		return cast(nsACString*)&str;
-	}
-
-	char[] toString()
-	{
-		char* buffer = null;
-		PRBool terminated;
-		uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated);
-        return buffer[0 .. len].dup;
-	}
-
-	~this()
-	{
-		NS_CStringContainerFinish(&str);
-	}
-private:
-	nsCStringContainer str;
-}
-
--- a/dwt/internal/mozilla/nsID.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/internal/mozilla/nsID.d	Sun Oct 26 08:09:00 2008 -0700
@@ -1,6 +1,7 @@
 module dwt.internal.mozilla.nsID;
 
 import dwt.internal.mozilla.Common;
+import dwt.dwthelper.utils;
 
 align(1)
 struct nsID
@@ -9,18 +10,36 @@
     PRUint16 m1;
     PRUint16 m2;
     PRUint8[8] m3;
-/+
-	static nsID opCall(PRUint32 v0, PRUint16 v1, PRUint16 v2, PRUint8[8] v3)
+
+	static nsID opCall(String aIDStr)
 	{
-		nsID result;
-		result.m0 = v0;
-		result.m1 = v1;
-		result.m2 = v2;
-		for(int i=0; i<8; ++i)
-			result.m3[i] = v3[i];
-		return result;
+        nsID id;
+        if(aIDStr == null) throw new ParseException();
+        int i = 0;
+        with(id) {
+            for (; i < 8; i++) m0 = (m0 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16);
+            if (aIDStr.charAt (i) != '-') throw new ParseException ();
+            i++;
+            for (; i < 13; i++) m1 = cast(short)((m1 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            if (aIDStr.charAt (i) != '-') throw new ParseException ();
+            i++;
+            for (; i < 18; i++) m2 = cast(short)((m2 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            if (aIDStr.charAt (i) != '-') throw new ParseException ();
+            i++;
+            for (; i < 21; i++) m3[0] = cast(byte)((m3[0] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            for (; i < 23; i++) m3[1] = cast(byte)((m3[1] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            if (aIDStr.charAt (i) != '-') throw new ParseException ();
+            i++;
+            for (; i < 26; i++) m3[2] = cast(byte)((m3[2] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            for (; i < 28; i++) m3[3] = cast(byte)((m3[3] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            for (; i < 30; i++) m3[4] = cast(byte)((m3[4] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            for (; i < 32; i++) m3[5] = cast(byte)((m3[5] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            for (; i < 34; i++) m3[6] = cast(byte)((m3[6] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+            for (; i < 36; i++) m3[7] = cast(byte)((m3[7] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+        }
+        return id;
 	}
-+/
+
 }
 
 alias nsID nsCID;
--- a/dwt/internal/mozilla/nsIDOMSerializer_1_7.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/internal/mozilla/nsIDOMSerializer_1_7.d	Sun Oct 26 08:09:00 2008 -0700
@@ -1,4 +1,4 @@
-module dwt.internal.mozilla.nsIDOMSerializer;
+module dwt.internal.mozilla.nsIDOMSerializer_1_7;
 
 import dwt.internal.mozilla.Common;
 import dwt.internal.mozilla.nsID;
@@ -15,7 +15,7 @@
 
 extern(System)
 
-interface nsIDOMSerializer : nsISupports {
+interface nsIDOMSerializer_1_7 : nsISupports {
 
   static const char[] IID_STR = NS_IDOMSERIALIZER_IID_STR;
   static const nsIID IID = NS_IDOMSERIALIZER_IID;
--- a/dwt/internal/mozilla/nsIDocShell.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/internal/mozilla/nsIDocShell.d	Sun Oct 26 08:09:00 2008 -0700
@@ -132,18 +132,18 @@
 
 ******************************************************************************/
 
-const char[] NS_IDOCSHELL_MOZILLA_1_8_BRANCH_IID_STR = "45988a14-b240-4d07-ae64-50ecca26e6d8";
+const char[] NS_IDOCSHELL_1_8_IID_STR = "45988a14-b240-4d07-ae64-50ecca26e6d8";
 
-const nsIID NS_IDOCSHELL_MOZILLA_1_8_BRANCH_IID= 
+const nsIID NS_IDOCSHELL_1_8_IID= 
   {0x45988a14, 0xb240, 0x4d07, 
     [ 0xae, 0x64, 0x50, 0xec, 0xca, 0x26, 0xe6, 0xd8 ]};
 
 extern(System)
 
-interface nsIDocShell_MOZILLA_1_8_BRANCH : nsISupports {
+interface nsIDocShell_1_8 : nsISupports {
 
-  static const char[] IID_STR = NS_IDOCSHELL_MOZILLA_1_8_BRANCH_IID_STR;
-  static const nsIID IID = NS_IDOCSHELL_MOZILLA_1_8_BRANCH_IID;
+  static const char[] IID_STR = NS_IDOCSHELL_1_8_IID_STR;
+  static const nsIID IID = NS_IDOCSHELL_1_8_IID;
 
   nsresult GetSessionStorageForURI(nsIURI uri, nsIDOMStorage *_retval);
   nsresult AddSessionStorage(nsACString * aDomain, nsIDOMStorage storage);
@@ -154,18 +154,18 @@
 
 ******************************************************************************/
 
-const char[] NS_IDOCSHELL_MOZILLA_1_9_BRANCH_IID_STR = "45988a14-b240-4d07-ae64-50ecca26e6d8";
+const char[] NS_IDOCSHELL_1_9_IID_STR = "45988a14-b240-4d07-ae64-50ecca26e6d8";
 
-const nsIID NS_IDOCSHELL_MOZILLA_1_9_BRANCH_IID = 
+const nsIID NS_IDOCSHELL_1_9_IID = 
   {0x45988a14, 0xb240, 0x4d07, 
     [ 0xae, 0x64, 0x50, 0xec, 0xca, 0x26, 0xe6, 0xd8 ]};
 
 extern(System)
 
-interface nsIDocShell_MOZILLA_1_9_BRANCH : nsISupports {
+interface nsIDocShell_1_9 : nsISupports {
 
-  static const char[] IID_STR = NS_IDOCSHELL_MOZILLA_1_9_BRANCH_IID_STR;
-  static const nsIID IID = NS_IDOCSHELL_MOZILLA_1_9_BRANCH_IID;
+  static const char[] IID_STR = NS_IDOCSHELL_1_9_IID_STR;
+  static const nsIID IID = NS_IDOCSHELL_1_9_IID;
 
   nsresult GetSessionStorageForURI(nsIURI uri, nsIDOMStorage *_retval);
   nsresult AddSessionStorage(nsACString * aDomain, nsIDOMStorage storage);
--- a/dwt/internal/mozilla/nsStringAPI.d	Sat Oct 25 21:01:54 2008 -0700
+++ b/dwt/internal/mozilla/nsStringAPI.d	Sun Oct 26 08:09:00 2008 -0700
@@ -68,11 +68,12 @@
 alias nsAString nsAString_external;
 alias nsACString nsACString_external;
 
-alias nsAString nsEmbedString;
-alias nsACString nsEmbedCString;
+//alias nsAString nsEmbedString;
+//alias nsACString nsEmbedCString;
 
 struct nsAString
 {
+/+
     static nsAString opCall(wchar[] s)
     {
         nsAString result;
@@ -92,20 +93,21 @@
     {
         return Utf.toString( nsAString.toString16( str ) );
     }
-  
+  +/
     private:
     void *v;
 }
 
 struct nsACString
 {
+/+
   static nsACString opCall(char[] s)
   {
     nsACString result;
     NS_CStringSetData(&result, cast(char*)s, uint.max);
     return result;
   }
-
++/
   private:
     void *v;
 }
--- a/dwt/internal/mozilla/nsXPCOM.d	Sat Oct 25 21:01:54 2008 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-
-module dwt.internal.mozilla.nsXPCOM;
-
-import dwt.internal.mozilla.Common;
-import dwt.internal.mozilla.nsStringAPI;
-import dwt.internal.mozilla.nsIModule;
-import dwt.internal.mozilla.nsIComponentManager;
-import dwt.internal.mozilla.nsIComponentRegistrar;
-import dwt.internal.mozilla.nsIServiceManager;
-import dwt.internal.mozilla.nsIFile;
-import dwt.internal.mozilla.nsILocalFile;
-import dwt.internal.mozilla.nsIDirectoryService;
-import dwt.internal.mozilla.nsIMemory;
-import dwt.internal.mozilla.nsIDebug;
-import dwt.internal.mozilla.nsITraceRefcnt;
-
-/******************************************************************************
-
-******************************************************************************/
-
-extern (System):
-
-struct nsStaticModuleInfo
-{
-    char *name;
-    nsGetModuleProc getModule;
-}
-
-alias nsresult function (nsIComponentManager, nsIFile, nsIModule*) nsGetModuleProc;
-
-/******************************************************************************
-
-******************************************************************************/
-
-nsresult  NS_InitXPCOM2( nsIServiceManager *result, nsIFile binDirectory,
-	                     nsIDirectoryServiceProvider appFileLocationProvider );
-nsresult  NS_InitXPCOM3( nsIServiceManager *result, nsIFile binDirectory,
-	                     nsIDirectoryServiceProvider appFileLocationProvider,
-	                     nsStaticModuleInfo* staticComponents,
-	                     PRUint32 componentCount );
-
-nsresult  NS_ShutdownXPCOM(nsIServiceManager servMgr);
-nsresult  NS_GetServiceManager(nsIServiceManager *result);
-nsresult  NS_GetComponentManager(nsIComponentManager *result);
-nsresult  NS_GetComponentRegistrar(nsIComponentRegistrar *result);
-nsresult  NS_GetMemoryManager(nsIMemory *result);
-nsresult  NS_NewLocalFile(nsAString* path, PRBool followLinks, nsILocalFile* result);
-nsresult  NS_NewNativeLocalFile(nsACString* path, PRBool followLinks, nsILocalFile* result);
-void *    NS_Alloc(PRSize size);
-void *    NS_Realloc(void *ptr, PRSize size);
-void      NS_Free(void *ptr);
-nsresult  NS_GetDebug(nsIDebug *result);
-nsresult  NS_GetTraceRefcnt(nsITraceRefcnt *result);