static Browser findBrowser (long /*int*/ handle) { return MozillaDelegate.findBrowser (handle); }
int /*long*/ getSiteWindow () { /* * As of XULRunner 4, XULRunner's printing facilities on Windows destroy * the HWND that is returned from here once the print dialog is dismissed * (originating bug: https://bugzilla.mozilla.org/show_bug.cgi?id=588735 ). * For this scenario it is now expected that the handle that is returned * here is a child of the browser handle, not the browser handle itself. * * The other scenario that requests this handle is the Mozilla.getBrowser() * implementation. This method's GetSiteWindow() invocation is surrounded * by boolean flags to help differentiate it from the printing scenario, * since Mozilla.getBrowser() does not destroy the handle it receives back. * * All children that are created here are stored and then destroyed once * the current page is left. This is guard code that should only be needed * if Mozilla.getSiteWindow() is ever invoked by a path other than one of * the two described above. */ if (!MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR10) || Mozilla.IsGettingSiteWindow) { return getHandle (); } Composite child = new Composite (browser, SWT.NONE); childWindows.add (child); return child.handle; }
static byte[] getJSLibPathBytes () { if (jsLibPathBytes == null) { String[] names = MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR10) ? MozillaDelegate.getJSLibraryNames () : new String[] {MozillaDelegate.getJSLibraryName_Pre10 ()}; for (int i = 0; i < names.length; i++) { File file = new File (getMozillaPath (), names[i]); if (file.exists ()) { String pathString = file.getAbsolutePath () + '\0'; try { jsLibPathBytes = pathString.getBytes ("UTF-8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { jsLibPathBytes = pathString.getBytes (); } break; } } } return jsLibPathBytes; }
static byte[] getJSLibPathBytes () { if (jsLibPathBytes == null) { String[] names = IsPre_4 ? new String[] {MozillaDelegate.getJSLibraryName_Pre4 ()} : MozillaDelegate.getJSLibraryNames (); for (int i = 0; i < names.length; i++) { File file = new File (getMozillaPath (), names[i]); if (file.exists ()) { String pathString = file.getAbsolutePath () + '\0'; try { jsLibPathBytes = pathString.getBytes ("UTF-8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { jsLibPathBytes = pathString.getBytes (); } break; } } } return jsLibPathBytes; }
@Override public void create (Composite parent, int style) { delegate = new MozillaDelegate (browser); final Display display = parent.getDisplay (); profilePath = MozillaDelegate.getProfilePath (); String cacheParentPath = MozillaDelegate.getCacheParentPath (); LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, cacheParentPath, IsXULRunner); LocationProvider.AddRef (); DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); downloadFactory_1_8.AddRef (); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true); byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtTransfer", true); //$NON-NLS-1$ rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ()); if (rc != XPCOM.NS_OK) { HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); dialogFactory.AddRef (); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true); byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtHelperAppLauncherDialog", true); //$NON-NLS-1$ rc = componentRegistrar.RegisterFactory (XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress ()); if (rc != XPCOM.NS_OK) { delegate.addWindowSubclass (); delegate.init ();
String libName = MozillaDelegate.getSWTInitLibraryName (); Library.loadLibrary (libName); initLoaded = true; MozillaPath += MozillaDelegate.getLibraryName (MozillaPath); IsXULRunner = true; byte[] bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true); int rc = XPCOMInit.XPCOMGlueStartup (bytes); if (rc != XPCOM.NS_OK) { long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, MOZILLA_FIVE_HOME, true)); if (ptr == 0) { IsXULRunner = false; bytes = new byte[length]; C.memmove (bytes, ptr, length); MozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes)); } else { MozillaPath += SEPARATOR_OS; MozillaPath += MozillaDelegate.getLibraryName (MozillaPath); bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true); rc = XPCOMInit.XPCOMGlueStartup (bytes); if (rc == XPCOM.NS_OK) {
byte[] bytes = MozillaDelegate.wcsToMbcs (null, CookieUrl, false); long /*int*/ aSpec = XPCOM.nsEmbedCString_new (bytes, bytes.length); rc = ioService.NewURI (aSpec, null, 0, result); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIESERVICE_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsICookieService.class), result); if (rc != XPCOM.NS_OK) error (rc); mozillaPath += MozillaDelegate.getLibraryName (mozillaPath) + '\0'; try { pathBytes_NSFree = mozillaPath.getBytes ("UTF-8"); //$NON-NLS-1$ String allCookies = new String (MozillaDelegate.mbcsToWcs (null, bytes)); StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens ()) {
embedHandle = delegate.getHandle (); error (XPCOM.NS_ERROR_FAILURE); rc = delegate.createBaseWindow (baseWindow); if (rc != XPCOM.NS_OK) { browser.dispose ();
static String getCacheParentPath () { return getProfilePath (); }
@Override public void create (Composite parent, int style) { delegate = new MozillaDelegate (browser); final Display display = parent.getDisplay (); profilePath = MozillaDelegate.getProfilePath (); String cacheParentPath = MozillaDelegate.getCacheParentPath (); LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, cacheParentPath, IsXULRunner); LocationProvider.AddRef (); DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); downloadFactory_1_8.AddRef (); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true); byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtTransfer", true); //$NON-NLS-1$ rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ()); if (rc != XPCOM.NS_OK) { HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); dialogFactory.AddRef (); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true); byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtHelperAppLauncherDialog", true); //$NON-NLS-1$ rc = componentRegistrar.RegisterFactory (XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress ()); if (rc != XPCOM.NS_OK) { delegate.addWindowSubclass (); delegate.init ();
String libName = MozillaDelegate.getSWTInitLibraryName (); Library.loadLibrary (libName); initLoaded = true; MozillaPath += SEPARATOR_OS + MozillaDelegate.getLibraryName (); IsXULRunner = true; byte[] bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true); int rc = XPCOMInit.XPCOMGlueStartup (bytes); if (rc != XPCOM.NS_OK) { long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true)); if (ptr == 0) { IsXULRunner = false; bytes = new byte[length]; C.memmove (bytes, ptr, length); MozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes)); IsXULRunner = false; } else { MozillaPath += SEPARATOR_OS + MozillaDelegate.getLibraryName (); bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true); rc = XPCOMInit.XPCOMGlueStartup (bytes); if (rc == XPCOM.NS_OK) {
byte[] bytes = MozillaDelegate.wcsToMbcs (null, CookieUrl, false); int /*long*/ aSpec = XPCOM.nsEmbedCString_new (bytes, bytes.length); rc = ioService.NewURI (aSpec, null, 0, result); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIESERVICE_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsICookieService.class), result); if (rc != XPCOM.NS_OK) error (rc); mozillaPath += MozillaDelegate.getLibraryName (mozillaPath) + '\0'; try { pathBytes_NSFree = mozillaPath.getBytes ("UTF-8"); //$NON-NLS-1$ String allCookies = new String (MozillaDelegate.mbcsToWcs (null, bytes)); StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens ()) {
embedHandle = delegate.getHandle (); error (XPCOM.NS_ERROR_FAILURE); rc = delegate.createBaseWindow (baseWindow); if (rc != XPCOM.NS_OK) { browser.dispose ();
static String getCacheParentPath () { return getProfilePath (); }
@Override public void create (Composite parent, int style) { delegate = new MozillaDelegate (browser); final Display display = parent.getDisplay (); profilePath = MozillaDelegate.getProfilePath (); String cacheParentPath = MozillaDelegate.getCacheParentPath (); LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, cacheParentPath, IsXULRunner); LocationProvider.AddRef (); DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); downloadFactory_1_8.AddRef (); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true); byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtTransfer", true); //$NON-NLS-1$ rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ()); if (rc != XPCOM.NS_OK) { HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); dialogFactory.AddRef (); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true); byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtHelperAppLauncherDialog", true); //$NON-NLS-1$ rc = componentRegistrar.RegisterFactory (XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress ()); if (rc != XPCOM.NS_OK) { delegate.addWindowSubclass (); delegate.init ();
String libName = MozillaDelegate.getSWTInitLibraryName (); Library.loadLibrary (libName); initLoaded = true; MozillaPath += MozillaDelegate.getLibraryName (MozillaPath); IsXULRunner = true; byte[] bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true); int rc = XPCOMInit.XPCOMGlueStartup (bytes); if (rc != XPCOM.NS_OK) { int /*long*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, MOZILLA_FIVE_HOME, true)); if (ptr == 0) { IsXULRunner = false; bytes = new byte[length]; C.memmove (bytes, ptr, length); MozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes)); } else { MozillaPath += SEPARATOR_OS; MozillaPath += MozillaDelegate.getLibraryName (MozillaPath); bytes = MozillaDelegate.wcsToMbcs (null, MozillaPath, true); rc = XPCOMInit.XPCOMGlueStartup (bytes); if (rc == XPCOM.NS_OK) {
byte[] bytes = MozillaDelegate.wcsToMbcs (null, CookieUrl, false); int /*long*/ aSpec = XPCOM.nsEmbedCString_new (bytes, bytes.length); rc = ioService.NewURI (aSpec, null, 0, result); byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIESERVICE_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsICookieService.class), result); if (rc != XPCOM.NS_OK) error (rc); mozillaPath += MozillaDelegate.getLibraryName (mozillaPath) + '\0'; try { pathBytes_NSFree = mozillaPath.getBytes ("UTF-8"); //$NON-NLS-1$ String allCookies = new String (MozillaDelegate.mbcsToWcs (null, bytes)); StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens ()) {
embedHandle = delegate.getHandle (); error (XPCOM.NS_ERROR_FAILURE); rc = delegate.createBaseWindow (baseWindow); if (rc != XPCOM.NS_OK) { browser.dispose ();
static String getCacheParentPath () { return getProfilePath (); }
static byte[] getJSLibPathBytes () { if (jsLibPathBytes == null) { String[] names = MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR10) ? MozillaDelegate.getJSLibraryNames () : new String[] {MozillaDelegate.getJSLibraryName_Pre10 ()}; for (int i = 0; i < names.length; i++) { File file = new File (getMozillaPath (), names[i]); if (file.exists ()) { String pathString = file.getAbsolutePath () + '\0'; try { jsLibPathBytes = pathString.getBytes ("UTF-8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { jsLibPathBytes = pathString.getBytes (); } break; } } } return jsLibPathBytes; }