Bug 210863 - Add layout test to validate the User-Agent HTTP header of XMLHttpRequest
Summary: Add layout test to validate the User-Agent HTTP header of XMLHttpRequest
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 209587
  Show dependency treegraph
 
Reported: 2020-04-22 10:17 PDT by Chris Dumez
Modified: 2020-04-22 12:00 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.21 KB, patch)
2020-04-22 10:22 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (3.61 KB, patch)
2020-04-22 10:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (3.31 KB, patch)
2020-04-22 10:24 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2020-04-22 10:17:45 PDT
Add layout test to validate the User-Agent HTTP header of XMLHttpRequest.
Comment 1 Chris Dumez 2020-04-22 10:22:14 PDT
Created attachment 397217 [details]
Patch
Comment 2 Chris Dumez 2020-04-22 10:23:12 PDT
Created attachment 397218 [details]
Patch
Comment 3 Chris Dumez 2020-04-22 10:24:35 PDT
Created attachment 397219 [details]
Patch
Comment 4 youenn fablet 2020-04-22 10:38:28 PDT
Comment on attachment 397219 [details]
Patch

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

> LayoutTests/http/tests/xmlhttprequest/xhr-user-agent.html:16
> +    shouldBeTrue("syncXHRUserAgent.includes('AppleWebKit/')");

Is it working for non apple port?
Should we use testRunner.setCustomUserAgent?
Comment 5 Chris Dumez 2020-04-22 10:40:41 PDT
(In reply to youenn fablet from comment #4)
> Comment on attachment 397219 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=397219&action=review
> 
> > LayoutTests/http/tests/xmlhttprequest/xhr-user-agent.html:16
> > +    shouldBeTrue("syncXHRUserAgent.includes('AppleWebKit/')");
> 
> Is it working for non apple port?
> Should we use testRunner.setCustomUserAgent?

glib and win ports seem to include "AppleWebKit/" too based on code inspection.
Comment 6 Chris Dumez 2020-04-22 10:42:32 PDT
(In reply to Chris Dumez from comment #5)
> (In reply to youenn fablet from comment #4)
> > Comment on attachment 397219 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=397219&action=review
> > 
> > > LayoutTests/http/tests/xmlhttprequest/xhr-user-agent.html:16
> > > +    shouldBeTrue("syncXHRUserAgent.includes('AppleWebKit/')");
> > 
> > Is it working for non apple port?
> > Should we use testRunner.setCustomUserAgent?
> 
> glib and win ports seem to include "AppleWebKit/" too based on code
> inspection.

Existing tests already have this expectation:
LayoutTests/fast/dom/navigator-userAgent-frozen.html:    var start = userAgent.indexOf("AppleWebKit/");
LayoutTests/fast/dom/navigator-userAgent.html:    document.write("User Agent should contain AppleWebKit: " + (userAgent.indexOf("AppleWebKit") >= 0) + "<br>");
LayoutTests/http/tests/navigation/useragent.php:    var userAgentTemplate = "Mozilla/5.0 (%Platform%%Subplatform%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko)"
LayoutTests/http/tests/navigation/useragent.php:    var userAgentTemplateRegExp = /^Mozilla\/5\.0 \(([^;]+; )*[^;]+\) AppleWebKit\/[0-9\.]+(\+)? \(KHTML, like Gecko\).*$/;
Comment 7 EWS 2020-04-22 11:59:43 PDT
Committed r260526: <https://trac.webkit.org/changeset/260526>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397219 [details].
Comment 8 Radar WebKit Bug Importer 2020-04-22 12:00:23 PDT
<rdar://problem/62201273>