Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 if (Page* page = document.page()) | 186 if (Page* page = document.page()) |
| 187 page->chromeClient().didObserveNonGetFetchFromScript(); | 187 page->chromeClient().didObserveNonGetFetchFromScript(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 // If the fetch request will be handled by the ServiceWorker, the | 190 // If the fetch request will be handled by the ServiceWorker, the |
| 191 // FetchRequestMode of the request must be FetchRequestModeCORS or | 191 // FetchRequestMode of the request must be FetchRequestModeCORS or |
| 192 // FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can | 192 // FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can |
| 193 // return a opaque response which is from the other origin site and the | 193 // return a opaque response which is from the other origin site and the |
| 194 // script in the page can read the content. | 194 // script in the page can read the content. |
| 195 // | 195 // |
| 196 // We assume that ServiceWorker is skipped for sync requests and non-HTTP | 196 // We assume that ServiceWorker is skipped for sync requests by content/ |
|
lazyboy
2015/12/21 05:57:16
I've removed the http family protocol check and up
| |
| 197 // familiy requests by content/ code. | 197 // code. |
| 198 if (m_async && !request.skipServiceWorker() && request.url().protocolIsInHTT PFamily() && document.fetcher()->isControlledByServiceWorker()) { | 198 if (m_async && !request.skipServiceWorker() && document.fetcher()->isControl ledByServiceWorker()) { |
| 199 ResourceRequest newRequest(request); | 199 ResourceRequest newRequest(request); |
| 200 // FetchRequestMode should be set by the caller. But the expected value | 200 // FetchRequestMode should be set by the caller. But the expected value |
| 201 // of FetchRequestMode is not speced yet except for XHR. So we set here. | 201 // of FetchRequestMode is not speced yet except for XHR. So we set here. |
| 202 // FIXME: When we support fetch API in document, this value should not | 202 // FIXME: When we support fetch API in document, this value should not |
| 203 // be overridden here. | 203 // be overridden here. |
| 204 if (options.preflightPolicy == ForcePreflight) | 204 if (options.preflightPolicy == ForcePreflight) |
| 205 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORSWi thForcedPreflight); | 205 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORSWi thForcedPreflight); |
| 206 else | 206 else |
| 207 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); | 207 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); |
| 208 | 208 |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 return m_securityOrigin ? m_securityOrigin.get() : document().securityOrigin (); | 889 return m_securityOrigin ? m_securityOrigin.get() : document().securityOrigin (); |
| 890 } | 890 } |
| 891 | 891 |
| 892 Document& DocumentThreadableLoader::document() const | 892 Document& DocumentThreadableLoader::document() const |
| 893 { | 893 { |
| 894 ASSERT(m_document); | 894 ASSERT(m_document); |
| 895 return *m_document; | 895 return *m_document; |
| 896 } | 896 } |
| 897 | 897 |
| 898 } // namespace blink | 898 } // namespace blink |
| OLD | NEW |