RESOLVED FIXED Bug 179527
Allow XHR to override the User-Agent header.
https://bugs.webkit.org/show_bug.cgi?id=179527
Summary Allow XHR to override the User-Agent header.
Ms2ger (he/him; ⌚ UTC+1/+2)
Reported 2017-11-10 06:42:14 PST
.
Attachments
Patch (3.54 KB, patch)
2017-11-10 06:47 PST, Ms2ger (he/him; ⌚ UTC+1/+2)
no flags
Archive of layout-test-results from ews101 for mac-elcapitan (2.13 MB, application/zip)
2017-11-10 07:43 PST, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 (2.75 MB, application/zip)
2017-11-10 07:55 PST, Build Bot
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (2.16 MB, application/zip)
2017-11-10 08:10 PST, Build Bot
no flags
Archive of layout-test-results from ews114 for mac-elcapitan (2.94 MB, application/zip)
2017-11-10 08:11 PST, Build Bot
no flags
Patch (11.55 KB, patch)
2017-11-10 08:19 PST, Ms2ger (he/him; ⌚ UTC+1/+2)
no flags
Ms2ger (he/him; ⌚ UTC+1/+2)
Comment 1 2017-11-10 06:47:14 PST
Chris Dumez
Comment 2 2017-11-10 06:55:06 PST
Comment on attachment 326575 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=326575&action=review > Source/WebCore/loader/FrameLoader.cpp:3272 > void FrameLoader::applyUserAgent(ResourceRequest& request) I think we should add IfNecessay suffix given the new implementation.
Build Bot
Comment 3 2017-11-10 07:42:59 PST
Comment on attachment 326575 [details] Patch Attachment 326575 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/5176775 New failing tests: http/tests/xmlhttprequest/check-combining-headers.html
Build Bot
Comment 4 2017-11-10 07:43:00 PST
Created attachment 326577 [details] Archive of layout-test-results from ews101 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 5 2017-11-10 07:55:55 PST
Comment on attachment 326575 [details] Patch Attachment 326575 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/5176789 New failing tests: http/tests/xmlhttprequest/check-combining-headers.html
Build Bot
Comment 6 2017-11-10 07:55:57 PST
Created attachment 326583 [details] Archive of layout-test-results from ews106 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Chris Dumez
Comment 7 2017-11-10 07:57:46 PST
(In reply to Build Bot from comment #5) > Comment on attachment 326575 [details] > Patch > > Attachment 326575 [details] did not pass mac-wk2-ews (mac-wk2): > Output: http://webkit-queues.webkit.org/results/5176789 > > New failing tests: > http/tests/xmlhttprequest/check-combining-headers.html Looks like a progression, please make sure you rebaseline this test before landing: --- /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/xmlhttprequest/check-combining-headers-expected.txt +++ /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/xmlhttprequest/check-combining-headers-actual.txt @@ -1,7 +1,7 @@ PASS XMLHttpRequest: setRequestHeader() - combining headers (Authorization) PASS XMLHttpRequest: setRequestHeader() - combining headers (Pragma) -FAIL XMLHttpRequest: setRequestHeader() - combining headers (User-Agent) assert_true: Combined header value should be t1, t2 expected true got false +PASS XMLHttpRequest: setRequestHeader() - combining headers (User-Agent) PASS XMLHttpRequest: setRequestHeader() - combining headers (Content-Transfer-Encoding) PASS XMLHttpRequest: setRequestHeader() - combining headers (Content-Type) PASS XMLHttpRequest: setRequestHeader() - combining headers (Overwrite)
Ms2ger (he/him; ⌚ UTC+1/+2)
Comment 8 2017-11-10 07:59:23 PST
(In reply to Chris Dumez from comment #7) > (In reply to Build Bot from comment #5) > > Comment on attachment 326575 [details] > > Patch > > > > Attachment 326575 [details] did not pass mac-wk2-ews (mac-wk2): > > Output: http://webkit-queues.webkit.org/results/5176789 > > > > New failing tests: > > http/tests/xmlhttprequest/check-combining-headers.html > > Looks like a progression, please make sure you rebaseline this test before > landing: > --- > /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/ > xmlhttprequest/check-combining-headers-expected.txt > +++ > /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/ > xmlhttprequest/check-combining-headers-actual.txt > @@ -1,7 +1,7 @@ > > PASS XMLHttpRequest: setRequestHeader() - combining headers (Authorization) > PASS XMLHttpRequest: setRequestHeader() - combining headers (Pragma) > -FAIL XMLHttpRequest: setRequestHeader() - combining headers (User-Agent) > assert_true: Combined header value should be t1, t2 expected true got false > +PASS XMLHttpRequest: setRequestHeader() - combining headers (User-Agent) > PASS XMLHttpRequest: setRequestHeader() - combining headers > (Content-Transfer-Encoding) > PASS XMLHttpRequest: setRequestHeader() - combining headers (Content-Type) > PASS XMLHttpRequest: setRequestHeader() - combining headers (Overwrite) I'm just going to remove the test, it's an old fork of the test I'm already rebaselining.
Chris Dumez
Comment 9 2017-11-10 08:02:33 PST
(In reply to Ms2ger from comment #8) > (In reply to Chris Dumez from comment #7) > > (In reply to Build Bot from comment #5) > > > Comment on attachment 326575 [details] > > > Patch > > > > > > Attachment 326575 [details] did not pass mac-wk2-ews (mac-wk2): > > > Output: http://webkit-queues.webkit.org/results/5176789 > > > > > > New failing tests: > > > http/tests/xmlhttprequest/check-combining-headers.html > > > > Looks like a progression, please make sure you rebaseline this test before > > landing: > > --- > > /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/ > > xmlhttprequest/check-combining-headers-expected.txt > > +++ > > /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/ > > xmlhttprequest/check-combining-headers-actual.txt > > @@ -1,7 +1,7 @@ > > > > PASS XMLHttpRequest: setRequestHeader() - combining headers (Authorization) > > PASS XMLHttpRequest: setRequestHeader() - combining headers (Pragma) > > -FAIL XMLHttpRequest: setRequestHeader() - combining headers (User-Agent) > > assert_true: Combined header value should be t1, t2 expected true got false > > +PASS XMLHttpRequest: setRequestHeader() - combining headers (User-Agent) > > PASS XMLHttpRequest: setRequestHeader() - combining headers > > (Content-Transfer-Encoding) > > PASS XMLHttpRequest: setRequestHeader() - combining headers (Content-Type) > > PASS XMLHttpRequest: setRequestHeader() - combining headers (Overwrite) > > I'm just going to remove the test, it's an old fork of the test I'm already > rebaselining. SGTM.
Build Bot
Comment 10 2017-11-10 08:10:29 PST
Comment on attachment 326575 [details] Patch Attachment 326575 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/5176804 New failing tests: http/tests/xmlhttprequest/check-combining-headers.html
Build Bot
Comment 11 2017-11-10 08:10:30 PST
Created attachment 326584 [details] Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Build Bot
Comment 12 2017-11-10 08:11:53 PST
Comment on attachment 326575 [details] Patch Attachment 326575 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/5176817 New failing tests: http/tests/xmlhttprequest/check-combining-headers.html
Build Bot
Comment 13 2017-11-10 08:11:54 PST
Created attachment 326585 [details] Archive of layout-test-results from ews114 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Ms2ger (he/him; ⌚ UTC+1/+2)
Comment 14 2017-11-10 08:19:38 PST
WebKit Commit Bot
Comment 15 2017-11-10 08:41:07 PST
Comment on attachment 326587 [details] Patch Clearing flags on attachment: 326587 Committed r224684: <https://trac.webkit.org/changeset/224684>
WebKit Commit Bot
Comment 16 2017-11-10 08:41:09 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 17 2017-11-15 09:36:37 PST
Brady Eidson
Comment 18 2018-05-29 17:13:40 PDT
This patch broke changing the User Agent string then reloading the Document, because the Document's request already has a UA and therefore doesn't get the new one: void FrameLoader::applyUserAgentIfNeeded(ResourceRequest& request) { if (!request.hasHTTPHeaderField(HTTPHeaderName::UserAgent)) { String userAgent = this->userAgent(request.url()); ASSERT(!userAgent.isNull()); request.setHTTPUserAgent(userAgent); } } Note - That function is hit for EVERY single subresource. This bug was purported to be about allowing XHR to override the UA string. Is there any reason it changed the behavior of EVERY subresource, instead?
Ms2ger (he/him; ⌚ UTC+1/+2)
Comment 19 2018-05-30 23:23:37 PDT
So reloading reuses the ResourceRequest somehow? That seems unfortunate. Anyway, I don't know what other approach I could use to fix this bug, so feel free to revert, I suppose.
Sam Sneddon [:gsnedders]
Comment 20 2022-12-14 16:14:41 PST
*** Bug 168598 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.