Expose Cookies functionality to java

Assigned to


Core Graveyard
Java APIs to WebShell
17 years ago
5 years ago


(Reporter: edburns, Assigned: edburns)


Firefox Tracking Flags

(Not tracked)



(5 attachments)



17 years ago
There are three parts to this.

1. Prefs.  Make it so the user can set cookie prefs

2. Make it so the user can be prompted when the server wishes to set a cookie, 
if the prefs say that the user wants to be prompted.

3. Enable the custom app to set cookies.

Comment 1

17 years ago
Created attachment 20420 [details]
tar.gz, checkpoint.  Implements webclient side of part 2.

Comment 2

17 years ago
Created attachment 20484 [details]
tar.gz, final implementation of UniversalDialog support.

Comment 3

17 years ago
How to test this bug.

1. Remove your .mozilla directory, or equivalent

1.5 Set up the proxy preferences so you can get to bugzilla.mozilla.org.

2. Start mozilla and go to Edit-Preferences->Advanced->Cookies.

3. Remove all Cookies

4. Accept all cookies, and warn me before accepting cookes

5. Stop mozilla.

Start webclient and visit
<http://bugzilla.mozilla.org/enter_bug.cgi?product=Browser>, then enter
your bugzilla userid and password.  A Confirm dialog should come up.
Make sure that the dialog does the right thing, that is, if you accept
the cookie, exit webclient, start up mozilla, and use the cookie viewer
to see that the cookie is there.  Please note that you see the Enter a
bug page whether you accept the cookie or not.

A classes_spec/org/mozilla/webclient/Cookies.java
M classes_spec/org/mozilla/webclient/Navigation.java
M classes_spec/org/mozilla/webclient/Prompt.java
M classes_spec/org/mozilla/webclient/test/EMWindow.java
M classes_spec/org/mozilla/webclient/test/PasswordDialog.java
A classes_spec/org/mozilla/webclient/test/UniversalDialog.java
M src_moz/CBrowserContainer.cpp
M src_moz/Makefile.win
A src_moz/PromptActionEvents.cpp
A src_moz/PromptActionEvents.h
M src_moz/ns_util.cpp
M src_moz/ns_util.h
M src_share/jni_util.cpp
M src_share/jni_util.h

Comment 4

17 years ago
Created attachment 20494 [details]
tar.gz checkpoint, prefs part.

Comment 5

17 years ago
Created attachment 20509 [details]
tar.gz, woking first iteration of prefs, Can setPrefs!

Comment 6

17 years ago
tested on Solaris - r=ashuk

Comment 7

17 years ago
Diff of changes needed in src_moz/motif/NativeLoaderStub.cpp for code to work on


ashuk@versailles[147]>diff NativeLoaderStub.cpp
< void (* nativeSetUnicharPref) (JNIEnv *env, jobject obj, jstring, jstring);
< void (* nativeSetIntPref) (JNIEnv *env, jobject obj, jstring, jint);
< void (* nativeSetBoolPref) (JNIEnv *env, jobject obj, jstring, jboolean);
> void (* nativeSetUnicharPref) (JNIEnv *, jobject, jstring, jstring);
> void (* nativeSetIntPref) (JNIEnv *, jobject, jstring, jint);
> void (* nativeSetBoolPref) (JNIEnv *, jobject, jstring, jboolean);
<   nativeSetUnicharPref = (void (*) (JNIEnv *env, jobject obj, jstring,
jstring)) dlsym(dll,
>   nativeSetUnicharPref = (void (*) (JNIEnv *, jobject, jstring, jstring))
<   nativeSetIntPref = (void (*) (JNIEnv *env, jobject obj, jstring, jint))
>   nativeSetIntPref = (void (*) (JNIEnv *, jobject, jstring, jint)) dlsym(dll,
<   nativeSetBoolPref = (void (*) (JNIEnv *env, jobject obj, jstring, jboolean))
>   nativeSetBoolPref = (void (*) (JNIEnv *, jobject, jstring, jboolean))


Ed, pls review.


17 years ago
QA Contact: geetha.vaidyanaathan → avm

Comment 8

16 years ago
Created attachment 40435 [details]
Set/Get cookie functionality

Comment 9

16 years ago
I have had a go at implementing part 3 of this (Enable the custom app to set 
cookies). I have only implemented Cookies.setCookieString and 
Cookies.getCookieString. This seems to work for me so hopefully it might turn 
out to be useful for an addition to webclient.

I am not too sure about the prompt parameter in CookiesActionEvents.cpp for the 
call to nsICookieServices.setCookieString. I have left it to nsnull for now.
Component: Java APIs to WebShell → Java APIs to WebShell
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.