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

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

Issue 1532633003: Extension SW: Add tests that serve web_accessible_resources from a SW. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: foo Created 5 years 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
« no previous file with comments | « chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/webpage.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/service_worker/web_accessible_resources/webpage.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698