• horo's avatar
    [ServiceWorker] Plumbing the request credentials mode to the ServiceWorker. [2/2 chromium] · 89252e8f
    horo authored
    Currently the credentials mode of the FetchEvent's request is always 'omit'.
    But this should be 'same-origin' or 'include'.
    ex:
    - <img src="./test.png">
     mode: no CORS
     credentials mode: same-origin
    - <img src="./test.png" crossOrigin="anonymous">
     mode: CORS
     credentials mode: same-origin
    - <img src="./test.png" crossOrigin="use-credentials">
     mode: CORS
     credentials mode: include
    
    [1/2] blink: https://codereview.chromium.org/610403002/
    [2/2] chromium: https://codereview.chromium.org/615493003/
    
    This value is passed from the renederer to the ServiceWorker in the following steps.
    
    In the renederer process:
      blink::ResourceRequest::setFetchCredentialsMode()  // not called yet
     blink::ResourceRequest::m_fetchCredentialsMode
      content::WebURLLoaderImpl::Context::Start()
       blink::WebURLRequest::fetchCredentialsMode()
        GetFetchCredentialsMode()
     conetnt::RequestInfo::fetch_credentials_mode
    
    In the browser process:
     conetnt::RequestInfo::fetch_credentials_mode
      content::ResourceDispatcherHostImpl::BeginRequest()
       content::ServiceWorkerRequestHandler::InitializeHandler()
        content::ServiceWorkerProviderHost::CreateRequestHandler()
         content::ServiceWorkerControlleeRequestHandler::ServiceWorkerControlleeRequestHandler()
     content::ServiceWorkerControlleeRequestHandler::request_credentials_mode_
      content::ServiceWorkerControlleeRequestHandler::MaybeCreateJob()
       content::ServiceWorkerURLRequestJob::ServiceWorkerURLRequestJob()
     content::ServiceWorkerURLRequestJob::request_credentials_mode_
      content::ServiceWorkerURLRequestJob::CreateFetchRequest()
     content::ServiceWorkerFetchRequest::credentials_mode
    
    In the ServiceWorker process:
     content::ServiceWorkerFetchRequest::credentials_mode
       content::ServiceWorkerScriptContext::OnFetchEvent()
       GetBlinkFetchRequestCredentialsMode()
       blink::WebServiceWorkerRequest::setCredentialsMode()
     blink::WebServiceWorkerRequest::WebServiceWorkerRequestPrivate::m_credentialsMode
      blink::Request::create()
      blink::FetchRequestData::create()
     blink::FetchRequestData::m_credentials
    
    BUG=418509
    
    Review URL: https://codereview.chromium.org/615493003
    
    Cr-Commit-Position: refs/heads/master@{#297812}
    89252e8f
resource_dispatcher_host_impl.cc 80 KB