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

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

Issue 726543008: [ServiceWorker] Fix ASSERT failure in DocumentThreadableLoader::handleResponse(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (FetchUtils::isSimpleHeader(it->key, it->value)) 104 if (FetchUtils::isSimpleHeader(it->key, it->value))
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 by content/ 114 // We assume that ServiceWorker is skipped for sync requests and non-HTTP
115 // code. 115 // familiy requests and OPTIONS request by content/ code.
116 if (m_async && !request.skipServiceWorker() && m_document.fetcher()->isContr olledByServiceWorker()) { 116 // FIXME: Remove OPTIONS check when we implement "HTTP fetch" correctly.
117 if (m_async && !request.skipServiceWorker() && request.url().protocolIsInHTT PFamily() && request.httpMethod() != "OPTIONS" && m_document.fetcher()->isContro lledByServiceWorker()) {
117 ResourceRequest newRequest(request); 118 ResourceRequest newRequest(request);
118 // FetchRequestMode should be set by the caller. But the expected value 119 // FetchRequestMode should be set by the caller. But the expected value
119 // of FetchRequestMode is not speced yet except for XHR. So we set here. 120 // of FetchRequestMode is not speced yet except for XHR. So we set here.
120 // FIXME: When we support fetch API in document, this value should not 121 // FIXME: When we support fetch API in document, this value should not
121 // be overridden here. 122 // be overridden here.
122 if (options.preflightPolicy == ForcePreflight) 123 if (options.preflightPolicy == ForcePreflight)
123 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORSWi thForcedPreflight); 124 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORSWi thForcedPreflight);
124 else 125 else
125 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); 126 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS);
126 127
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 return DoNotAllowStoredCredentials; 620 return DoNotAllowStoredCredentials;
620 return m_resourceLoaderOptions.allowCredentials; 621 return m_resourceLoaderOptions.allowCredentials;
621 } 622 }
622 623
623 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const 624 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
624 { 625 {
625 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); 626 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin ();
626 } 627 }
627 628
628 } // namespace blink 629 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698