Bug 48360 - Need a way to retrieve custom user agent from a WKPage
Summary: Need a way to retrieve custom user agent from a WKPage
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brian Weinstein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-26 12:00 PDT by Brian Weinstein
Modified: 2010-10-26 13:19 PDT (History)
2 users (show)

See Also:


Attachments
[PATCH] Fix (4.05 KB, patch)
2010-10-26 12:10 PDT, Brian Weinstein
bweinstein: commit-queue-
Details | Formatted Diff | Diff
[PATCH] Fix - rename to WKPageCopyCustomUserAgent (4.03 KB, patch)
2010-10-26 12:44 PDT, Brian Weinstein
darin: review+
bweinstein: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.