diff options
22 files changed, 993 insertions, 23 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java index 757f329b63..9f12a18afb 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java @@ -84,6 +84,74 @@ class Safari extends WebBrowser { } } }; + + NativeGetCookie = new Runnable () { + public void run () { + int storage = Cocoa.objc_msgSend (Cocoa.C_NSHTTPCookieStorage, Cocoa.S_sharedHTTPCookieStorage); + int length = CookieUrl.length (); + char[] buffer = new char[length]; + CookieUrl.getChars (0, length, buffer, 0); + int urlString = OS.CFStringCreateWithCharacters (0, buffer, length); + int url = Cocoa.objc_msgSend (Cocoa.C_NSURL, Cocoa.S_URLWithString, urlString); + OS.CFRelease (urlString); + int cookies = Cocoa.objc_msgSend (storage, Cocoa.S_cookiesForURL, url); + int count = Cocoa.objc_msgSend (cookies, Cocoa.S_count); + if (count == 0) return; + + length = CookieName.length (); + buffer = new char[length]; + CookieName.getChars (0, length, buffer, 0); + int name = OS.CFStringCreateWithCharacters (0, buffer, length); + for (int i = 0; i < count; i++) { + int current = Cocoa.objc_msgSend (cookies, Cocoa.S_objectAtIndex, i); + int currentName = Cocoa.objc_msgSend (current, Cocoa.S_name); + if (Cocoa.objc_msgSend (currentName, Cocoa.S_compare, name) == Cocoa.NSOrderedSame) { + int value = Cocoa.objc_msgSend (current, Cocoa.S_value); + length = OS.CFStringGetLength (value); + buffer = new char[length]; + CFRange range = new CFRange (); + range.length = length; + OS.CFStringGetCharacters (value, range, buffer); + CookieValue = new String (buffer); + OS.CFRelease (name); + return; + } + } + OS.CFRelease (name); + } + }; + + NativeSetCookie = new Runnable () { + public void run () { + int length = CookieUrl.length (); + char[] buffer = new char[length]; + CookieUrl.getChars (0, length, buffer, 0); + int urlString = OS.CFStringCreateWithCharacters (0, buffer, length); + int url = Cocoa.objc_msgSend (Cocoa.C_NSURL, Cocoa.S_URLWithString, urlString); + OS.CFRelease (urlString); + + length = CookieValue.length (); + buffer = new char[length]; + CookieValue.getChars (0, length, buffer, 0); + int value = OS.CFStringCreateWithCharacters (0, buffer, length); + String keyString = "Set-Cookie"; //$NON-NLS-1$ + length = keyString.length (); + buffer = new char[length]; + keyString.getChars (0, length, buffer, 0); + int key = OS.CFStringCreateWithCharacters (0, buffer, length); + int headers = Cocoa.objc_msgSend (Cocoa.C_NSMutableDictionary, Cocoa.S_dictionaryWithCapacity, 1); + Cocoa.objc_msgSend (headers, Cocoa.S_setValue, value, key); + OS.CFRelease (key); + OS.CFRelease (value); + + int cookies = Cocoa.objc_msgSend (Cocoa.C_NSHTTPCookie, Cocoa.S_cookiesWithResponseHeaderFields, headers, url); + if (Cocoa.objc_msgSend (cookies, Cocoa.S_count) == 0) return; + int cookie = Cocoa.objc_msgSend (cookies, Cocoa.S_objectAtIndex, 0); + int storage = Cocoa.objc_msgSend (Cocoa.C_NSHTTPCookieStorage, Cocoa.S_sharedHTTPCookieStorage); + Cocoa.objc_msgSend (storage, Cocoa.S_setCookie, cookie); + CookieResult = true; + } + }; } public void create (Composite parent, int style) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java index 95d9653507..4c37fd5965 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java @@ -74,6 +74,39 @@ class Safari extends WebBrowser { } } }; + + NativeGetCookie = new Runnable () { + public void run () { + NSHTTPCookieStorage storage = NSHTTPCookieStorage.sharedHTTPCookieStorage (); + NSURL url = NSURL.URLWithString (NSString.stringWith (CookieUrl)); + NSArray cookies = storage.cookiesForURL (url); + int count = cookies.count (); + if (count == 0) return; + + NSString name = NSString.stringWith (CookieName); + for (int i = 0; i < count; i++) { + NSHTTPCookie current = new NSHTTPCookie (cookies.objectAtIndex (i)); + if (current.name ().compare (name) == OS.NSOrderedSame) { + CookieValue = current.value ().getString (); + return; + } + } + } + }; + + NativeSetCookie = new Runnable () { + public void run () { + NSURL url = NSURL.URLWithString (NSString.stringWith (CookieUrl)); + NSMutableDictionary headers = NSMutableDictionary.dictionaryWithCapacity (1); + headers.setValue (NSString.stringWith (CookieValue), NSString.stringWith ("Set-Cookie")); //$NON-NLS-1$ + NSArray cookies = NSHTTPCookie.cookiesWithResponseHeaderFields (headers, url); + if (cookies.count () == 0) return; + NSHTTPCookieStorage storage = NSHTTPCookieStorage.sharedHTTPCookieStorage (); + NSHTTPCookie cookie = new NSHTTPCookie (cookies.objectAtIndex (0)); + storage.setCookie (cookie); + CookieResult = true; + } + }; } public void create (Composite parent, int style) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java index 766373f376..4bab99a655 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java @@ -173,6 +173,61 @@ public static void clearSessions () { WebBrowser.clearSessions (); } +/** + * TODO keep this method? if so doc it! + * + * @return <code>true</code> if the cookie was successfully deleted and <code>false</code> otherwise + * + * @since 3.5 + */ +public static void DeleteCookie (String name, String url) { + if (name == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + if (url == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + WebBrowser.DeleteCookie (name, url); +} +/** + * Returns the value of a cookie that is associated with a URL. + * Note that cookies are shared amongst all Browser instances. + * + * @param name the cookie name + * @param url the URL that the cookie is associated with + * @return the cookie value, or <code>null</code> if no such cookie exists + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the name is null</li> + * <li>ERROR_NULL_ARGUMENT - if the url is null</li> + * </ul> + * + * @since 3.5 + */ +public static String GetCookie (String name, String url) { + if (name == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + if (url == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + return WebBrowser.GetCookie (name, url); +} + +/** + * Sets a cookie on a URL. Note that cookies are shared amongst all Browser instances. + * + * TODO explain the value arg + * + * @param value the cookie value + * @param url the URL to associate the cookie with + * @return <code>true</code> if the cookie was successfully set and <code>false</code> otherwise + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the value is null</li> + * <li>ERROR_NULL_ARGUMENT - if the url is null</li> + * </ul> + * + * @since 3.5 + */ +public static boolean SetCookie (String value, String url) { + if (value == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + if (url == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + return WebBrowser.SetCookie (value, url); +} + /** * Adds the listener to the collection of listeners who will be * notified when the window hosting the receiver should be closed. diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java index 0746eca0ba..c698f61384 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java @@ -32,8 +32,11 @@ abstract class WebBrowser { static final String ERROR_ID = "org.eclipse.swt.browser.error"; // $NON-NLS-1$ static final String EXECUTE_ID = "SWTExecuteTemporaryFunction"; // $NON-NLS-1$ - static Runnable MozillaClearSessions; - static Runnable NativeClearSessions; + static String CookieName, CookieValue, CookieUrl; + static boolean CookieResult; + static Runnable MozillaClearSessions, NativeClearSessions; + static Runnable MozillaGetCookie, NativeGetCookie; + static Runnable MozillaSetCookie, NativeSetCookie; /* Key Mappings */ static final int [][] KeyTable = { @@ -249,6 +252,31 @@ public static void clearSessions () { if (MozillaClearSessions != null) MozillaClearSessions.run (); } +public static void DeleteCookie (String name, String url) { + CookieUrl = url; CookieValue = name + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; //$NON-NLS-1$ + if (NativeSetCookie != null) NativeSetCookie.run (); + if (MozillaSetCookie != null) MozillaSetCookie.run (); + CookieValue = CookieUrl = null; +} + +public static String GetCookie (String name, String url) { + CookieName = name; CookieUrl = url; + if (NativeGetCookie != null) NativeGetCookie.run (); + if (MozillaGetCookie != null) MozillaGetCookie.run (); + String result = CookieValue; + CookieName = CookieValue = CookieUrl = null; + return result; +} + +public static boolean SetCookie (String value, String url) { + CookieValue = value; CookieUrl = url; + CookieResult = false; + if (NativeSetCookie != null) NativeSetCookie.run (); + if (MozillaSetCookie != null) MozillaSetCookie.run (); + CookieValue = CookieUrl = null; + return CookieResult; +} + public abstract void create (Composite parent, int style); static String CreateErrorString (String error) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java index 13a5078c38..ff253f220a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java @@ -131,6 +131,41 @@ class IE extends WebBrowser { } }; + NativeGetCookie = new Runnable () { + public void run () { + TCHAR url = new TCHAR (0, CookieUrl, true); + TCHAR cookieData = new TCHAR (0, 8192); + int[] size = new int[] {cookieData.length ()}; + if (!OS.InternetGetCookie (url, null, cookieData, size)) { + /* original cookieData size was not large enough */ + size[0] /= TCHAR.sizeof; + cookieData = new TCHAR (0, size[0]); + if (!OS.InternetGetCookie (url, null, cookieData, size)) return; + } + String allCookies = cookieData.toString (0, size[0]); + StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$ + while (tokenizer.hasMoreTokens ()) { + String cookie = tokenizer.nextToken (); + int index = cookie.indexOf ('='); + if (index != -1) { + String name = cookie.substring (0, index).trim (); + if (name.equals (CookieName)) { + CookieValue = cookie.substring (index + 1).trim (); + return; + } + } + } + } + }; + + NativeSetCookie = new Runnable () { + public void run () { + TCHAR url = new TCHAR (0, CookieUrl, true); + TCHAR value = new TCHAR (0, CookieValue, true); + CookieResult = OS.InternetSetCookie (url, null, value); + } + }; + /* * Registry entry HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version indicates * which version of IE is installed. Check this value in order to determine version-specific diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp index a378162b6c..2535b2080d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp @@ -574,6 +574,38 @@ fail: } #endif +#if (!defined(NO__1VtblCall__IIIII_3B_3BI) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJIII_3B_3BI) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIII_3B_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6, jint arg7); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIII_3B_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6, jint arg7) +#else +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJIII_3B_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6, jint arg7); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJIII_3B_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jbyteArray arg5, jbyteArray arg6, jint arg7) +#endif +{ + jbyte *lparg5=NULL; + jbyte *lparg6=NULL; + jint rc = 0; +#ifndef JNI64 + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIIII_3B_3BI_FUNC); +#else + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJIII_3B_3BI_FUNC); +#endif + if (arg5) if ((lparg5 = env->GetByteArrayElements(arg5, NULL)) == NULL) goto fail; + if (arg6) if ((lparg6 = env->GetByteArrayElements(arg6, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jint, jint, jint, jbyte *, jbyte *, jint))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, arg4, lparg5, lparg6, arg7); +fail: + if (arg6 && lparg6) env->ReleaseByteArrayElements(arg6, lparg6, 0); + if (arg5 && lparg5) env->ReleaseByteArrayElements(arg5, lparg5, 0); +#ifndef JNI64 + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIIII_3B_3BI_FUNC); +#else + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJIII_3B_3BI_FUNC); +#endif + return rc; +} +#endif + #if (!defined(NO__1VtblCall__IIIII_3C) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJIII_3C) && defined(JNI64)) #ifndef JNI64 extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIII_3C)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jcharArray arg5); @@ -686,6 +718,35 @@ fail: } #endif +#if (!defined(NO__1VtblCall__IIII_3BI) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJII_3BI) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIII_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jbyteArray arg4, jint arg5); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIII_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jbyteArray arg4, jint arg5) +#else +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJII_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jbyteArray arg4, jint arg5); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJII_3BI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jbyteArray arg4, jint arg5) +#endif +{ + jbyte *lparg4=NULL; + jint rc = 0; +#ifndef JNI64 + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIII_3BI_FUNC); +#else + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJII_3BI_FUNC); +#endif + if (arg4) if ((lparg4 = env->GetByteArrayElements(arg4, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jint, jint, jbyte *, jint))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, lparg4, arg5); +fail: + if (arg4 && lparg4) env->ReleaseByteArrayElements(arg4, lparg4, 0); +#ifndef JNI64 + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIII_3BI_FUNC); +#else + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJII_3BI_FUNC); +#endif + return rc; +} +#endif + #if (!defined(NO__1VtblCall__IIII_3C) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJII_3C) && defined(JNI64)) #ifndef JNI64 extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIII_3C)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jcharArray arg4); @@ -2216,6 +2277,67 @@ JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJJJJJJ)(JNIEnv *env, jclass t } #endif +#if (!defined(NO__1VtblCall__IIJJJ_3B_3BJ) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJJJ_3B_3BJ) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJJ_3B_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jbyteArray arg5, jbyteArray arg6, jlong arg7); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJJ_3B_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jbyteArray arg5, jbyteArray arg6, jlong arg7) +#else +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJJ_3B_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jbyteArray arg5, jbyteArray arg6, jlong arg7); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJJ_3B_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jbyteArray arg5, jbyteArray arg6, jlong arg7) +#endif +{ + jbyte *lparg5=NULL; + jbyte *lparg6=NULL; + jint rc = 0; +#ifndef JNI64 + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIJJJ_3B_3BJ_FUNC); +#else + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJJJJ_3B_3BJ_FUNC); +#endif + if (arg5) if ((lparg5 = env->GetByteArrayElements(arg5, NULL)) == NULL) goto fail; + if (arg6) if ((lparg6 = env->GetByteArrayElements(arg6, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jlong, jlong, jbyte *, jbyte *, jlong))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, arg4, lparg5, lparg6, arg7); +fail: + if (arg6 && lparg6) env->ReleaseByteArrayElements(arg6, lparg6, 0); + if (arg5 && lparg5) env->ReleaseByteArrayElements(arg5, lparg5, 0); +#ifndef JNI64 + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIJJJ_3B_3BJ_FUNC); +#else + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJJJJ_3B_3BJ_FUNC); +#endif + return rc; +} +#endif + +#if (!defined(NO__1VtblCall__IIJJJ_3J) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJJJ_3J) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jlongArray arg5); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jlongArray arg5) +#else +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jlongArray arg5); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlong arg4, jlongArray arg5) +#endif +{ + jlong *lparg5=NULL; + jint rc = 0; +#ifndef JNI64 + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIJJJ_3J_FUNC); +#else + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJJJJ_3J_FUNC); +#endif + if (arg5) if ((lparg5 = env->GetLongArrayElements(arg5, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jlong, jlong, jlong *))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, arg4, lparg5); +fail: + if (arg5 && lparg5) env->ReleaseLongArrayElements(arg5, lparg5, 0); +#ifndef JNI64 + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIJJJ_3J_FUNC); +#else + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJJJJ_3J_FUNC); +#endif + return rc; +} +#endif + #if (!defined(NO__1VtblCall__IIJJ_3B) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJJ_3B) && defined(JNI64)) #ifndef JNI64 extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJ_3B)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jbyteArray arg4); @@ -2245,6 +2367,35 @@ fail: } #endif +#if (!defined(NO__1VtblCall__IIJJ_3BJ) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJJ_3BJ) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJ_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jbyteArray arg4, jlong arg5); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJ_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jbyteArray arg4, jlong arg5) +#else +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJ_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jbyteArray arg4, jlong arg5); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJ_3BJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jbyteArray arg4, jlong arg5) +#endif +{ + jbyte *lparg4=NULL; + jint rc = 0; +#ifndef JNI64 + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIJJ_3BJ_FUNC); +#else + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJJJ_3BJ_FUNC); +#endif + if (arg4) if ((lparg4 = env->GetByteArrayElements(arg4, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jlong, jbyte *, jlong))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, lparg4, arg5); +fail: + if (arg4 && lparg4) env->ReleaseByteArrayElements(arg4, lparg4, 0); +#ifndef JNI64 + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIJJ_3BJ_FUNC); +#else + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJJJ_3BJ_FUNC); +#endif + return rc; +} +#endif + #if (!defined(NO__1VtblCall__IIJJ_3CIJI) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJJ_3CIJI) && defined(JNI64)) #ifndef JNI64 extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJ_3CIJI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jcharArray arg4, jint arg5, jlong arg6, jint arg7); @@ -2367,6 +2518,35 @@ fail: } #endif +#if (!defined(NO__1VtblCall__IIJJ_3J) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJJ_3J) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlongArray arg4); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlongArray arg4) +#else +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlongArray arg4); +JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlongArray arg4) +#endif +{ + jlong *lparg4=NULL; + jint rc = 0; +#ifndef JNI64 + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIJJ_3J_FUNC); +#else + XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJJJ_3J_FUNC); +#endif + if (arg4) if ((lparg4 = env->GetLongArrayElements(arg4, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jlong, jlong *))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, lparg4); +fail: + if (arg4 && lparg4) env->ReleaseLongArrayElements(arg4, lparg4, 0); +#ifndef JNI64 + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIJJ_3J_FUNC); +#else + XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJJJ_3J_FUNC); +#endif + return rc; +} +#endif + #if (!defined(NO__1VtblCall__IIJLorg_eclipse_swt_internal_mozilla_nsID_2) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJLorg_eclipse_swt_internal_mozilla_nsID_2) && defined(JNI64)) #ifndef JNI64 extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJLorg_eclipse_swt_internal_mozilla_nsID_2)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jobject arg3); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp index eba049945d..dc196ef259 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int XPCOM_nativeFunctionCount = 180; -int XPCOM_nativeFunctionCallCount[180]; +int XPCOM_nativeFunctionCount = 186; +int XPCOM_nativeFunctionCallCount[186]; char * XPCOM_nativeFunctionNames[] = { "_1Call", "_1NS_1GetComponentManager", @@ -108,6 +108,11 @@ char * XPCOM_nativeFunctionNames[] = { "_1VtblCall__IJIIII_3I_3I", #endif #ifndef JNI64 + "_1VtblCall__IIIII_3B_3BI", +#else + "_1VtblCall__IJIII_3B_3BI", +#endif +#ifndef JNI64 "_1VtblCall__IIIII_3C", #else "_1VtblCall__IJIII_3C", @@ -128,6 +133,11 @@ char * XPCOM_nativeFunctionNames[] = { "_1VtblCall__IJII_3B", #endif #ifndef JNI64 + "_1VtblCall__IIII_3BI", +#else + "_1VtblCall__IJII_3BI", +#endif +#ifndef JNI64 "_1VtblCall__IIII_3C", #else "_1VtblCall__IJII_3C", @@ -373,11 +383,26 @@ char * XPCOM_nativeFunctionNames[] = { "_1VtblCall__IJJJJJJJJ", #endif #ifndef JNI64 + "_1VtblCall__IIJJJ_3B_3BJ", +#else + "_1VtblCall__IJJJJ_3B_3BJ", +#endif +#ifndef JNI64 + "_1VtblCall__IIJJJ_3J", +#else + "_1VtblCall__IJJJJ_3J", +#endif +#ifndef JNI64 "_1VtblCall__IIJJ_3B", #else "_1VtblCall__IJJJ_3B", #endif #ifndef JNI64 + "_1VtblCall__IIJJ_3BJ", +#else + "_1VtblCall__IJJJ_3BJ", +#endif +#ifndef JNI64 "_1VtblCall__IIJJ_3CIJI", #else "_1VtblCall__IJJJ_3CIJI", @@ -398,6 +423,11 @@ char * XPCOM_nativeFunctionNames[] = { "_1VtblCall__IJJJ_3I", #endif #ifndef JNI64 + "_1VtblCall__IIJJ_3J", +#else + "_1VtblCall__IJJJ_3J", +#endif +#ifndef JNI64 "_1VtblCall__IIJLorg_eclipse_swt_internal_mozilla_nsID_2", #else "_1VtblCall__IJJLorg_eclipse_swt_internal_mozilla_nsID_2", diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h index 8b7a983cb6..7a1a476160 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h @@ -116,6 +116,11 @@ typedef enum { _1VtblCall__IJIIII_3I_3I_FUNC, #endif #ifndef JNI64 + _1VtblCall__IIIII_3B_3BI_FUNC, +#else + _1VtblCall__IJIII_3B_3BI_FUNC, +#endif +#ifndef JNI64 _1VtblCall__IIIII_3C_FUNC, #else _1VtblCall__IJIII_3C_FUNC, @@ -136,6 +141,11 @@ typedef enum { _1VtblCall__IJII_3B_FUNC, #endif #ifndef JNI64 + _1VtblCall__IIII_3BI_FUNC, +#else + _1VtblCall__IJII_3BI_FUNC, +#endif +#ifndef JNI64 _1VtblCall__IIII_3C_FUNC, #else _1VtblCall__IJII_3C_FUNC, @@ -381,11 +391,26 @@ typedef enum { _1VtblCall__IJJJJJJJJ_FUNC, #endif #ifndef JNI64 + _1VtblCall__IIJJJ_3B_3BJ_FUNC, +#else + _1VtblCall__IJJJJ_3B_3BJ_FUNC, +#endif +#ifndef JNI64 + _1VtblCall__IIJJJ_3J_FUNC, +#else + _1VtblCall__IJJJJ_3J_FUNC, +#endif +#ifndef JNI64 _1VtblCall__IIJJ_3B_FUNC, #else _1VtblCall__IJJJ_3B_FUNC, #endif #ifndef JNI64 + _1VtblCall__IIJJ_3BJ_FUNC, +#else + _1VtblCall__IJJJ_3BJ_FUNC, +#endif +#ifndef JNI64 _1VtblCall__IIJJ_3CIJI_FUNC, #else _1VtblCall__IJJJ_3CIJI_FUNC, @@ -406,6 +431,11 @@ typedef enum { _1VtblCall__IJJJ_3I_FUNC, #endif #ifndef JNI64 + _1VtblCall__IIJJ_3J_FUNC, +#else + _1VtblCall__IJJJ_3J_FUNC, +#endif +#ifndef JNI64 _1VtblCall__IIJLorg_eclipse_swt_internal_mozilla_nsID_2_FUNC, #else _1VtblCall__IJJLorg_eclipse_swt_internal_mozilla_nsID_2_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java index e8febcb0c3..fec8449116 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java @@ -150,6 +150,143 @@ class Mozilla extends WebBrowser { enumerator.Release (); } }; + + MozillaGetCookie = new Runnable() { + public void run() { + if (!Initialized) return; + + int /*long*/[] result = new int /*long*/[1]; + int 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; + rc = serviceManager.GetService (XPCOM.NS_IOSERVICE_CID, nsIIOService.NS_IIOSERVICE_IID, result); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); + + nsIIOService ioService = new nsIIOService (result[0]); + result[0] = 0; + byte[] bytes = MozillaDelegate.wcsToMbcs (null, CookieUrl, false); + int /*long*/ aSpec = XPCOM.nsEmbedCString_new (bytes, bytes.length); + rc = ioService.NewURI (aSpec, null, 0, result); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) error (XPCOM.NS_ERROR_NULL_POINTER); + XPCOM.nsEmbedCString_delete (aSpec); + ioService.Release (); + + nsIURI aURI = new nsIURI (result[0]); + result[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIESERVICE_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, nsICookieService.NS_ICOOKIESERVICE_IID, result); + int /*long*/ cookieString; + if (rc == XPCOM.NS_OK && result[0] != 0) { + nsICookieService cookieService = new nsICookieService (result[0]); + result[0] = 0; + rc = cookieService.GetCookieString (aURI.getAddress(), 0, result); + cookieService.Release (); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) { + aURI.Release (); + serviceManager.Release (); + return; + } + cookieString = result[0]; + } else { + result[0] = 0; + rc = serviceManager.GetServiceByContractID (aContractID, nsICookieService_1_9.NS_ICOOKIESERVICE_IID, result); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); + nsICookieService_1_9 cookieService = new nsICookieService_1_9 (result[0]); + result[0] = 0; + rc = cookieService.GetCookieString(aURI.getAddress(), 0, result); + cookieService.Release (); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) { + aURI.Release (); + serviceManager.Release (); + return; + } + cookieString = result[0]; + } + aURI.Release (); + serviceManager.Release (); + result[0] = 0; + + int length = C.strlen (cookieString); + bytes = new byte[length]; + XPCOM.memmove (bytes, cookieString, length); + C.free (cookieString); + String allCookies = new String (MozillaDelegate.mbcsToWcs (null, bytes)); + StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$ + while (tokenizer.hasMoreTokens ()) { + String cookie = tokenizer.nextToken (); + int index = cookie.indexOf ('='); + if (index != -1) { + String name = cookie.substring (0, index).trim (); + if (name.equals (CookieName)) { + CookieValue = cookie.substring (index + 1).trim (); + return; + } + } + } + } + }; + + MozillaSetCookie = new Runnable() { + public void run() { + if (!Initialized) return; + + int /*long*/[] result = new int /*long*/[1]; + int 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; + rc = serviceManager.GetService (XPCOM.NS_IOSERVICE_CID, nsIIOService.NS_IIOSERVICE_IID, result); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); + + nsIIOService ioService = new nsIIOService (result[0]); + result[0] = 0; + byte[] bytes = MozillaDelegate.wcsToMbcs (null, CookieUrl, false); + int /*long*/ aSpec = XPCOM.nsEmbedCString_new (bytes, bytes.length); + rc = ioService.NewURI (aSpec, null, 0, result); + XPCOM.nsEmbedCString_delete (aSpec); + if (rc != XPCOM.NS_OK) { + ioService.Release (); + serviceManager.Release (); + return; + } + if (result[0] == 0) error (XPCOM.NS_ERROR_NULL_POINTER); + ioService.Release (); + + nsIURI aURI = new nsIURI(result[0]); + result[0] = 0; + byte[] aCookie = MozillaDelegate.wcsToMbcs (null, CookieValue, true); + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIESERVICE_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, nsICookieService.NS_ICOOKIESERVICE_IID, result); + if (rc == XPCOM.NS_OK && result[0] != 0) { + nsICookieService cookieService = new nsICookieService (result[0]); + rc = cookieService.SetCookieString (aURI.getAddress(), 0, aCookie, 0); + cookieService.Release (); + } else { + result[0] = 0; + rc = serviceManager.GetServiceByContractID (aContractID, nsICookieService_1_9.NS_ICOOKIESERVICE_IID, result); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); + nsICookieService_1_9 cookieService = new nsICookieService_1_9 (result[0]); + rc = cookieService.SetCookieString(aURI.getAddress(), 0, aCookie, 0); + cookieService.Release (); + } + result[0] = 0; + aURI.Release (); + serviceManager.Release (); + CookieResult = rc == 0; + } + }; } public void create (Composite parent, int style) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java index 6e6871cc97..ced5e8b0c5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java @@ -63,6 +63,7 @@ public class XPCOM extends C { public static final String EXTERNAL_CONTRACTID = "@eclipse.org/external;1"; //$NON-NLS-1$ public static final String NS_CONTEXTSTACK_CONTRACTID = "@mozilla.org/js/xpc/ContextStack;1"; //$NON-NLS-1$ public static final String NS_COOKIEMANAGER_CONTRACTID = "@mozilla.org/cookiemanager;1"; //$NON-NLS-1$ + public static final String NS_COOKIESERVICE_CONTRACTID = "@mozilla.org/cookieService;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$ @@ -957,6 +958,15 @@ static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, lock.unlock(); } } +static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long[] arg2); +static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long[] arg2) { + lock.lock(); + try { + return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); + } finally { + lock.unlock(); + } +} static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, long [] arg2); static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, long [] arg2) { lock.lock(); @@ -1273,6 +1283,15 @@ static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, lock.unlock(); } } +static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long[] arg3); +static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long[] arg3) { + lock.lock(); + try { + return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); + } finally { + lock.unlock(); + } +} static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int[] arg3); static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int[] arg3) { lock.lock(); @@ -1833,4 +1852,41 @@ static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, short[] type, long lock.unlock(); } } +static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, byte[] arg2, int arg3); +static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, byte[] arg2, int arg3) { + lock.lock(); + try { + return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); + } finally { + lock.unlock(); + } +} +static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, byte[] arg2, long arg3); +static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, byte[] arg2, long arg3) { + lock.lock(); + try { + return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); + } finally { + lock.unlock(); + } +} +static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, byte[] arg3, byte[] arg4, int arg5); +static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, byte[] arg3, byte[] arg4, int arg5) { + lock.lock(); + try { + return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); + } finally { + lock.unlock(); + } +} +static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, byte[] arg3, byte[] arg4, long arg5); +static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, byte[] arg3, byte[] arg4, long arg5) { + lock.lock(); + try { + return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); + } finally { + lock.unlock(); + } +} + } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICookieService.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICookieService.java new file mode 100644 index 0000000000..f3faf9bacd --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICookieService.java @@ -0,0 +1,64 @@ +package org.eclipse.swt.internal.mozilla;
+/* ***** 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 SWT
+ * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+public class nsICookieService extends nsISupports {
+
+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 5;
+
+ public static final String NS_ICOOKIESERVICE_IID_STR =
+ "011c3190-1434-11d6-a618-0010a401eb10";
+
+ public static final nsID NS_ICOOKIESERVICE_IID =
+ new nsID(NS_ICOOKIESERVICE_IID_STR);
+
+ public nsICookieService(int /*long*/ address) {
+ super(address);
+ }
+
+ public int GetCookieString(int /*long*/ aURI, int /*long*/ aChannel, int /*long*/[] _retval) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aURI, aChannel, _retval);
+ }
+
+ public int GetCookieStringFromHttp(int /*long*/ aURI, int /*long*/ aFirstURI, int /*long*/ aChannel, int /*long*/[] _retval) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aURI, aFirstURI, aChannel, _retval);
+ }
+
+ public int SetCookieString(int /*long*/ aURI, int /*long*/ aPrompt, byte[] aCookie, int /*long*/ aChannel) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aURI, aPrompt, aCookie, aChannel);
+ }
+
+ public int SetCookieStringFromHttp(int /*long*/ aURI, int /*long*/ aFirstURI, int /*long*/ aPrompt, byte[] aCookie, byte[] aServerTime, int /*long*/ aChannel) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aURI, aFirstURI, aPrompt, aCookie, aServerTime, aChannel);
+ }
+
+ public int GetCookieIconIsVisible(int[] aCookieIconIsVisible) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aCookieIconIsVisible);
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICookieService_1_9.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICookieService_1_9.java new file mode 100644 index 0000000000..0824f34bd5 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICookieService_1_9.java @@ -0,0 +1,59 @@ +/* ***** 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 SWT
+ * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+package org.eclipse.swt.internal.mozilla;
+
+public class nsICookieService_1_9 extends nsISupports {
+
+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4;
+
+ public static final String NS_ICOOKIESERVICE_IID_STR =
+ "2aaa897a-293c-4d2b-a657-8c9b7136996d";
+
+ public static final nsID NS_ICOOKIESERVICE_IID =
+ new nsID(NS_ICOOKIESERVICE_IID_STR);
+
+ public nsICookieService_1_9(int /*long*/ address) {
+ super(address);
+ }
+
+ public int GetCookieString(int /*long*/ aURI, int /*long*/ aChannel, int /*long*/[] _retval) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aURI, aChannel, _retval);
+ }
+
+ public int GetCookieStringFromHttp(int /*long*/ aURI, int /*long*/ aFirstURI, int /*long*/ aChannel, int /*long*/[] _retval) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aURI, aFirstURI, aChannel, _retval);
+ }
+
+ public int SetCookieString(int /*long*/ aURI, int /*long*/ aPrompt, byte[] aCookie, int /*long*/ aChannel) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aURI, aPrompt, aCookie, aChannel);
+ }
+
+ public int SetCookieStringFromHttp(int /*long*/ aURI, int /*long*/ aFirstURI, int /*long*/ aPrompt, byte[] aCookie, byte[] aServerTime, int /*long*/ aChannel) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aURI, aFirstURI, aPrompt, aCookie, aServerTime, aChannel);
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java index 2422c595a4..6dff5ad55a 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java @@ -20,6 +20,7 @@ static { } /* Objective-C class ids */ +public static final int C_NSHTTPCookie = Cocoa.objc_getClass("NSHTTPCookie"); //$NON-NLS-1$ public static final int C_NSHTTPCookieStorage = Cocoa.objc_getClass("NSHTTPCookieStorage"); //$NON-NLS-1$ public static final int C_NSNotificationCenter = Cocoa.objc_getClass("NSNotificationCenter"); //$NON-NLS-1$ public static final int C_NSNumber = Cocoa.objc_getClass("NSNumber"); //$NON-NLS-1$ @@ -42,6 +43,7 @@ public static final int C_NSButton = Cocoa.objc_getClass("NSButton"); //$NON-NLS public static final int C_NSObject = Cocoa.objc_getClass("NSObject"); //$NON-NLS-1$ public static final int C_NSString = Cocoa.objc_getClass("NSString"); //$NON-NLS-1$ public static final int C_NSMutableArray = Cocoa.objc_getClass("NSMutableArray"); //$NON-NLS-1$ +public static final int C_NSMutableDictionary = Cocoa.objc_getClass("NSMutableDictionary"); //$NON-NLS-1$ public static final int C_WebScriptObject = Cocoa.objc_getClass("WebScriptObject"); //$NON-NLS-1$ public static final int C_WebUndefined = Cocoa.objc_getClass("WebUndefined"); //$NON-NLS-1$ @@ -58,13 +60,17 @@ public static final int S_canGoBack = Cocoa.sel_registerName("canGoBack"); //$NO public static final int S_canGoForward = Cocoa.sel_registerName("canGoForward"); //$NON-NLS-1$ public static final int S_canShowMIMEType = Cocoa.sel_registerName("canShowMIMEType:"); //$NON-NLS-1$ public static final int S_chooseFilename = Cocoa.sel_registerName("chooseFilename:"); //$NON-NLS-1$ +public static final int S_compare = Cocoa.sel_registerName("compare:"); //$NON-NLS-1$ public static final int S_cookies = Cocoa.sel_registerName("cookies"); //$NON-NLS-1$ +public static final int S_cookiesWithResponseHeaderFields = Cocoa.sel_registerName("cookiesWithResponseHeaderFields:forURL:"); //$NON-NLS-1$ +public static final int S_cookiesForURL = Cocoa.sel_registerName("cookiesForURL:"); //$NON-NLS-1$ public static final int S_copy = Cocoa.sel_registerName("copy:"); //$NON-NLS-1$ public static final int S_count = Cocoa.sel_registerName("count"); //$NON-NLS-1$ public static final int S_cut = Cocoa.sel_registerName("cut:"); //$NON-NLS-1$ public static final int S_dataSource = Cocoa.sel_registerName("dataSource"); //$NON-NLS-1$ public static final int S_defaultCenter = Cocoa.sel_registerName("defaultCenter"); //$NON-NLS-1$ public static final int S_deleteCookie = Cocoa.sel_registerName("deleteCookie:"); //$NON-NLS-1$ +public static final int S_dictionaryWithCapacity = Cocoa.sel_registerName("dictionaryWithCapacity:"); //$NON-NLS-1$ public static final int S_documentSource = Cocoa.sel_registerName("documentSource"); //$NON-NLS-1$ public static final int S_doubleValue = Cocoa.sel_registerName("doubleValue"); //$NON-NLS-1$ public static final int S_download = Cocoa.sel_registerName("download"); //$NON-NLS-1$ @@ -100,6 +106,7 @@ public static final int S_requestWithURL = Cocoa.sel_registerName("requestWithUR public static final int S_request = Cocoa.sel_registerName("request"); //$NON-NLS-1$ public static final int S_retainCount = Cocoa.sel_registerName("retainCount"); //$NON-NLS-1$ public static final int S_setApplicationNameForUserAgent = Cocoa.sel_registerName("setApplicationNameForUserAgent:"); //$NON-NLS-1$ +public static final int S_setCookie = Cocoa.sel_registerName("setCookie:"); //$NON-NLS-1$ public static final int S_setDestinationAllowOverwrite = Cocoa.sel_registerName("setDestination:allowOverwrite:"); //$NON-NLS-1$ public static final int S_setDownloadDelegate = Cocoa.sel_registerName("setDownloadDelegate:"); //$NON-NLS-1$ public static final int S_setFrameLoadDelegate = Cocoa.sel_registerName("setFrameLoadDelegate:"); //$NON-NLS-1$ @@ -185,6 +192,7 @@ public static final int S_webScriptValueAtIndex = Cocoa.sel_registerName("webScr public static final int S_getCharacters_ = Cocoa.sel_registerName("getCharacters:"); //$NON-NLS-1$ public static final int S_objCType = Cocoa.sel_registerName("objCType"); //$NON-NLS-1$ public static final int S_setPreferences = Cocoa.sel_registerName("setPreferences:"); //$NON-NLS-1$ +public static final int S_value = Cocoa.sel_registerName("value"); //$NON-NLS-1$ public static final int NSAlphaFirstBitmapFormat = 1 << 0; public static final int NSAlphaNonpremultipliedBitmapFormat = 1 << 1; @@ -196,6 +204,8 @@ public static final int NSLineToBezierPathElement = 1; public static final int NSCurveToBezierPathElement = 2; public static final int NSClosePathBezierPathElement = 3; +public static final int NSOrderedSame = 0; + /* WebKit */ /** @param outView cast=(HIViewRef *) */ public static final native int HIWebViewCreate(int[] outView); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras index 485ffc523c..e510281e66 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras @@ -5235,10 +5235,10 @@ <arg name="properties"></arg> <retval></retval> </method> -<method class_method="true" selector="cookiesWithResponseHeaderFields:forURL:"> -<arg name="headerFields"></arg> -<arg name="URL"></arg> -<retval></retval> +<method class_method="true" selector="cookiesWithResponseHeaderFields:forURL:" swt_gen="true"> +<arg name="headerFields" swt_gen="true"></arg> +<arg name="URL" swt_gen="true"></arg> +<retval swt_gen="true"></retval> </method> <method selector="domain"> <retval></retval> @@ -5256,8 +5256,8 @@ <method selector="isSessionOnly" swt_gen="true"> <retval swt_gen="true"></retval> </method> -<method selector="name"> -<retval></retval> +<method selector="name" swt_gen="true"> +<retval swt_gen="true"></retval> </method> <method selector="path"> <retval></retval> @@ -5272,8 +5272,8 @@ <arg name="cookies"></arg> <retval></retval> </method> -<method selector="value"> -<retval></retval> +<method selector="value" swt_gen="true"> +<retval swt_gen="true"></retval> </method> <method selector="version"> <retval></retval> @@ -5286,17 +5286,17 @@ <method selector="cookies" swt_gen="true"> <retval swt_gen="true"></retval> </method> -<method selector="cookiesForURL:"> -<arg name="URL"></arg> -<retval></retval> +<method selector="cookiesForURL:" swt_gen="true"> +<arg name="URL" swt_gen="true"></arg> +<retval swt_gen="true"></retval> </method> <method selector="deleteCookie:" swt_gen="true"> <arg name="cookie" swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> -<method selector="setCookie:"> -<arg name="cookie"></arg> -<retval></retval> +<method selector="setCookie:" swt_gen="true"> +<arg name="cookie" swt_gen="true"></arg> +<retval swt_gen="true"></retval> </method> <method selector="setCookieAcceptPolicy:"> <arg name="cookieAcceptPolicy"></arg> @@ -10487,9 +10487,9 @@ <arg name="mask"></arg> <retval></retval> </method> -<method selector="compare:"> -<arg name="string"></arg> -<retval></retval> +<method selector="compare:" swt_gen="true"> +<arg name="string" swt_gen="true"></arg> +<retval swt_gen="true"></retval> </method> <method selector="compare:options:"> <arg name="string"></arg> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookie.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookie.java index 4d22bc934c..808a708c8a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookie.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookie.java @@ -24,8 +24,23 @@ public NSHTTPCookie(id id) { super(id); } +public static NSArray cookiesWithResponseHeaderFields(NSDictionary headerFields, NSURL URL) { + int /*long*/ result = OS.objc_msgSend(OS.class_NSHTTPCookie, OS.sel_cookiesWithResponseHeaderFields_forURL_, headerFields != null ? headerFields.id : 0, URL != null ? URL.id : 0); + return result != 0 ? new NSArray(result) : null; +} + public boolean isSessionOnly() { return OS.objc_msgSend_bool(this.id, OS.sel_isSessionOnly); } +public NSString name() { + int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_name); + return result != 0 ? new NSString(result) : null; +} + +public NSString value() { + int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_value); + return result != 0 ? new NSString(result) : null; +} + } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookieStorage.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookieStorage.java index 1b5f846f5a..6bbb3d9da6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookieStorage.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSHTTPCookieStorage.java @@ -29,10 +29,19 @@ public NSArray cookies() { return result != 0 ? new NSArray(result) : null; } +public NSArray cookiesForURL(NSURL URL) { + int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_cookiesForURL_, URL != null ? URL.id : 0); + return result != 0 ? new NSArray(result) : null; +} + public void deleteCookie(NSHTTPCookie cookie) { OS.objc_msgSend(this.id, OS.sel_deleteCookie_, cookie != null ? cookie.id : 0); } +public void setCookie(NSHTTPCookie cookie) { + OS.objc_msgSend(this.id, OS.sel_setCookie_, cookie != null ? cookie.id : 0); +} + public static NSHTTPCookieStorage sharedHTTPCookieStorage() { int /*long*/ result = OS.objc_msgSend(OS.class_NSHTTPCookieStorage, OS.sel_sharedHTTPCookieStorage); return result != 0 ? new NSHTTPCookieStorage(result) : null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSString.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSString.java index 144b9e62cc..e40c67ab4e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSString.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSString.java @@ -44,6 +44,10 @@ public int /*long*/ characterAtIndex(int /*long*/ index) { return OS.objc_msgSend(this.id, OS.sel_characterAtIndex_, index); } +public int /*long*/ compare(NSString string) { + return OS.objc_msgSend(this.id, OS.sel_compare_, string != null ? string.id : 0); +} + public void getCharacters(char[] buffer) { OS.objc_msgSend(this.id, OS.sel_getCharacters_, buffer); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 855cf76bfd..8912a04b95 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -668,6 +668,7 @@ public static final int /*long*/ sel_columnAtPoint_ = sel_registerName("columnAt public static final int /*long*/ sel_columnIndexesInRect_ = sel_registerName("columnIndexesInRect:"); public static final int /*long*/ sel_columnWithIdentifier_ = sel_registerName("columnWithIdentifier:"); public static final int /*long*/ sel_comboBoxSelectionDidChange_ = sel_registerName("comboBoxSelectionDidChange:"); +public static final int /*long*/ sel_compare_ = sel_registerName("compare:"); public static final int /*long*/ sel_concat = sel_registerName("concat"); public static final int /*long*/ sel_conformsToProtocol_ = sel_registerName("conformsToProtocol:"); public static final int /*long*/ sel_containerSize = sel_registerName("containerSize"); @@ -705,6 +706,8 @@ public static final int /*long*/ sel_convertSize_toView_ = sel_registerName("con public static final int /*long*/ sel_convertSizeFromBase_ = sel_registerName("convertSizeFromBase:"); public static final int /*long*/ sel_convertSizeToBase_ = sel_registerName("convertSizeToBase:"); public static final int /*long*/ sel_cookies = sel_registerName("cookies"); +public static final int /*long*/ sel_cookiesForURL_ = sel_registerName("cookiesForURL:"); +public static final int /*long*/ sel_cookiesWithResponseHeaderFields_forURL_ = sel_registerName("cookiesWithResponseHeaderFields:forURL:"); public static final int /*long*/ sel_copiesOnScroll = sel_registerName("copiesOnScroll"); public static final int /*long*/ sel_copy = sel_registerName("copy"); public static final int /*long*/ sel_copy_ = sel_registerName("copy:"); @@ -1263,6 +1266,7 @@ public static final int /*long*/ sel_setContainerSize_ = sel_registerName("setCo public static final int /*long*/ sel_setContentView_ = sel_registerName("setContentView:"); public static final int /*long*/ sel_setContentViewMargins_ = sel_registerName("setContentViewMargins:"); public static final int /*long*/ sel_setControlSize_ = sel_registerName("setControlSize:"); +public static final int /*long*/ sel_setCookie_ = sel_registerName("setCookie:"); public static final int /*long*/ sel_setCopiesOnScroll_ = sel_registerName("setCopiesOnScroll:"); public static final int /*long*/ sel_setCurrentContext_ = sel_registerName("setCurrentContext:"); public static final int /*long*/ sel_setCurrentOperation_ = sel_registerName("setCurrentOperation:"); @@ -1526,6 +1530,7 @@ public static final int /*long*/ sel_usedRectForTextContainer_ = sel_registerNam public static final int /*long*/ sel_userInfo = sel_registerName("userInfo"); public static final int /*long*/ sel_usesAlternatingRowBackgroundColors = sel_registerName("usesAlternatingRowBackgroundColors"); public static final int /*long*/ sel_validAttributesForMarkedText = sel_registerName("validAttributesForMarkedText"); +public static final int /*long*/ sel_value = sel_registerName("value"); public static final int /*long*/ sel_valueForKey_ = sel_registerName("valueForKey:"); public static final int /*long*/ sel_valueWithPoint_ = sel_registerName("valueWithPoint:"); public static final int /*long*/ sel_valueWithRange_ = sel_registerName("valueWithRange:"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c index c0e0ecdf6a..afca653ee1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c @@ -7219,6 +7219,100 @@ fail: } #endif +#ifndef NO_InternetGetCookieA +JNIEXPORT jboolean JNICALL OS_NATIVE(InternetGetCookieA) + (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jbyteArray arg2, jintArray arg3) +{ + jbyte *lparg0=NULL; + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; + jint *lparg3=NULL; + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, InternetGetCookieA_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail; + rc = (jboolean)InternetGetCookieA((LPCTSTR)lparg0, (LPCTSTR)lparg1, (LPSTR)lparg2, lparg3); +fail: + if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, InternetGetCookieA_FUNC); + return rc; +} +#endif + +#ifndef NO_InternetGetCookieW +JNIEXPORT jboolean JNICALL OS_NATIVE(InternetGetCookieW) + (JNIEnv *env, jclass that, jcharArray arg0, jcharArray arg1, jcharArray arg2, jintArray arg3) +{ + jchar *lparg0=NULL; + jchar *lparg1=NULL; + jchar *lparg2=NULL; + jint *lparg3=NULL; + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, InternetGetCookieW_FUNC); + if (arg0) if ((lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail; + rc = (jboolean)InternetGetCookieW((LPCWSTR)lparg0, (LPCWSTR)lparg1, (LPWSTR)lparg2, lparg3); +fail: + if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); + if (arg2 && lparg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, InternetGetCookieW_FUNC); + return rc; +} +#endif + +#ifndef NO_InternetSetCookieA +JNIEXPORT jboolean JNICALL OS_NATIVE(InternetSetCookieA) + (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jbyteArray arg2) +{ + jbyte *lparg0=NULL; + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, InternetSetCookieA_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jboolean)InternetSetCookieA((LPCTSTR)lparg0, (LPCTSTR)lparg1, (LPCTSTR)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, InternetSetCookieA_FUNC); + return rc; +} +#endif + +#ifndef NO_InternetSetCookieW +JNIEXPORT jboolean JNICALL OS_NATIVE(InternetSetCookieW) + (JNIEnv *env, jclass that, jcharArray arg0, jcharArray arg1, jcharArray arg2) +{ + jchar *lparg0=NULL; + jchar *lparg1=NULL; + jchar *lparg2=NULL; + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, InternetSetCookieW_FUNC); + if (arg0) if ((lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jboolean)InternetSetCookieW((LPCWSTR)lparg0, (LPCWSTR)lparg1, (LPCWSTR)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, InternetSetCookieW_FUNC); + return rc; +} +#endif + #ifndef NO_InternetSetOption JNIEXPORT jboolean JNICALL OS_NATIVE(InternetSetOption) (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLong arg2, jint arg3) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c index 95311e6d81..a551bb6589 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 960; -int OS_nativeFunctionCallCount[960]; +int OS_nativeFunctionCount = 964; +int OS_nativeFunctionCallCount[964]; char * OS_nativeFunctionNames[] = { "ACCEL_1sizeof", "ACTCTX_1sizeof", @@ -538,6 +538,10 @@ char * OS_nativeFunctionNames[] = { "InsertMenuItemA", "InsertMenuItemW", "InsertMenuW", + "InternetGetCookieA", + "InternetGetCookieW", + "InternetSetCookieA", + "InternetSetCookieW", "InternetSetOption", "IntersectClipRect", "IntersectRect", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h index 6014e86993..4a2ce759fa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h @@ -546,6 +546,10 @@ typedef enum { InsertMenuItemA_FUNC, InsertMenuItemW_FUNC, InsertMenuW_FUNC, + InternetGetCookieA_FUNC, + InternetGetCookieW_FUNC, + InternetSetCookieA_FUNC, + InternetSetCookieW_FUNC, InternetSetOption_FUNC, IntersectClipRect_FUNC, IntersectRect_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java index 34dec7f468..65195df631 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java @@ -2762,6 +2762,32 @@ public static final int ImmGetCompositionString (int /*long*/ hIMC, int dwIndex, return ImmGetCompositionStringA (hIMC, dwIndex, lpBuf1, dwBufLen); } +public static final boolean InternetGetCookie (TCHAR lpszUrl, TCHAR lpszCookieName, TCHAR lpszCookieData, int[] lpdwSize) { + if (IsUnicode) { + char [] url = lpszUrl == null ? null : lpszUrl.chars; + char [] cookieName = lpszCookieName == null ? null : lpszCookieName.chars; + char [] cookieData = lpszCookieData == null ? null : lpszCookieData.chars; + return InternetGetCookieW (url, cookieName, cookieData, lpdwSize); + } + byte [] url = lpszUrl == null ? null : lpszUrl.bytes; + byte [] cookieName = lpszCookieName == null ? null : lpszCookieName.bytes; + byte [] cookieData = lpszCookieData == null ? null : lpszCookieData.bytes; + return InternetGetCookieA (url, cookieName, cookieData, lpdwSize); +} + +public static final boolean InternetSetCookie (TCHAR lpszUrl, TCHAR lpszCookieName, TCHAR lpszCookieData) { + if (IsUnicode) { + char [] url = lpszUrl == null ? null : lpszUrl.chars; + char [] cookieName = lpszCookieName == null ? null : lpszCookieName.chars; + char [] cookieData = lpszCookieData == null ? null : lpszCookieData.chars; + return InternetSetCookieW (url, cookieName, cookieData); + } + byte [] url = lpszUrl == null ? null : lpszUrl.bytes; + byte [] cookieName = lpszCookieName == null ? null : lpszCookieName.bytes; + byte [] cookieData = lpszCookieData == null ? null : lpszCookieData.bytes; + return InternetSetCookieA (url, cookieName, cookieData); +} + public static final boolean InsertMenu (int /*long*/ hMenu, int uPosition, int uFlags, int /*long*/ uIDNewItem, TCHAR lpNewItem) { if (IsUnicode) { char [] lpNewItem1 = lpNewItem == null ? null : lpNewItem.chars; @@ -4620,6 +4646,30 @@ public static final native boolean InsertMenuItemW (int /*long*/ hMenu, int uIte /** @param hMenu cast=(HMENU) */ public static final native boolean InsertMenuItemA (int /*long*/ hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii); /** + * @param lpszUrl cast=(LPCTSTR) + * @param lpszCookieName cast=(LPCTSTR) + * @param lpszCookieData cast=(LPSTR) + */ +public static final native boolean InternetGetCookieA (byte[] lpszUrl, byte[] lpszCookieName, byte[] lpszCookieData, int[] lpdwSize); +/** + * @param lpszUrl cast=(LPCWSTR) + * @param lpszCookieName cast=(LPCWSTR) + * @param lpszCookieData cast=(LPWSTR) + */ +public static final native boolean InternetGetCookieW (char[] lpszUrl, char[] lpszCookieName, char[] lpszCookieData, int[] lpdwSize); +/** + * @param lpszUrl cast=(LPCTSTR) + * @param lpszCookieName cast=(LPCTSTR) + * @param lpszCookieData cast=(LPCTSTR) + */ +public static final native boolean InternetSetCookieA (byte[] lpszUrl, byte[] lpszCookieName, byte[] lpszCookieData); +/** + * @param lpszUrl cast=(LPCWSTR) + * @param lpszCookieName cast=(LPCWSTR) + * @param lpszCookieData cast=(LPCWSTR) + */ +public static final native boolean InternetSetCookieW (char[] lpszUrl, char[] lpszCookieName, char[] lpszCookieData); +/** * @param hInternet cast=(HINTERNET) * @param lpBuffer cast=(LPVOID) */ |