Changeset 224684 in webkit


Ignore:
Timestamp:
Nov 10, 2017 8:41:03 AM (6 years ago)
Author:
Ms2ger@igalia.com
Message:

LayoutTests/imported/w3c:
Allow XHR to override the User-Agent header.
https://bugs.webkit.org/show_bug.cgi?id=179527

Reviewed by Chris Dumez.

  • web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt: update expectation.

Source/WebCore:
Allow XHR to override the User-Agent header.
https://bugs.webkit.org/show_bug.cgi?id=179527

Reviewed by Chris Dumez.

Also rename FrameLoader::applyUserAgent to FrameLoader::applyUserAgentIfNeeded
for clarity.

Test: imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::addExtraFieldsToRequest):
(WebCore::FrameLoader::applyUserAgentIfNeeded):

  • loader/FrameLoader.h:
  • loader/ResourceLoadNotifier.cpp:

(WebCore::ResourceLoadNotifier::willSendRequest):

  • loader/appcache/ApplicationCacheGroup.cpp:

(WebCore::ApplicationCacheGroup::createResourceHandle):

  • loader/cache/CachedResourceRequest.cpp:

(WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):

LayoutTests:
Remove check-combining-headers.html.
https://bugs.webkit.org/show_bug.cgi?id=179527

Reviewed by Chris Dumez.

This test is an old fork of
imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm
which is no longer useful.

  • http/tests/xmlhttprequest/check-combining-headers-expected.txt: Removed.
  • http/tests/xmlhttprequest/check-combining-headers.html: Removed.
Location:
trunk
Files:
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r224681 r224684  
     12017-11-10  Ms2ger  <Ms2ger@igalia.com>
     2
     3        Remove check-combining-headers.html.
     4        https://bugs.webkit.org/show_bug.cgi?id=179527
     5
     6        Reviewed by Chris Dumez.
     7
     8        This test is an old fork of
     9        imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm
     10        which is no longer useful.
     11
     12        * http/tests/xmlhttprequest/check-combining-headers-expected.txt: Removed.
     13        * http/tests/xmlhttprequest/check-combining-headers.html: Removed.
     14
    1152017-11-10  Ms2ger  <Ms2ger@igalia.com>
    216
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r224664 r224684  
     12017-11-10  Ms2ger  <Ms2ger@igalia.com>
     2
     3        Allow XHR to override the User-Agent header.
     4        https://bugs.webkit.org/show_bug.cgi?id=179527
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt: update expectation.
     9
    1102017-11-09  Chris Dumez  <cdumez@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt

    r222817 r224684  
    22PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Authorization)
    33PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Pragma)
    4 FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (User-Agent) assert_equals: expected "User-Agent," but got ""
     4PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (User-Agent)
    55PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Transfer-Encoding)
    66PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type)
  • trunk/Source/WebCore/ChangeLog

    r224681 r224684  
     12017-11-10  Ms2ger  <Ms2ger@igalia.com>
     2
     3        Allow XHR to override the User-Agent header.
     4        https://bugs.webkit.org/show_bug.cgi?id=179527
     5
     6        Reviewed by Chris Dumez.
     7
     8        Also rename FrameLoader::applyUserAgent to FrameLoader::applyUserAgentIfNeeded
     9        for clarity.
     10
     11        Test: imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm
     12
     13        * loader/FrameLoader.cpp:
     14        (WebCore::FrameLoader::addExtraFieldsToRequest):
     15        (WebCore::FrameLoader::applyUserAgentIfNeeded):
     16        * loader/FrameLoader.h:
     17        * loader/ResourceLoadNotifier.cpp:
     18        (WebCore::ResourceLoadNotifier::willSendRequest):
     19        * loader/appcache/ApplicationCacheGroup.cpp:
     20        (WebCore::ApplicationCacheGroup::createResourceHandle):
     21        * loader/cache/CachedResourceRequest.cpp:
     22        (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
     23
    1242017-11-10  Ms2ger  <Ms2ger@igalia.com>
    225
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r224150 r224684  
    26532653        request.setPriority(m_overrideResourceLoadPriorityForTesting.value());
    26542654
    2655     applyUserAgent(request);
     2655    applyUserAgentIfNeeded(request);
    26562656
    26572657    if (isMainResource)
     
    32703270}
    32713271
    3272 void FrameLoader::applyUserAgent(ResourceRequest& request)
    3273 {
    3274     String userAgent = this->userAgent(request.url());
    3275     ASSERT(!userAgent.isNull());
    3276     request.setHTTPUserAgent(userAgent);
     3272void FrameLoader::applyUserAgentIfNeeded(ResourceRequest& request)
     3273{
     3274    if (!request.hasHTTPHeaderField(HTTPHeaderName::UserAgent)) {
     3275        String userAgent = this->userAgent(request.url());
     3276        ASSERT(!userAgent.isNull());
     3277        request.setHTTPUserAgent(userAgent);
     3278    }
    32773279}
    32783280
  • trunk/Source/WebCore/loader/FrameLoader.h

    r223981 r224684  
    259259    WEBCORE_EXPORT Frame* findFrameForNavigation(const AtomicString& name, Document* activeDocument = nullptr);
    260260
    261     void applyUserAgent(ResourceRequest&);
     261    void applyUserAgentIfNeeded(ResourceRequest&);
    262262
    263263    bool shouldInterruptLoadForXFrameOptions(const String&, const URL&, unsigned long requestIdentifier);
  • trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp

    r213917 r224684  
    6565void ResourceLoadNotifier::willSendRequest(ResourceLoader* loader, ResourceRequest& clientRequest, const ResourceResponse& redirectResponse)
    6666{
    67     m_frame.loader().applyUserAgent(clientRequest);
     67    m_frame.loader().applyUserAgentIfNeeded(clientRequest);
    6868
    6969    dispatchWillSendRequest(loader->documentLoader(), loader->identifier(), clientRequest, redirectResponse);
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r224373 r224684  
    463463{
    464464    ResourceRequest request(url);
    465     m_frame->loader().applyUserAgent(request);
     465    m_frame->loader().applyUserAgentIfNeeded(request);
    466466    request.setHTTPHeaderField(HTTPHeaderName::CacheControl, "max-age=0");
    467467
  • trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp

    r224439 r224684  
    248248    FrameLoader::addHTTPOriginIfNeeded(m_resourceRequest, outgoingOrigin);
    249249
    250     frameLoader.applyUserAgent(m_resourceRequest);
     250    frameLoader.applyUserAgentIfNeeded(m_resourceRequest);
    251251}
    252252
Note: See TracChangeset for help on using the changeset viewer.