Bug 79495

Summary: [GTK] FrameLoader signals: gtk-doc fixes
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: WebKitGTKAssignee: Philippe Normand <pnormand>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, mrobinson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch mrobinson: review+, mrobinson: commit-queue-

Description Philippe Normand 2012-02-24 08:59:56 PST
+++ This bug was initially created as a clone of Bug #49543 +++

See https://bugs.webkit.org/show_bug.cgi?id=49543#c36
Comment 1 Carlos Garcia Campos 2012-03-05 05:29:37 PST
I've just added this to http://trac.webkit.org/wiki/WebKitGTK/1.8.x 

I think someone should fix this before 1.8, or roll the patch out. Note that the bug is not just about gtk-doc syntax errors.
Comment 2 Martin Robinson 2012-03-05 10:10:15 PST
(In reply to comment #1)
> I've just added this to http://trac.webkit.org/wiki/WebKitGTK/1.8.x 
> 
> I think someone should fix this before 1.8, or roll the patch out. Note that the bug is not just about gtk-doc syntax errors.

From your comment, you found both gtkdoc syntax errors and places where the documentation could be improved. Were there other problems as well?
Comment 3 Carlos Garcia Campos 2012-03-05 23:45:59 PST
The main problem for me with the patch is the lack of unit tests, but I would be happy just if the documentation is fixed.
Comment 4 Philippe Normand 2012-03-05 23:54:50 PST
(In reply to comment #3)
> The main problem for me with the patch is the lack of unit tests, but I would be happy just if the documentation is fixed.

That patch unskipped a good number of layout tests though and that new API is used in DRT. I don't see the point of adding unit tests in that case.
Comment 5 Philippe Normand 2012-03-06 00:07:58 PST
Ok let's do this..
Comment 6 Carlos Garcia Campos 2012-03-06 00:12:11 PST
(In reply to comment #4)
> (In reply to comment #3)
> > The main problem for me with the patch is the lack of unit tests, but I would be happy just if the documentation is fixed.
> 
> That patch unskipped a good number of layout tests though and that new API is used in DRT. I don't see the point of adding unit tests in that case.

If the patch had included unit tests, you would have noticed that length-received is not the length of the resource, but the length of the data chunk received and that it can be emitted multiple times, for example. Unit test are useful to make sure that API works for multiple uses, I haven't looked at how DRT use the API, but I guess it doesn't use all the API (signals and methods) exposed.
Comment 7 Philippe Normand 2012-03-06 00:42:09 PST
Created attachment 130319 [details]
Patch
Comment 8 Carlos Garcia Campos 2012-03-06 00:50:43 PST
Comment on attachment 130319 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=130319&action=review

Thanks for fixing this.

> Source/WebKit/gtk/webkit/webkitwebframe.cpp:400
> +     * Emitted when new resource data has been received. The
> +     * @length_received variable stores the amount of bytes received so
> +     * far. This is useful to provide progress information about the

No, the value is not accumulated, it's the length of the chunk received, no the total amount of data received so far.
Comment 9 Martin Robinson 2012-03-06 06:38:43 PST
(In reply to comment #6)
 
> If the patch had included unit tests, you would have noticed that length-received is not the length of the resource, but the length of the data chunk received and that it can be emitted multiple times, for example. Unit test are useful to make sure that API works for multiple uses, I haven't looked at how DRT use the API, but I guess it doesn't use all the API (signals and methods) exposed.

If there is no layout test covering this, then it makes sense to add one.
Comment 10 Carlos Garcia Campos 2012-03-06 06:46:32 PST
(In reply to comment #9)
> (In reply to comment #6)
> 
> > If the patch had included unit tests, you would have noticed that length-received is not the length of the resource, but the length of the data chunk received and that it can be emitted multiple times, for example. Unit test are useful to make sure that API works for multiple uses, I haven't looked at how DRT use the API, but I guess it doesn't use all the API (signals and methods) exposed.
> 
> If there is no layout test covering this, then it makes sense to add one.

It's my opinion, I'm not saying phil did wrong not including unit tests in the patch, I just think that all patches adding new API should include unit tests even if the API is used by other tests. Typically the only tests that check every method, signal, etc. exposed by the API are unit tests. I think layout tests are complementary to unit tests. I can be wrong of course.
Comment 11 Martin Robinson 2012-03-06 18:05:19 PST
Comment on attachment 130319 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=130319&action=review

>> Source/WebKit/gtk/webkit/webkitwebframe.cpp:400
>> +     * far. This is useful to provide progress information about the
> 
> No, the value is not accumulated, it's the length of the chunk received, no the total amount of data received so far.

I'll fix this and land the patch.
Comment 12 Martin Robinson 2012-03-06 18:35:07 PST
(In reply to comment #11)
> (From update of attachment 130319 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=130319&action=review
> 
> >> Source/WebKit/gtk/webkit/webkitwebframe.cpp:400
> >> +     * far. This is useful to provide progress information about the
> > 
> > No, the value is not accumulated, it's the length of the chunk received, no the total amount of data received so far.
> 
> I'll fix this and land the patch.

I think it makes sense to rename this signal. It seems that the name resource-content-length-received is a weird side effect of the Objective-C naming scheme. It's very odd! I think a better name would be resource-content-received. The name resource-content-length-received suggests that the Content-Length header of the HTTP header has been parsed, so I think it could be quite confusing.
Comment 13 Martin Robinson 2012-03-06 18:38:02 PST
(In reply to comment #12)

> I think it makes sense to rename this signal. It seems that the name resource-content-length-received is a weird side effect of the Objective-C naming scheme. It's very odd! I think a better name would be resource-content-received. The name resource-content-length-received suggests that the Content-Length header of the HTTP header has been parsed, so I think it could be quite confusing.

Well, it looks like we've already pushed this in 1.7.5, so we cannot change the signal name now. We should just verify that we fix the issue in WebKit2, I guess.
Comment 14 Martin Robinson 2012-03-06 18:40:56 PST
Committed r109997: <http://trac.webkit.org/changeset/109997>
Comment 15 Carlos Garcia Campos 2012-03-07 00:29:34 PST
(In reply to comment #12)
> (In reply to comment #11)
> > (From update of attachment 130319 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=130319&action=review
> > 
> > >> Source/WebKit/gtk/webkit/webkitwebframe.cpp:400
> > >> +     * far. This is useful to provide progress information about the
> > > 
> > > No, the value is not accumulated, it's the length of the chunk received, no the total amount of data received so far.
> > 
> > I'll fix this and land the patch.
> 
> I think it makes sense to rename this signal. It seems that the name resource-content-length-received is a weird side effect of the Objective-C naming scheme. It's very odd! I think a better name would be resource-content-received. The name resource-content-length-received suggests that the Content-Length header of the HTTP header has been parsed, so I think it could be quite confusing.

Yes, that's exactly why used a different name in wk2. Both Downloads API and Resources patch use received-data
Comment 16 Carlos Garcia Campos 2012-03-07 00:30:20 PST
(In reply to comment #13)
> (In reply to comment #12)
> 
> > I think it makes sense to rename this signal. It seems that the name resource-content-length-received is a weird side effect of the Objective-C naming scheme. It's very odd! I think a better name would be resource-content-received. The name resource-content-length-received suggests that the Content-Length header of the HTTP header has been parsed, so I think it could be quite confusing.
> 
> Well, it looks like we've already pushed this in 1.7.5, so we cannot change the signal name now. We should just verify that we fix the issue in WebKit2, I guess.

In wk2 it's called received-data for consistency with the downloads API.