Bug 157435 - Add injected bundle SPI for getting favicon and touch icon URLs
Summary: Add injected bundle SPI for getting favicon and touch icon URLs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-06 16:56 PDT by Anders Carlsson
Modified: 2021-12-13 09:31 PST (History)
0 users

See Also:


Attachments
Patch (26.75 KB, patch)
2016-05-06 17:00 PDT, Anders Carlsson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2016-05-06 16:56:41 PDT
Add injected bundle SPI for getting favicon and touch icon URLs
Comment 1 Anders Carlsson 2016-05-06 17:00:48 PDT
Created attachment 278289 [details]
Patch
Comment 2 Darin Adler 2016-05-07 09:29:29 PDT
Comment on attachment 278289 [details]
Patch

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

> Source/WebCore/html/LinkIconCollector.cpp:51
> +    {

Incorrect indentation.

> Source/WebCore/html/LinkIconCollector.cpp:102
> +            unsigned size = linkElement.sizes().item(0).string().stripWhiteSpace().toUInt(&ok);

It’s almost never good to use stripWhiteSpace, since it’s the wrong set of whitespace characters. We have stripLeadingAndTrailingHTMLSpaces, and we have it on both String and StringView. Here, I think we’d want to use the StringView version—why allocate a string just to convert it to an integer?

> Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:49
> +// FIXME: These should be tagged nonnull.

Why does this have to be a FIXME? We don’t have the correct macro for that?
Comment 3 Anders Carlsson 2016-05-09 12:28:55 PDT
(In reply to comment #2)
> > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:49
> > +// FIXME: These should be tagged nonnull.
> 
> Why does this have to be a FIXME? We don’t have the correct macro for that?

We do have the correct macro, but adding an annotation to one method will cause the compiler to warn unless all methods have annotations (which they don't).
Comment 4 Anders Carlsson 2016-05-09 13:38:47 PDT
(In reply to comment #2)
> Comment on attachment 278289 [details]
> Patch
> 
> > Source/WebCore/html/LinkIconCollector.cpp:102
> > +            unsigned size = linkElement.sizes().item(0).string().stripWhiteSpace().toUInt(&ok);
> 
> It’s almost never good to use stripWhiteSpace, since it’s the wrong set of
> whitespace characters. We have stripLeadingAndTrailingHTMLSpaces, and we
> have it on both String and StringView. Here, I think we’d want to use the
> StringView version—why allocate a string just to convert it to an integer?
> 

It doesn't look like there's a version of stripLeadingAndTrailingHTMLSpaces that works on a StringView - I'll make sure to fix one and adopt StringView in an upcoming patch.
Comment 5 Anders Carlsson 2016-05-09 13:40:46 PDT
Committed r200591: <http://trac.webkit.org/changeset/200591>