Bug 25466 - WebKitGtk+ 1.1.6 prints weird error messages in Liferea
Summary: WebKitGtk+ 1.1.6 prints weird error messages in Liferea
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2009-04-29 12:42 PDT by Adrian Bunk
Modified: 2009-05-02 12:40 PDT (History)
3 users (show)

See Also:


Attachments
error on line 81 at column 12: expected '>' (deleted)
2009-04-29 12:43 PDT, Adrian Bunk
no flags Details
error on line 58 at column 3: Extra content at the end of the document (deleted)
2009-04-29 12:45 PDT, Adrian Bunk
no flags Details
error on line 66 at column 38: expected '>' (deleted)
2009-04-29 12:47 PDT, Adrian Bunk
no flags Details
Calculate the size of the string correctly (1.52 KB, patch)
2009-05-02 05:44 PDT, Gustavo Noronha (kov)
zecke: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Bunk 2009-04-29 12:42:04 PDT
I'll attach examples.
Comment 1 Adrian Bunk 2009-04-29 12:43:47 PDT
Created attachment 29890 [details]
error on line 81 at column 12: expected '>'

it complains about the "h" in the </html> tag
Comment 2 Adrian Bunk 2009-04-29 12:45:58 PDT
Created attachment 29891 [details]
error on line 58 at column 3: Extra content at the end of the document

the "extra content" is the </body></html>
Comment 3 Adrian Bunk 2009-04-29 12:47:20 PDT
Created attachment 29892 [details]
error on line 66 at column 38: expected '>'

that's in the middle of the href of <a href="liferea-refresh-comments://lxccyfn-227638"><span>Refresh</span></a>
Comment 4 Adrian Bunk 2009-04-29 13:20:56 PDT
the call to webkit_web_view_load_string() is in https://liferea.svn.sourceforge.net/svnroot/liferea/trunk/liferea/src/webkit/webkit.c

Call to webkit_web_view_load_string():

Breakpoint 1, webkit_web_view_load_string (webView=0x182e0b0, 
    content=0x1a89380 "<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtm"..., mimeType=0x46237a "application/xhtml+xml", encoding=0x461614 "UTF-8", 
    baseUri=0x46109f "file://") at WebKit/gtk/webkit/webkitwebview.cpp:2483
2483    {
Comment 5 Adrian Bunk 2009-04-29 13:29:17 PDT
For one optically visible problem (the last of my 3 examples) I have confirmed that the problem is not present with 1.1.5.
Comment 6 Gustavo Noronha (kov) 2009-05-01 20:40:50 PDT
I found the problem, apparently. The problem is that the error code patch refactored the loading of string into a shared function, which mistakenly calls g_utf8_strlen on the string that is to be loaded, so any string with !ascii UTF-8 characters will have some content stripped from the end when creating the SharedBuffer:

    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(content, g_utf8_strlen(content, -1));

I'm cooking a patch.
Comment 7 Gustavo Noronha (kov) 2009-05-02 05:44:30 PDT
Created attachment 29956 [details]
Calculate the size of the string correctly

 WebKit/gtk/ChangeLog                 |   13 +++++++++++++
 WebKit/gtk/webkit/webkitwebframe.cpp |    2 +-
 2 files changed, 14 insertions(+), 1 deletions(-)
Comment 8 Holger Freyther 2009-05-02 12:31:47 PDT
Comment on attachment 29956 [details]
Calculate the size of the string correctly


> -    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(content, g_utf8_strlen(content, -1));
> +    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(content, strlen(content));


Yes it makes sense, maybe you also want to add a unit test and compare the html with the one we set?
Comment 9 Gustavo Noronha (kov) 2009-05-02 12:36:55 PDT
(In reply to comment #8)
> (From update of attachment 29956 [details] [review])
> 
> > -    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(content, g_utf8_strlen(content, -1));
> > +    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(content, strlen(content));
> 
> 
> Yes it makes sense, maybe you also want to add a unit test and compare the html
> with the one we set?

We have no proper way of getting the source code backing a frame, 'till Jan's DataSource patch is landed. I will add a test when we land that =).
> 

Comment 10 Gustavo Noronha (kov) 2009-05-02 12:40:09 PDT
Landed as r43146. I'll open a bug report to remind me of the unit test.