Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Side by Side Diff: Source/core/loader/DocumentThreadableLoader.cpp

Issue 743653002: [ServiceWorker] support OPTIONS request for ServiceWorker [3/3 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 m_simpleRequestHeaders.add(it->key, it->value); 105 m_simpleRequestHeaders.add(it->key, it->value);
106 } 106 }
107 107
108 // If the fetch request will be handled by the ServiceWorker, the 108 // If the fetch request will be handled by the ServiceWorker, the
109 // FetchRequestMode of the request must be FetchRequestModeCORS or 109 // FetchRequestMode of the request must be FetchRequestModeCORS or
110 // FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can 110 // FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can
111 // return a opaque response which is from the other origin site and the 111 // return a opaque response which is from the other origin site and the
112 // script in the page can read the content. 112 // script in the page can read the content.
113 // 113 //
114 // We assume that ServiceWorker is skipped for sync requests and non-HTTP 114 // We assume that ServiceWorker is skipped for sync requests and non-HTTP
115 // familiy requests and OPTIONS request by content/ code. 115 // familiy requests by content/ code.
116 // FIXME: Remove OPTIONS check when we implement "HTTP fetch" correctly. 116 if (m_async && !request.skipServiceWorker() && request.url().protocolIsInHTT PFamily() && m_document.fetcher()->isControlledByServiceWorker()) {
117 if (m_async && !request.skipServiceWorker() && request.url().protocolIsInHTT PFamily() && request.httpMethod() != "OPTIONS" && m_document.fetcher()->isContro lledByServiceWorker()) {
118 ResourceRequest newRequest(request); 117 ResourceRequest newRequest(request);
119 // FetchRequestMode should be set by the caller. But the expected value 118 // FetchRequestMode should be set by the caller. But the expected value
120 // of FetchRequestMode is not speced yet except for XHR. So we set here. 119 // of FetchRequestMode is not speced yet except for XHR. So we set here.
121 // FIXME: When we support fetch API in document, this value should not 120 // FIXME: When we support fetch API in document, this value should not
122 // be overridden here. 121 // be overridden here.
123 if (options.preflightPolicy == ForcePreflight) 122 if (options.preflightPolicy == ForcePreflight)
124 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORSWi thForcedPreflight); 123 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORSWi thForcedPreflight);
125 else 124 else
126 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); 125 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS);
127 126
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 return DoNotAllowStoredCredentials; 619 return DoNotAllowStoredCredentials;
621 return m_resourceLoaderOptions.allowCredentials; 620 return m_resourceLoaderOptions.allowCredentials;
622 } 621 }
623 622
624 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const 623 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
625 { 624 {
626 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); 625 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin ();
627 } 626 }
628 627
629 } // namespace blink 628 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698