SWT.error(SWT.ERROR_NO_HANDLES);
SWT.error(SWT.ERROR_NO_HANDLES, e);
public Browser(Composite parent, int style) { 	super(parent,style | SWT.EMBEDDED);		if (!IsLinux) {		dispose();		SWT.error(SWT.ERROR_NO_HANDLES);			}	int[] result = new int[1];	if (!mozilla) {		try {			Library.loadLibrary("swt-gtk"); //$NON-NLS-1$			Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$		} catch (UnsatisfiedLinkError e) {			dispose();			SWT.error(SWT.ERROR_NO_HANDLES);		}				String mozillaPath = GRE.mozillaPath;		if (mozillaPath == null) {			dispose();			SWT.error(SWT.ERROR_NO_HANDLES);		}		int[] retVal = new int[1];		nsString path = new nsString(mozillaPath);		int rc = XPCOM.NS_NewLocalFile(path.getAddress(), true, retVal);		path.dispose();		if (rc != XPCOM.NS_OK) error(rc);		if (retVal[0] == 0) error(XPCOM.NS_ERROR_NULL_POINTER);		/*		* Feature on Mozilla.  On Windows, the mozilla libraries are split		* up into 2 locations indicated by the GRE and Mozilla paths.  The		* default nsIDirectoryServiceProvider only works when the libraries		* are in the same folder.  The workaround is to provide a custom		* nsIDirectoryServiceProvider on this platform.  It provides the 		* 2 locations set by Mozilla in the Windows registry.		*/		if (IsWindows) {			LocProvider = new AppFileLocProvider();			LocProvider.AddRef();		}				nsILocalFile localFile = new nsILocalFile(retVal[0]);		rc = XPCOM.NS_InitEmbedding(localFile.getAddress(), IsWindows ? LocProvider.getAddress() : 0);		localFile.Release();		if (rc != XPCOM.NS_OK) {			if (LocProvider != null) LocProvider.Release();			LocProvider = null;			dispose();			SWT.error(SWT.ERROR_NO_HANDLES);		}		rc = XPCOM.NS_GetComponentManager(result);		if (rc != XPCOM.NS_OK) error(rc);		if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);				nsIComponentManager componentManager = new nsIComponentManager(result[0]);		result[0] = 0;		rc = componentManager.CreateInstance(XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.NS_IAPPSHELL_IID, result);		if (rc != XPCOM.NS_OK) error(rc);		if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);				componentManager.Release();				AppShell = new nsIAppShell(result[0]);		rc = AppShell.Create(null, null);		if (rc != XPCOM.NS_OK) error(rc);		rc = AppShell.Spinup();		if (rc != XPCOM.NS_OK) error(rc);				WindowCreator = new WindowCreator();		WindowCreator.AddRef();				rc = XPCOM.NS_GetServiceManager(result);		if (rc != XPCOM.NS_OK) error(rc);		if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);				nsIServiceManager serviceManager = new nsIServiceManager(result[0]);		result[0] = 0;		byte[] buffer = XPCOM.NS_WINDOWWATCHER_CONTRACTID.getBytes();		byte[] aContractID = new byte[buffer.length + 1];		System.arraycopy(buffer, 0, aContractID, 0, buffer.length);		rc = serviceManager.GetServiceByContractID(aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);		if (rc != XPCOM.NS_OK) error(rc);		if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);				serviceManager.Release();				nsIWindowWatcher windowWatcher = new nsIWindowWatcher(result[0]);		result[0] = 0;		rc = windowWatcher.SetWindowCreator(WindowCreator.getAddress());		if (rc != XPCOM.NS_OK) error(rc);		windowWatcher.Release();				PromptServiceFactory factory = new PromptServiceFactory();		factory.AddRef();				rc = XPCOM.NS_GetComponentManager(result);		if (rc != XPCOM.NS_OK) error(rc);		if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);				componentManager = new nsIComponentManager(result[0]);		result[0] = 0;		rc = componentManager.QueryInterface(nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result);		if (rc != XPCOM.NS_OK) error(rc);		if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);				componentManager.Release();				nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar(result[0]);		result[0] = 0;		buffer = XPCOM.NS_PROMPTSERVICE_CONTRACTID.getBytes();		aContractID = new byte[buffer.length + 1];		System.arraycopy(buffer, 0, aContractID, 0, buffer.length);		buffer = "Prompt Service".getBytes();		byte[] aClassName = new byte[buffer.length + 1];		System.arraycopy(buffer, 0, aClassName, 0, buffer.length);		rc = componentRegistrar.RegisterFactory(XPCOM.NS_PROMPTSERVICE_CID, aClassName, aContractID, factory.getAddress());		if (rc != XPCOM.NS_OK) error(rc);		factory.Release();		componentRegistrar.Release();				mozilla = true;	}	BrowserCount++;	if (BrowserCount == 1) {		GTK.gtk_init_check(new int[1], null);		final Display display = getDisplay();		display.asyncExec(new Runnable() {			public void run() {				if (BrowserCount == 0) return;				while (GTK.gtk_events_pending() != 0) {					GTK.gtk_main_iteration();				}				display.timerExec(25, this);					}		});	}	parent.getShell().setFocus();	gtkHandle = GTK.gtk_plug_new(embeddedHandle);	int rc = XPCOM.NS_GetComponentManager(result);	if (rc != XPCOM.NS_OK) error(rc);	if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);		nsIComponentManager componentManager = new nsIComponentManager(result[0]);	result[0] = 0;	nsID NS_IWEBBROWSER_CID = new nsID("F1EAC761-87E9-11d3-AF80-00A024FFC08C"); //$NON-NLS-1$	rc = componentManager.CreateInstance(NS_IWEBBROWSER_CID, 0, nsIWebBrowser.NS_IWEBBROWSER_IID, result);	if (rc != XPCOM.NS_OK) error(rc);	if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);		componentManager.Release();		webBrowser = new nsIWebBrowser(result[0]); 	createCOMInterfaces();	AddRef();	rc = webBrowser.SetContainerWindow(webBrowserChrome.getAddress());	if (rc != XPCOM.NS_OK) error(rc);				rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);	if (rc != XPCOM.NS_OK) error(rc);	if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);		nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);		rc = baseWindow.InitWindow(gtkHandle, 0, 0, 0, 2, 2);	if (rc != XPCOM.NS_OK) error(XPCOM.NS_ERROR_FAILURE);	rc = baseWindow.Create();	if (rc != XPCOM.NS_OK) error(XPCOM.NS_ERROR_FAILURE);	rc = baseWindow.SetVisibility(true);	if (rc != XPCOM.NS_OK) error(XPCOM.NS_ERROR_FAILURE);	baseWindow.Release();	rc = webBrowser.AddWebBrowserListener(weakReference.getAddress(), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);	if (rc != XPCOM.NS_OK) error(rc);	rc = webBrowser.SetParentURIContentListener(uriContentListener.getAddress());	if (rc != XPCOM.NS_OK) error(rc);	Listener listener = new Listener() {		public void handleEvent(Event event) {			switch (event.type) {				case SWT.Dispose: onDispose(); break;				case SWT.Resize: onResize(); break;				case SWT.FocusIn: onFocusGained(event);	break;				case SWT.FocusOut: onFocusLost(event); break;			}		}	};		int[] folderEvents = new int[]{		SWT.Dispose,		SWT.Resize,  		SWT.FocusIn, 		SWT.FocusOut, 	};	for (int i = 0; i < folderEvents.length; i++) {		addListener(folderEvents[i], listener);	}	GTK.gtk_widget_show(gtkHandle);}