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

Side by Side Diff: Source/modules/fetch/FetchManager.cpp

Issue 1195453005: [Fetch] Omit console error messages for cancellation, timeout, and non-BlinkInternal (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comment fix. Created 5 years, 6 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
« no previous file with comments | « LayoutTests/http/tests/fetch/chromium/error-messages-expected.txt ('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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/fetch/FetchManager.h" 6 #include "modules/fetch/FetchManager.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 ASSERT(m_responseBuffer); 188 ASSERT(m_responseBuffer);
189 ASSERT(!m_failed); 189 ASSERT(!m_failed);
190 m_responseBuffer->close(); 190 m_responseBuffer->close();
191 m_responseBuffer.clear(); 191 m_responseBuffer.clear();
192 m_finished = true; 192 m_finished = true;
193 notifyFinished(); 193 notifyFinished();
194 } 194 }
195 195
196 void FetchManager::Loader::didFail(const ResourceError& error) 196 void FetchManager::Loader::didFail(const ResourceError& error)
197 { 197 {
198 failed("Fetch API cannot load " + error.failingURL() + ". " + error.localize dDescription()); 198 if (error.isCancellation() || error.isTimeout() || error.domain() != errorDo mainBlinkInternal)
199 failed(String());
200 else
201 failed("Fetch API cannot load " + error.failingURL() + ". " + error.loca lizedDescription());
199 } 202 }
200 203
201 void FetchManager::Loader::didFailAccessControlCheck(const ResourceError& error) 204 void FetchManager::Loader::didFailAccessControlCheck(const ResourceError& error)
202 { 205 {
203 failed("Fetch API cannot load " + error.failingURL() + ". " + error.localize dDescription()); 206 if (error.isCancellation() || error.isTimeout() || error.domain() != errorDo mainBlinkInternal)
207 failed(String());
208 else
209 failed("Fetch API cannot load " + error.failingURL() + ". " + error.loca lizedDescription());
204 } 210 }
205 211
206 void FetchManager::Loader::didFailRedirectCheck() 212 void FetchManager::Loader::didFailRedirectCheck()
207 { 213 {
208 failed("Fetch API cannot load " + m_request->url().string() + ". Redirect fa iled."); 214 failed("Fetch API cannot load " + m_request->url().string() + ". Redirect fa iled.");
209 } 215 }
210 216
211 void FetchManager::Loader::start() 217 void FetchManager::Loader::start()
212 { 218 {
213 // "1. If |request|'s url contains a Known HSTS Host, modify it per the 219 // "1. If |request|'s url contains a Known HSTS Host, modify it per the
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 m_loader = ThreadableLoader::create(*executionContext(), this, request, thre adableLoaderOptions, resourceLoaderOptions); 429 m_loader = ThreadableLoader::create(*executionContext(), this, request, thre adableLoaderOptions, resourceLoaderOptions);
424 if (!m_loader) 430 if (!m_loader)
425 performNetworkError("Can't create ThreadableLoader"); 431 performNetworkError("Can't create ThreadableLoader");
426 } 432 }
427 433
428 void FetchManager::Loader::failed(const String& message) 434 void FetchManager::Loader::failed(const String& message)
429 { 435 {
430 if (m_failed || m_finished) 436 if (m_failed || m_finished)
431 return; 437 return;
432 m_failed = true; 438 m_failed = true;
433 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource , ErrorMessageLevel, message)); 439 if (!message.isEmpty())
440 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSo urce, ErrorMessageLevel, message));
434 if (m_responseBuffer) { 441 if (m_responseBuffer) {
435 m_responseBuffer->error(DOMException::create(NetworkError, "Failed to fe tch")); 442 m_responseBuffer->error(DOMException::create(NetworkError, "Failed to fe tch"));
436 m_responseBuffer.clear(); 443 m_responseBuffer.clear();
437 } else if (m_resolver) { 444 } else if (m_resolver) {
438 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped()) 445 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped())
439 return; 446 return;
440 ScriptState* state = m_resolver->scriptState(); 447 ScriptState* state = m_resolver->scriptState();
441 ScriptState::Scope scope(state); 448 ScriptState::Scope scope(state);
442 m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), " Failed to fetch")); 449 m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), " Failed to fetch"));
443 } 450 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 502
496 DEFINE_TRACE(FetchManager) 503 DEFINE_TRACE(FetchManager)
497 { 504 {
498 #if ENABLE(OILPAN) 505 #if ENABLE(OILPAN)
499 visitor->trace(m_executionContext); 506 visitor->trace(m_executionContext);
500 visitor->trace(m_loaders); 507 visitor->trace(m_loaders);
501 #endif 508 #endif
502 } 509 }
503 510
504 } // namespace blink 511 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/fetch/chromium/error-messages-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698