Buggy code:
class WindowCreator { XPCOMObject supports ; XPCOMObject windowCreator ; int refCount = 0 ; public WindowCreator ( ) { } int AddRef ( ) { } void createCOMInterfaces ( ) { } void disposeCOMInterfaces ( ) { } int getAddress ( ) { } int QueryInterface ( int riid , int ppvObject ) { } int Release ( ) { } int CreateChromeWindow ( int parent , int chromeFlags , int _retval ) { if ( ( parent == 0 ) && ( ( chromeFlags & ( nsIWebBrowserChrome . CHROME_MODAL ) ) == 0 ) ) { return XPCOM . NS_ERROR_NOT_IMPLEMENTED ; } Browser src = null ; if ( parent != 0 ) { nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome ( parent ) ; int [ ] aWebBrowser = new int [ 1 ] ; int rc = browserChromeParent . GetWebBrowser ( aWebBrowser ) ; if ( rc != ( XPCOM . NS_OK ) ) Mozilla . error ( rc ) ; if ( ( aWebBrowser [ 0 ] ) == 0 ) Mozilla . error ( NS_ERROR_NO_INTERFACE ) ; nsIWebBrowser webBrowser = new nsIWebBrowser ( aWebBrowser [ 0 ] ) ; int [ ] result = new int [ 1 ] ; rc = webBrowser . QueryInterface ( NS_IBASEWINDOW_IID , result ) ; if ( rc != ( XPCOM . NS_OK ) ) Mozilla . error ( rc ) ; if ( ( result [ 0 ] ) == 0 ) Mozilla . error ( NS_ERROR_NO_INTERFACE ) ; webBrowser . Release ( ) ; nsIBaseWindow baseWindow = new nsIBaseWindow ( result [ 0 ] ) ; result [ 0 ] = 0 ; int [ ] aParentNativeWindow = new int [ 1 ] ; rc = baseWindow . GetParentNativeWindow ( aParentNativeWindow ) ; if ( rc != ( XPCOM . NS_OK ) ) Mozilla . error ( rc ) ; if ( ( aParentNativeWindow [ 0 ] ) == 0 ) Mozilla . error ( NS_ERROR_NO_INTERFACE ) ; baseWindow . Release ( ) ; src = Mozilla . findBrowser ( aParentNativeWindow [ 0 ] ) ; } final Browser browser ; boolean doit = false ; if ( ( chromeFlags & ( nsIWebBrowserChrome . CHROME_MODAL ) ) != 0 ) { final Shell shell = ( src == null ) ? new Shell ( ( ( SWT . DIALOG_TRIM ) | ( SWT . APPLICATION_MODAL ) ) ) : new Shell ( src . getShell ( ) , ( ( SWT . DIALOG_TRIM ) | ( SWT . APPLICATION_MODAL ) ) ) ; shell . setLayout ( new FillLayout ( ) ) ; <START_BUG> browser = new Browser ( shell , ( ( src . getStyle ( ) ) & ( SWT . MOZILLA ) ) ) ; <END_BUG> browser . addVisibilityWindowListener ( new VisibilityWindowListener ( ) { public void hide ( WindowEvent event ) { } public void show ( WindowEvent event ) { if ( ( event . location ) != null ) shell . setLocation ( event . location ) ; if ( ( event . size ) != null ) { Point size = event . size ; shell . setSize ( shell . computeSize ( size . x , size . y ) ) ; } shell . open ( ) ; ( ( Mozilla ) ( browser . webBrowser ) ) . isModal = true ; } } ) ; browser . addCloseWindowListener ( new CloseWindowListener ( ) { public void close ( WindowEvent event ) { shell . close ( ) ; } } ) ; doit = true ; } else { WindowEvent event = new WindowEvent ( src ) ; event . display = src . getDisplay ( ) ; event . widget = src ; event . required = true ; for ( int i = 0 ; i < ( src . webBrowser . openWindowListeners . length ) ; i ++ ) { src . webBrowser . openWindowListeners [ i ] . open ( event ) ; } browser = event . browser ; doit = ( browser != null ) && ( ! ( browser . isDisposed ( ) ) ) ; if ( doit ) { ( ( Mozilla ) ( browser . webBrowser ) ) . addressBar = ( chromeFlags & ( nsIWebBrowserChrome . CHROME_LOCATIONBAR ) ) != 0 ; ( ( Mozilla ) ( browser . webBrowser ) ) . menuBar = ( chromeFlags & ( nsIWebBrowserChrome . CHROME_MENUBAR ) ) != 0 ; ( ( Mozilla ) ( browser . webBrowser ) ) . statusBar = ( chromeFlags & ( nsIWebBrowserChrome . CHROME_STATUSBAR ) ) != 0 ; ( ( Mozilla ) ( browser . webBrowser ) ) . toolBar = ( chromeFlags & ( nsIWebBrowserChrome . CHROME_TOOLBAR ) ) != 0 ; } } if ( doit ) { int address = ( ( Mozilla ) ( browser . webBrowser ) ) . webBrowserChrome . getAddress ( ) ; nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome ( address ) ; webBrowserChrome . AddRef ( ) ; XPCOM . memmove ( _retval , new int [ ] { address } , PTR_SIZEOF ) ; } return doit ? XPCOM . NS_OK : XPCOM . NS_ERROR_NOT_IMPLEMENTED ; } }

Fix:
browser = new Browser ( shell , ( src == null ? SWT . MOZILLA : ( src . getStyle ( ) ) & ( SWT . MOZILLA ) ) ) ;