WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
75586
WebFrameLoaderClient::userAgent does unnecessary NSString/NSURL conversions
https://bugs.webkit.org/show_bug.cgi?id=75586
Summary
WebFrameLoaderClient::userAgent does unnecessary NSString/NSURL conversions
Pratik Solanki
Reported
2012-01-04 15:57:04 PST
WebFrameLoaderClient::userAgent calls -(NSString *)userAgentForURL:(NSURL *)url on WebView to get the user agent string. This results in - converting KURL to NSURL* before passing to userAgentForURL (note that the function does't use the argument at all!) - Since userAgentForURL returns an NSString* but stores the user agent internally as WTF::String, it converts the String to NSString* before returning - WebFrameLoaderClient::userAgent converts that NSString back into a WTF::String when returning We can optimize this by having a separate code path that takes a KURL and returns String.
Attachments
Patch
(3.50 KB, patch)
2012-01-04 23:30 PST
,
Pratik Solanki
no flags
Details
Formatted Diff
Diff
Patch
(3.44 KB, patch)
2012-01-05 10:38 PST
,
Pratik Solanki
ap
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Pratik Solanki
Comment 1
2012-01-04 15:57:58 PST
<
rdar://problem/10637328&10637371
>
Pratik Solanki
Comment 2
2012-01-04 23:30:51 PST
Created
attachment 121222
[details]
Patch
Alexey Proskuryakov
Comment 3
2012-01-05 10:24:45 PST
Comment on
attachment 121222
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=121222&action=review
It seems that the knowledge of obsolete url argument can be isolated in API method - no need to add a new new that's still going to ignore its argument. Dead code for "No current site-specific spoofs" can go away, too.
> Source/WebKit/mac/WebView/WebView.mm:3892 > + return [self _userAgentStringForURL:(KURL*)url];
Even though the argument is unused in practice, casting to an unrelated type is a bug.
Pratik Solanki
Comment 4
2012-01-05 10:33:16 PST
(In reply to
comment #3
)
> (From update of
attachment 121222
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=121222&action=review
> > It seems that the knowledge of obsolete url argument can be isolated in API method - no need to add a new new that's still going to ignore its argument. Dead code for "No current site-specific spoofs" can go away, too. >
Ok.
> > Source/WebKit/mac/WebView/WebView.mm:3892 > > + return [self _userAgentStringForURL:(KURL*)url]; > > Even though the argument is unused in practice, casting to an unrelated type is a bug.
Yeah, I was debating on this cast as well. I'll just remove it given that the new function shouldn't take a URL argument.
Pratik Solanki
Comment 5
2012-01-05 10:38:40 PST
Created
attachment 121298
[details]
Patch
Pratik Solanki
Comment 6
2012-01-05 11:03:44 PST
Committed
r104181
: <
http://trac.webkit.org/changeset/104181
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug