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

Unified Diff: content/browser/service_worker/service_worker_fetch_dispatcher.cc

Issue 2473263003: Set "Service-Worker-Navigation-Preload" header (Closed)
Patch Set: incorporated falken's comment Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_fetch_dispatcher.cc
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
index b9384de0d22ea89b0c0da43b32d6605d3641f527..e45a863e4a3da24d46925e8e9d7f6d1bb2d1a35e 100644
--- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc
+++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -27,6 +27,7 @@
#include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "net/http/http_util.h"
#include "net/log/net_log.h"
#include "net/log/net_log_capture_mode.h"
#include "net/log/net_log_event_type.h"
@@ -396,6 +397,12 @@ void ServiceWorkerFetchDispatcher::MaybeStartNavigationPreload(
request.render_frame_id = original_info->GetRenderFrameID();
request.is_main_frame = original_info->IsMainFrame();
request.parent_is_main_frame = original_info->ParentIsMainFrame();
+
+ DCHECK(net::HttpUtil::IsValidHeaderValue(
+ version_->navigation_preload_state().header));
+ request.headers = "Service-Worker-Navigation-Preload: " +
+ version_->navigation_preload_state().header;
+
const int request_id = ResourceDispatcherHostImpl::Get()->MakeRequestID();
DCHECK_LT(request_id, -1);
@@ -410,8 +417,6 @@ void ServiceWorkerFetchDispatcher::MaybeStartNavigationPreload(
url_loader_factory_.associated_group());
mojom::URLLoaderAssociatedPtr url_loader_associated_ptr;
- // TODO(horo): Add "Service-Worker-Navigation-Preload" header.
- // See: https://github.com/w3c/ServiceWorker/issues/920#issuecomment-251150270
url_loader_factory_->CreateLoaderAndStart(
mojo::GetProxy(&url_loader_associated_ptr,
url_loader_factory_.associated_group()),
« no previous file with comments | « content/browser/service_worker/service_worker_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698