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

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

Issue 1733093002: [Test] have the provisional DocumentLoader protect itself (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 : m_frame(frame) 86 : m_frame(frame)
87 , m_fetcher(FrameFetchContext::createContextAndFetcher(this)) 87 , m_fetcher(FrameFetchContext::createContextAndFetcher(this))
88 , m_originalRequest(req) 88 , m_originalRequest(req)
89 , m_substituteData(substituteData) 89 , m_substituteData(substituteData)
90 , m_request(req) 90 , m_request(req)
91 , m_isClientRedirect(false) 91 , m_isClientRedirect(false)
92 , m_replacesCurrentHistoryItem(false) 92 , m_replacesCurrentHistoryItem(false)
93 , m_navigationType(NavigationTypeOther) 93 , m_navigationType(NavigationTypeOther)
94 , m_documentLoadTiming(*this) 94 , m_documentLoadTiming(*this)
95 , m_timeOfLastDataReceived(0.0) 95 , m_timeOfLastDataReceived(0.0)
96 , m_shouldProtect(false)
96 , m_applicationCacheHost(ApplicationCacheHost::create(this)) 97 , m_applicationCacheHost(ApplicationCacheHost::create(this))
97 , m_state(NotStarted) 98 , m_state(NotStarted)
98 , m_inDataReceived(false) 99 , m_inDataReceived(false)
99 , m_dataBuffer(SharedBuffer::create()) 100 , m_dataBuffer(SharedBuffer::create())
100 { 101 {
101 } 102 }
102 103
103 FrameLoader* DocumentLoader::frameLoader() const 104 FrameLoader* DocumentLoader::frameLoader() const
104 { 105 {
105 if (!m_frame) 106 if (!m_frame)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 frameLoader()->receivedMainResourceError(this, error); 236 frameLoader()->receivedMainResourceError(this, error);
236 clearMainResourceHandle(); 237 clearMainResourceHandle();
237 } 238 }
238 239
239 // Cancels the data source's pending loads. Conceptually, a data source only lo ads 240 // Cancels the data source's pending loads. Conceptually, a data source only lo ads
240 // one document at a time, but one document may have many related resources. 241 // one document at a time, but one document may have many related resources.
241 // stopLoading will stop all loads initiated by the data source, 242 // stopLoading will stop all loads initiated by the data source,
242 // but not loads initiated by child frames' data sources -- that's the WebFrame' s job. 243 // but not loads initiated by child frames' data sources -- that's the WebFrame' s job.
243 void DocumentLoader::stopLoading() 244 void DocumentLoader::stopLoading()
244 { 245 {
246 if (m_shouldProtect)
247 return;
245 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get()); 248 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get());
246 RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this); 249 RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this);
247 250
248 if (isLoading()) 251 if (isLoading())
249 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); 252 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
250 m_fetcher->stopFetching(); 253 m_fetcher->stopFetching();
251 } 254 }
252 255
253 void DocumentLoader::commitIfReady() 256 void DocumentLoader::commitIfReady()
254 { 257 {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 m_redirectChain.append(url); 569 m_redirectChain.append(url);
567 } 570 }
568 571
569 bool DocumentLoader::loadingMultipartContent() const 572 bool DocumentLoader::loadingMultipartContent() const
570 { 573 {
571 return mainResourceLoader() ? mainResourceLoader()->loadingMultipartContent( ) : false; 574 return mainResourceLoader() ? mainResourceLoader()->loadingMultipartContent( ) : false;
572 } 575 }
573 576
574 void DocumentLoader::detachFromFrame() 577 void DocumentLoader::detachFromFrame()
575 { 578 {
579 if (m_shouldProtect)
580 return;
576 ASSERT(m_frame); 581 ASSERT(m_frame);
577 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get()); 582 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get());
578 RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this); 583 RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this);
579 584
580 // It never makes sense to have a document loader that is detached from its 585 // It never makes sense to have a document loader that is detached from its
581 // frame have any loads active, so go ahead and kill all the loads. 586 // frame have any loads active, so go ahead and kill all the loads.
582 stopLoading(); 587 stopLoading();
583 588
584 // If that load cancellation triggered another detach, leave. 589 // If that load cancellation triggered another detach, leave.
585 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.) 590 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 { 770 {
766 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 771 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
767 if (!source.isNull()) 772 if (!source.isNull())
768 m_writer->appendReplacingData(source); 773 m_writer->appendReplacingData(source);
769 endWriting(m_writer.get()); 774 endWriting(m_writer.get());
770 } 775 }
771 776
772 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 777 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
773 778
774 } // namespace blink 779 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698