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

Side by Side Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 2812513004: service worker: Clarify the navigation preload network error message. (Closed)
Patch Set: linebreak Created 3 years, 8 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 std::move(response), std::move(data_consume_handle)); 303 std::move(response), std::move(data_consume_handle));
304 } 304 }
305 305
306 void ServiceWorkerGlobalScopeProxy::OnNavigationPreloadError( 306 void ServiceWorkerGlobalScopeProxy::OnNavigationPreloadError(
307 int fetch_event_id, 307 int fetch_event_id,
308 std::unique_ptr<WebServiceWorkerError> error) { 308 std::unique_ptr<WebServiceWorkerError> error) {
309 FetchEvent* fetch_event = pending_preload_fetch_events_.Take(fetch_event_id); 309 FetchEvent* fetch_event = pending_preload_fetch_events_.Take(fetch_event_id);
310 // This method may be called after onNavigationPreloadResponse() was called. 310 // This method may be called after onNavigationPreloadResponse() was called.
311 if (!fetch_event) 311 if (!fetch_event)
312 return; 312 return;
313 // Display an unsanitized console message.
314 if (!error->unsanitized_message.IsEmpty()) {
315 WorkerGlobalScope()->AddConsoleMessage(ConsoleMessage::Create(
316 kWorkerMessageSource, blink::MessageLevel::kErrorMessageLevel,
317 error->unsanitized_message));
318 }
319 // Reject the preloadResponse promise.
313 fetch_event->OnNavigationPreloadError( 320 fetch_event->OnNavigationPreloadError(
314 WorkerGlobalScope()->ScriptController()->GetScriptState(), 321 WorkerGlobalScope()->ScriptController()->GetScriptState(),
315 std::move(error)); 322 std::move(error));
316 } 323 }
317 324
318 void ServiceWorkerGlobalScopeProxy::DispatchForeignFetchEvent( 325 void ServiceWorkerGlobalScopeProxy::DispatchForeignFetchEvent(
319 int fetch_event_id, 326 int fetch_event_id,
320 const WebServiceWorkerRequest& web_request) { 327 const WebServiceWorkerRequest& web_request) {
321 if (!OriginTrials::foreignFetchEnabled(WorkerGlobalScope())) { 328 if (!OriginTrials::foreignFetchEnabled(WorkerGlobalScope())) {
322 // If origin trial tokens have expired, or are otherwise no longer valid 329 // If origin trial tokens have expired, or are otherwise no longer valid
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 return *document_; 598 return *document_;
592 } 599 }
593 600
594 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::WorkerGlobalScope() 601 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::WorkerGlobalScope()
595 const { 602 const {
596 DCHECK(worker_global_scope_); 603 DCHECK(worker_global_scope_);
597 return worker_global_scope_; 604 return worker_global_scope_;
598 } 605 }
599 606
600 } // namespace blink 607 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698