Closed Bug 84240 Opened 23 years ago Closed 23 years ago

no way to get unicode js_status and link_message

Categories

(Core Graveyard :: Embedding: APIs, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ftang, Assigned: blizzard)

Details

(Whiteboard: have patch; r=philipl sr=shaver; ready to checkin)

Attachments

(2 files)

this is a spin off from 79041
When I read /embedding/browser/gtk/src/gtkmozembed2.cpp I found some illegal 
usage of ToNewCString- Bascailly, ToNewCString should not be used for any string 
which could possible contains non ASCII data.
both js status and link message is possible to contains non ASCII data, there 
fore these two api is not good. 

833 char *
834 gtk_moz_embed_get_link_message(GtkMozEmbed *embed)
835 {
836   char *retval = nsnull;
837   EmbedPrivate *embedPrivate;
838   nsXPIDLCString embedString;
839 
840   g_return_val_if_fail ((embed != NULL), (char *)NULL);
841   g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (char *)NULL);
842 
843   embedPrivate = (EmbedPrivate *)embed->data;
844 
845   if (embedPrivate->mWindow) {
846     *getter_Copies(embedString) =
847       ToNewCString(embedPrivate->mWindow->mLinkMessage);
848     retval = strdup(embedString);
849   }
850 
851   return retval;
852 }
853 
854 char *
855 gtk_moz_embed_get_js_status(GtkMozEmbed *embed)
856 {
857   char *retval = nsnull;
858   EmbedPrivate *embedPrivate;
859   nsXPIDLCString embedString;
860 
861   g_return_val_if_fail ((embed != NULL), (char *)NULL);
862   g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (char *)NULL);
863 
864   embedPrivate = (EmbedPrivate *)embed->data;
865 
866   if (embedPrivate->mWindow) {
867     *getter_Copies(embedString) =
868       ToNewCString(embedPrivate->mWindow->mJSStatus);
869     retval = strdup(embedString);
870   }
871 
872   return retval;
873 }

to fix it, you can choose to add additional unicode version like what you did in 
79041 .
 
add gtk_moz_embed_get_js_status_unichar
and gtk_moz_embed_get_link_message_unichar
eungkyu@sparcs.org (Eungkyu Song)
do you have good test cases in galeon, nautilus, ... (embedding mozilla) to test 
js_status and link_message?
I've never gotten feature requests for uncidode friendly apis so I've never
implemented them.  It would be trivial to add functions to
gtkmozembed_internal.h in the style of gtk_moz_embed_get_title_unichar().
Status: NEW → ASSIGNED
Attached patch patchSplinter Review
Looking for reviews.
Whiteboard: have patch; r=? sr=?
Looks good to me. r=philipl
QA Contact: mdunn → dsirnapalli
Whiteboard: have patch; r=? sr=? → have patch; r=philipl sr=?
Comment on attachment 41601 [details] [diff] [review]
patch

Can we name the methods _ucs2 instead of unichar?  (Which might be UTF-16 or UTF-8 or wchar_t on Linux.)

I'd sr=shaver a renamed patch in a flash. =)
Talked shaver down.  I have an sr=shaver now.
Whiteboard: have patch; r=philipl sr=? → have patch; r=philipl sr=shaver; ready to checkin
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: