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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2610653002: Tidy up XMLHttpRequest::endLoading(). (Closed)
Patch Set: alpha conversion + use it at two more call sites Created 3 years, 11 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 17 matching lines...) Expand all
28 */ 28 */
29 29
30 #include "core/loader/DocumentLoader.h" 30 #include "core/loader/DocumentLoader.h"
31 31
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/DocumentParser.h" 33 #include "core/dom/DocumentParser.h"
34 #include "core/dom/WeakIdentifierMap.h" 34 #include "core/dom/WeakIdentifierMap.h"
35 #include "core/events/Event.h" 35 #include "core/events/Event.h"
36 #include "core/fetch/FetchInitiatorTypeNames.h" 36 #include "core/fetch/FetchInitiatorTypeNames.h"
37 #include "core/fetch/FetchRequest.h" 37 #include "core/fetch/FetchRequest.h"
38 #include "core/fetch/FetchUtils.h"
38 #include "core/fetch/MemoryCache.h" 39 #include "core/fetch/MemoryCache.h"
39 #include "core/fetch/ResourceFetcher.h" 40 #include "core/fetch/ResourceFetcher.h"
40 #include "core/frame/Deprecation.h" 41 #include "core/frame/Deprecation.h"
41 #include "core/frame/FrameHost.h" 42 #include "core/frame/FrameHost.h"
42 #include "core/frame/LocalDOMWindow.h" 43 #include "core/frame/LocalDOMWindow.h"
43 #include "core/frame/LocalFrame.h" 44 #include "core/frame/LocalFrame.h"
44 #include "core/frame/Settings.h" 45 #include "core/frame/Settings.h"
45 #include "core/frame/csp/ContentSecurityPolicy.h" 46 #include "core/frame/csp/ContentSecurityPolicy.h"
46 #include "core/html/HTMLFrameOwnerElement.h" 47 #include "core/html/HTMLFrameOwnerElement.h"
47 #include "core/html/parser/HTMLDocumentParser.h" 48 #include "core/html/parser/HTMLDocumentParser.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 m_mainResource->setDataBufferingPolicy(BufferData); 498 m_mainResource->setDataBufferingPolicy(BufferData);
498 499
499 if (!shouldContinueForResponse()) { 500 if (!shouldContinueForResponse()) {
500 InspectorInstrumentation::continueWithPolicyIgnore( 501 InspectorInstrumentation::continueWithPolicyIgnore(
501 m_frame, this, m_mainResource->identifier(), m_response, 502 m_frame, this, m_mainResource->identifier(), m_response,
502 m_mainResource.get()); 503 m_mainResource.get());
503 m_fetcher->stopFetching(); 504 m_fetcher->stopFetching();
504 return; 505 return;
505 } 506 }
506 507
507 if (m_response.isHTTP()) { 508 if (m_frame->owner() && m_response.isHTTP() &&
508 int status = m_response.httpStatusCode(); 509 !FetchUtils::isOkStatus(m_response.httpStatusCode()))
509 if ((status < 200 || status >= 300) && m_frame->owner()) 510 m_frame->owner()->renderFallbackContent();
510 m_frame->owner()->renderFallbackContent();
511 }
512 } 511 }
513 512
514 void DocumentLoader::ensureWriter(const AtomicString& mimeType, 513 void DocumentLoader::ensureWriter(const AtomicString& mimeType,
515 const KURL& overridingURL) { 514 const KURL& overridingURL) {
516 if (m_writer) 515 if (m_writer)
517 return; 516 return;
518 517
519 const AtomicString& encoding = response().textEncodingName(); 518 const AtomicString& encoding = response().textEncodingName();
520 519
521 // Prepare a DocumentInit before clearing the frame, because it may need to 520 // Prepare a DocumentInit before clearing the frame, because it may need to
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 m_writer ? m_writer->encoding() : emptyAtom, true, 800 m_writer ? m_writer->encoding() : emptyAtom, true,
802 ForceSynchronousParsing); 801 ForceSynchronousParsing);
803 if (!source.isNull()) 802 if (!source.isNull())
804 m_writer->appendReplacingData(source); 803 m_writer->appendReplacingData(source);
805 endWriting(); 804 endWriting();
806 } 805 }
807 806
808 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 807 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
809 808
810 } // namespace blink 809 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FetchUtils.h ('k') | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698