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