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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2526343003: Introduce new security restrictions in FetchEvent.respondWith(). (Closed)
Patch Set: incorporated falken's comment Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/DocumentLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index cd0ad37635b8179069d1bfc7e22ee43e7f2f4497..1be7ca6403814b528d1d7399cfe1e8a51fad26e7 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -38,6 +38,7 @@
#include "core/fetch/ImageResource.h"
#include "core/fetch/MemoryCache.h"
#include "core/fetch/ResourceFetcher.h"
+#include "core/frame/Deprecation.h"
#include "core/frame/FrameHost.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
@@ -317,6 +318,19 @@ void DocumentLoader::finishedLoading(double finishTime) {
if (m_state < MainResourceDone)
m_state = MainResourceDone;
clearMainResourceHandle();
+
+ // Shows the deprecation message and measures the impact of the new security
+ // restriction which disallows responding to navigation requests with
+ // redirected responses in the service worker.
+ // TODO(horo): Remove this when we actually introduce the restriction in
+ // RespondWithObserver.
+ if (m_response.wasFetchedViaServiceWorker() &&
+ m_response.urlListViaServiceWorker().size() > 1) {
+ Deprecation::countDeprecation(
+ m_frame,
+ UseCounter::
+ ServiceWorkerRespondToNavigationRequestWithRedirectedResponse);
+ }
}
bool DocumentLoader::redirectReceived(

Powered by Google App Engine
This is Rietveld 408576698