Bug 113260

Summary: Add a runtime flag in WebRuntimeFeatures to enable 'image/webp' accept header
Product: WebKit Reporter: Urvang Joshi <urvang>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: abarth, dglazkov, fishd, jamesr, japhet, tkent+wkapi, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Helper method to set accept header
none
Patch
none
Patch none

Description Urvang Joshi 2013-03-25 18:32:16 PDT
This flag would be off by default. The main idea is to enable Website owners to test their site with these accept header change, before we turn it on by default (later).
See the context here: https://code.google.com/p/chromium/issues/detail?id=169182

Also, this flag is meaningful only when the browser supports WebP (denoted by 'USE(WEBP)') -- only Chromium for now.

Note: This change is from Webkit side. One more change from chromium side would actually enable/disable this based on command-line options.
Comment 1 Urvang Joshi 2013-03-25 18:45:08 PDT
Created attachment 194972 [details]
Patch
Comment 2 WebKit Review Bot 2013-03-25 18:48:14 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 James Robinson 2013-03-25 19:19:16 PDT
Comment on attachment 194972 [details]
Patch

Hmm, what does this have to do with WebKit?  I thought HTTP headers like 'accept' are set by the network stack on the chromium side.
Comment 4 Urvang Joshi 2013-03-25 21:25:41 PDT
> Hmm, what does this have to do with WebKit?  I thought HTTP headers like 'accept' are set by the network stack on the chromium side.

It's not so, it seems.
All the accept headers for cached resources are set by source files in Source/WebCore/loader/cache/*.[h,cpp]. Chromium only puts default headers for HTML page itself, and for some resources where WebKit doesn't put any accept header, AFAIK.
Comment 5 Darin Fisher (:fishd, Google) 2013-03-25 21:45:48 PDT
jamesr: Take a look at CachedCSSStyleSheet.cpp, CachedSVGDocument.cpp, and CachedXSLStyleSheet.cpp, which all call setAccept.

urvang: It seems like you shouldn't duplicate the code that sets the accept header.  A helper method seems appropriate.
Comment 6 Urvang Joshi 2013-03-25 23:09:34 PDT
Created attachment 195009 [details]
Helper method to set accept header
Comment 7 Urvang Joshi 2013-03-25 23:12:24 PDT
@Darin: Yes, I should have.
Pls have a look at the new patch.
Comment 8 Mike West 2013-03-27 02:53:34 PDT
Comment on attachment 195009 [details]
Helper method to set accept header

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

Two drive-by comments:

> Source/WebCore/loader/cache/CachedImage.h:102
> +    void setCustomAccept(); // Helper method to set the Accept header.

Would you mind renaming this to something that makes it clear that we're setting the header? I think 'CachedImage::setCustomAcceptHeader' would be clear enough that you could remove the comment.

> Source/WebKit/chromium/src/WebRuntimeFeatures.cpp:765
> +    UNUSED_PARAM(enable);

Copy/paste error: There's no 'enable' in this method.
Comment 9 Darin Fisher (:fishd, Google) 2013-03-27 10:45:27 PDT
Comment on attachment 195009 [details]
Helper method to set accept header

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

>> Source/WebCore/loader/cache/CachedImage.h:102
>> +    void setCustomAccept(); // Helper method to set the Accept header.
> 
> Would you mind renaming this to something that makes it clear that we're setting the header? I think 'CachedImage::setCustomAcceptHeader' would be clear enough that you could remove the comment.

+1
Comment 10 Urvang Joshi 2013-03-27 11:49:25 PDT
Created attachment 195370 [details]
Patch
Comment 11 Urvang Joshi 2013-03-27 11:51:03 PDT
Comment on attachment 195009 [details]
Helper method to set accept header

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

>>> Source/WebCore/loader/cache/CachedImage.h:102
>>> +    void setCustomAccept(); // Helper method to set the Accept header.
>> 
>> Would you mind renaming this to something that makes it clear that we're setting the header? I think 'CachedImage::setCustomAcceptHeader' would be clear enough that you could remove the comment.
> 
> +1

Done
Comment 12 Urvang Joshi 2013-03-27 11:51:45 PDT
Comment on attachment 195009 [details]
Helper method to set accept header

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

>> Source/WebKit/chromium/src/WebRuntimeFeatures.cpp:765
>> +    UNUSED_PARAM(enable);
> 
> Copy/paste error: There's no 'enable' in this method.

Oops, fixed.
Comment 13 Darin Fisher (:fishd, Google) 2013-03-27 14:26:13 PDT
Comment on attachment 195370 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        No new tests (OOPS!).

nit: you need to delete this line
Comment 14 Urvang Joshi 2013-03-27 15:10:23 PDT
Created attachment 195408 [details]
Patch
Comment 15 Urvang Joshi 2013-03-29 15:28:29 PDT
@Reviewers: Gentle reminder to pls have another look.
Comment 16 Urvang Joshi 2013-04-09 14:26:57 PDT
Marking this as WONTFIX as it's Chromium specific, and would be taken care of in Blink repo now.

Being tracked here: https://code.google.com/p/chromium/issues/detail?id=169182