Bug 48360

Summary: Need a way to retrieve custom user agent from a WKPage
Product: WebKit Reporter: Brian Weinstein <bweinstein>
Component: WebKit2Assignee: Brian Weinstein <bweinstein>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Fix
bweinstein: commit-queue-
[PATCH] Fix - rename to WKPageCopyCustomUserAgent darin: review+, bweinstein: commit-queue-

Description Brian Weinstein 2010-10-26 12:00:46 PDT
We need a way to retrieve the custom user agent from a WKPage.
Comment 1 Brian Weinstein 2010-10-26 12:10:40 PDT
Created attachment 71924 [details]
[PATCH] Fix
Comment 2 Darin Adler 2010-10-26 12:12:09 PDT
Comment on attachment 71924 [details]
[PATCH] Fix

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

> WebKit2/UIProcess/API/C/WKPage.cpp:158
> +WKStringRef WKPageGetCustomUserAgent(WKPageRef pageRef)
> +{
> +    return toCopiedAPI(toImpl(pageRef)->customUserAgent());
> +}

If you are using toCopiedAPI then this function needs Copy in its name.
Comment 3 Brian Weinstein 2010-10-26 12:14:45 PDT
(In reply to comment #2)
> (From update of attachment 71924 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=71924&action=review
> 
> > WebKit2/UIProcess/API/C/WKPage.cpp:158
> > +WKStringRef WKPageGetCustomUserAgent(WKPageRef pageRef)
> > +{
> > +    return toCopiedAPI(toImpl(pageRef)->customUserAgent());
> > +}
> 
> If you are using toCopiedAPI then this function needs Copy in its name.

Should this be using toCopiedAPI or just toAPI? I see functions that return a WKStringRef on WKPage that use both toCopiedAPI and toAPI.
Comment 4 Brian Weinstein 2010-10-26 12:44:51 PDT
Created attachment 71929 [details]
[PATCH] Fix - rename to WKPageCopyCustomUserAgent
Comment 5 Darin Adler 2010-10-26 12:54:21 PDT
Comment on attachment 71929 [details]
[PATCH] Fix - rename to WKPageCopyCustomUserAgent

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

> WebKit2/UIProcess/WebPageProxy.cpp:462
> +    if (m_customUserAgent == userAgent)
> +        return;

This code distinguishes a null string from an empty string. I’m not sure that’s intentional.
Comment 6 Brian Weinstein 2010-10-26 13:19:05 PDT
Landed in r70561.